18
18
ListBookingsRequestOrderBy ,
19
19
ListJobResultsRequestOrderBy ,
20
20
ListJobsRequestOrderBy ,
21
+ ListModelsRequestOrderBy ,
21
22
ListPlatformsRequestOrderBy ,
22
23
ListProcessResultsRequestOrderBy ,
23
24
ListProcessesRequestOrderBy ,
29
30
Application ,
30
31
Booking ,
31
32
CreateJobRequest ,
33
+ CreateModelRequest ,
32
34
CreateProcessRequest ,
33
35
CreateSessionRequest ,
34
36
CreateSessionRequestBookingDemand ,
39
41
ListBookingsResponse ,
40
42
ListJobResultsResponse ,
41
43
ListJobsResponse ,
44
+ ListModelsResponse ,
42
45
ListPlatformsResponse ,
43
46
ListProcessResultsResponse ,
44
47
ListProcessesResponse ,
45
48
ListSessionACLsResponse ,
46
49
ListSessionsResponse ,
50
+ Model ,
47
51
Platform ,
48
52
Process ,
49
53
ProcessResult ,
64
68
unmarshal_Application ,
65
69
unmarshal_Booking ,
66
70
unmarshal_Job ,
71
+ unmarshal_Model ,
67
72
unmarshal_Platform ,
68
73
unmarshal_Process ,
69
74
unmarshal_Session ,
70
75
unmarshal_ListApplicationsResponse ,
71
76
unmarshal_ListBookingsResponse ,
72
77
unmarshal_ListJobResultsResponse ,
73
78
unmarshal_ListJobsResponse ,
79
+ unmarshal_ListModelsResponse ,
74
80
unmarshal_ListPlatformsResponse ,
75
81
unmarshal_ListProcessResultsResponse ,
76
82
unmarshal_ListProcessesResponse ,
77
83
unmarshal_ListSessionACLsResponse ,
78
84
unmarshal_ListSessionsResponse ,
79
85
marshal_CreateJobRequest ,
86
+ marshal_CreateModelRequest ,
80
87
marshal_CreateProcessRequest ,
81
88
marshal_CreateSessionRequest ,
82
89
marshal_UpdateBookingRequest ,
@@ -331,6 +338,8 @@ async def create_job(
331
338
circuit : JobCircuit ,
332
339
tags : Optional [List [str ]] = None ,
333
340
max_duration : Optional [str ] = None ,
341
+ model_id : Optional [str ] = None ,
342
+ parameters : Optional [str ] = None ,
334
343
) -> Job :
335
344
"""
336
345
Create a job.
@@ -340,6 +349,8 @@ async def create_job(
340
349
:param circuit: Quantum circuit that should be executed.
341
350
:param tags: Tags of the job.
342
351
:param max_duration: Maximum duration of the job.
352
+ :param model_id: Computation model ID to be executed by the job.
353
+ :param parameters: Execution parameters for this job.
343
354
:return: :class:`Job <Job>`
344
355
345
356
Usage:
@@ -362,6 +373,8 @@ async def create_job(
362
373
circuit = circuit ,
363
374
tags = tags ,
364
375
max_duration = max_duration ,
376
+ model_id = model_id ,
377
+ parameters = parameters ,
365
378
),
366
379
self .client ,
367
380
),
@@ -780,6 +793,7 @@ async def create_session(
780
793
tags : Optional [List [str ]] = None ,
781
794
deduplication_id : Optional [str ] = None ,
782
795
booking_demand : Optional [CreateSessionRequestBookingDemand ] = None ,
796
+ model_id : Optional [str ] = None ,
783
797
) -> Session :
784
798
"""
785
799
Create a session.
@@ -792,6 +806,7 @@ async def create_session(
792
806
:param tags: Tags of the session.
793
807
:param deduplication_id: Deduplication ID of the session.
794
808
:param booking_demand: A booking demand to schedule the session, only applicable if the platform is bookable.
809
+ :param model_id: Default computation model ID to be executed by job assigned to this session.
795
810
:return: :class:`Session <Session>`
796
811
797
812
Usage:
@@ -815,6 +830,7 @@ async def create_session(
815
830
tags = tags ,
816
831
deduplication_id = deduplication_id ,
817
832
booking_demand = booking_demand ,
833
+ model_id = model_id ,
818
834
),
819
835
self .client ,
820
836
),
@@ -1655,3 +1671,138 @@ async def update_booking(
1655
1671
1656
1672
self ._throw_on_error (res )
1657
1673
return unmarshal_Booking (res .json ())
1674
+
1675
+ async def create_model (
1676
+ self ,
1677
+ * ,
1678
+ project_id : Optional [str ] = None ,
1679
+ payload : Optional [str ] = None ,
1680
+ ) -> Model :
1681
+ """
1682
+ Create a new model.
1683
+ Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session.
1684
+ :param project_id: Project ID to attach this model.
1685
+ :param payload: The serialized model data.
1686
+ :return: :class:`Model <Model>`
1687
+
1688
+ Usage:
1689
+ ::
1690
+
1691
+ result = await api.create_model()
1692
+ """
1693
+
1694
+ res = self ._request (
1695
+ "POST" ,
1696
+ "/qaas/v1alpha1/models" ,
1697
+ body = marshal_CreateModelRequest (
1698
+ CreateModelRequest (
1699
+ project_id = project_id ,
1700
+ payload = payload ,
1701
+ ),
1702
+ self .client ,
1703
+ ),
1704
+ )
1705
+
1706
+ self ._throw_on_error (res )
1707
+ return unmarshal_Model (res .json ())
1708
+
1709
+ async def get_model (
1710
+ self ,
1711
+ * ,
1712
+ model_id : str ,
1713
+ ) -> Model :
1714
+ """
1715
+ Get model information.
1716
+ Retrieve information about of the provided **model ID**.
1717
+ :param model_id: Unique ID of the model.
1718
+ :return: :class:`Model <Model>`
1719
+
1720
+ Usage:
1721
+ ::
1722
+
1723
+ result = await api.get_model(
1724
+ model_id="example",
1725
+ )
1726
+ """
1727
+
1728
+ param_model_id = validate_path_param ("model_id" , model_id )
1729
+
1730
+ res = self ._request (
1731
+ "GET" ,
1732
+ f"/qaas/v1alpha1/models/{ param_model_id } " ,
1733
+ )
1734
+
1735
+ self ._throw_on_error (res )
1736
+ return unmarshal_Model (res .json ())
1737
+
1738
+ async def list_models (
1739
+ self ,
1740
+ * ,
1741
+ project_id : Optional [str ] = None ,
1742
+ page : Optional [int ] = None ,
1743
+ page_size : Optional [int ] = None ,
1744
+ order_by : Optional [ListModelsRequestOrderBy ] = None ,
1745
+ ) -> ListModelsResponse :
1746
+ """
1747
+ List all models attached to the **project ID**.
1748
+ Retrieve information about all models of the provided **project ID**.
1749
+ :param project_id: List models belonging to this project ID.
1750
+ :param page: Page number.
1751
+ :param page_size: Maximum number of results to return per page.
1752
+ :param order_by: Sort order of the returned results.
1753
+ :return: :class:`ListModelsResponse <ListModelsResponse>`
1754
+
1755
+ Usage:
1756
+ ::
1757
+
1758
+ result = await api.list_models()
1759
+ """
1760
+
1761
+ res = self ._request (
1762
+ "GET" ,
1763
+ "/qaas/v1alpha1/models" ,
1764
+ params = {
1765
+ "order_by" : order_by ,
1766
+ "page" : page ,
1767
+ "page_size" : page_size or self .client .default_page_size ,
1768
+ "project_id" : project_id or self .client .default_project_id ,
1769
+ },
1770
+ )
1771
+
1772
+ self ._throw_on_error (res )
1773
+ return unmarshal_ListModelsResponse (res .json ())
1774
+
1775
+ async def list_models_all (
1776
+ self ,
1777
+ * ,
1778
+ project_id : Optional [str ] = None ,
1779
+ page : Optional [int ] = None ,
1780
+ page_size : Optional [int ] = None ,
1781
+ order_by : Optional [ListModelsRequestOrderBy ] = None ,
1782
+ ) -> List [Model ]:
1783
+ """
1784
+ List all models attached to the **project ID**.
1785
+ Retrieve information about all models of the provided **project ID**.
1786
+ :param project_id: List models belonging to this project ID.
1787
+ :param page: Page number.
1788
+ :param page_size: Maximum number of results to return per page.
1789
+ :param order_by: Sort order of the returned results.
1790
+ :return: :class:`List[Model] <List[Model]>`
1791
+
1792
+ Usage:
1793
+ ::
1794
+
1795
+ result = await api.list_models_all()
1796
+ """
1797
+
1798
+ return await fetch_all_pages_async (
1799
+ type = ListModelsResponse ,
1800
+ key = "models" ,
1801
+ fetcher = self .list_models ,
1802
+ args = {
1803
+ "project_id" : project_id ,
1804
+ "page" : page ,
1805
+ "page_size" : page_size ,
1806
+ "order_by" : order_by ,
1807
+ },
1808
+ )
0 commit comments