1818 ListBookingsRequestOrderBy ,
1919 ListJobResultsRequestOrderBy ,
2020 ListJobsRequestOrderBy ,
21+ ListModelsRequestOrderBy ,
2122 ListPlatformsRequestOrderBy ,
2223 ListProcessResultsRequestOrderBy ,
2324 ListProcessesRequestOrderBy ,
2930 Application ,
3031 Booking ,
3132 CreateJobRequest ,
33+ CreateModelRequest ,
3234 CreateProcessRequest ,
3335 CreateSessionRequest ,
3436 CreateSessionRequestBookingDemand ,
3941 ListBookingsResponse ,
4042 ListJobResultsResponse ,
4143 ListJobsResponse ,
44+ ListModelsResponse ,
4245 ListPlatformsResponse ,
4346 ListProcessResultsResponse ,
4447 ListProcessesResponse ,
4548 ListSessionACLsResponse ,
4649 ListSessionsResponse ,
50+ Model ,
4751 Platform ,
4852 Process ,
4953 ProcessResult ,
6468 unmarshal_Application ,
6569 unmarshal_Booking ,
6670 unmarshal_Job ,
71+ unmarshal_Model ,
6772 unmarshal_Platform ,
6873 unmarshal_Process ,
6974 unmarshal_Session ,
7075 unmarshal_ListApplicationsResponse ,
7176 unmarshal_ListBookingsResponse ,
7277 unmarshal_ListJobResultsResponse ,
7378 unmarshal_ListJobsResponse ,
79+ unmarshal_ListModelsResponse ,
7480 unmarshal_ListPlatformsResponse ,
7581 unmarshal_ListProcessResultsResponse ,
7682 unmarshal_ListProcessesResponse ,
7783 unmarshal_ListSessionACLsResponse ,
7884 unmarshal_ListSessionsResponse ,
7985 marshal_CreateJobRequest ,
86+ marshal_CreateModelRequest ,
8087 marshal_CreateProcessRequest ,
8188 marshal_CreateSessionRequest ,
8289 marshal_UpdateBookingRequest ,
@@ -331,6 +338,8 @@ async def create_job(
331338 circuit : JobCircuit ,
332339 tags : Optional [List [str ]] = None ,
333340 max_duration : Optional [str ] = None ,
341+ model_id : Optional [str ] = None ,
342+ parameters : Optional [str ] = None ,
334343 ) -> Job :
335344 """
336345 Create a job.
@@ -340,6 +349,8 @@ async def create_job(
340349 :param circuit: Quantum circuit that should be executed.
341350 :param tags: Tags of the job.
342351 :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.
343354 :return: :class:`Job <Job>`
344355
345356 Usage:
@@ -362,6 +373,8 @@ async def create_job(
362373 circuit = circuit ,
363374 tags = tags ,
364375 max_duration = max_duration ,
376+ model_id = model_id ,
377+ parameters = parameters ,
365378 ),
366379 self .client ,
367380 ),
@@ -780,6 +793,7 @@ async def create_session(
780793 tags : Optional [List [str ]] = None ,
781794 deduplication_id : Optional [str ] = None ,
782795 booking_demand : Optional [CreateSessionRequestBookingDemand ] = None ,
796+ model_id : Optional [str ] = None ,
783797 ) -> Session :
784798 """
785799 Create a session.
@@ -792,6 +806,7 @@ async def create_session(
792806 :param tags: Tags of the session.
793807 :param deduplication_id: Deduplication ID of the session.
794808 :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.
795810 :return: :class:`Session <Session>`
796811
797812 Usage:
@@ -815,6 +830,7 @@ async def create_session(
815830 tags = tags ,
816831 deduplication_id = deduplication_id ,
817832 booking_demand = booking_demand ,
833+ model_id = model_id ,
818834 ),
819835 self .client ,
820836 ),
@@ -1655,3 +1671,138 @@ async def update_booking(
16551671
16561672 self ._throw_on_error (res )
16571673 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