24
24
from ...types .optimize_placement_body_response import OptimizePlacementBodyResponse
25
25
from .types .settings import Settings
26
26
from ...types .get_spectrum_response import GetSpectrumResponse
27
+ from ...types .get_optimizable_parameters_response import GetOptimizableParametersResponse
27
28
from ...core .client_wrapper import AsyncClientWrapper
28
29
29
30
# this is used as the default value for optional parameters
@@ -470,13 +471,7 @@ def optimize(
470
471
471
472
Examples
472
473
--------
473
- from axiomatic import (
474
- Axiomatic,
475
- Computation,
476
- Netlist,
477
- Parameter,
478
- StatementDictionary,
479
- )
474
+ from axiomatic import Axiomatic, Computation, Netlist, StatementDictionary
480
475
481
476
client = Axiomatic(
482
477
api_key="YOUR_API_KEY",
@@ -490,11 +485,7 @@ def optimize(
490
485
arguments={"key": 1.1},
491
486
)
492
487
},
493
- parameters=[
494
- Parameter(
495
- path="path",
496
- )
497
- ],
488
+ parameters=[{"path": "path"}],
498
489
)
499
490
"""
500
491
_response = self ._client_wrapper .httpx_client .request (
@@ -510,9 +501,7 @@ def optimize(
510
501
"mapping" : convert_and_respect_annotation_metadata (
511
502
object_ = mapping , annotation = typing .Dict [str , Computation ], direction = "write"
512
503
),
513
- "parameters" : convert_and_respect_annotation_metadata (
514
- object_ = parameters , annotation = typing .Sequence [Parameter ], direction = "write"
515
- ),
504
+ "parameters" : parameters ,
516
505
"config" : convert_and_respect_annotation_metadata (
517
506
object_ = config , annotation = OptimizeConfig , direction = "write"
518
507
),
@@ -776,6 +765,60 @@ def get_sax_spectrum(
776
765
raise ApiError (status_code = _response .status_code , body = _response .text )
777
766
raise ApiError (status_code = _response .status_code , body = _response_json )
778
767
768
+ def get_optimizable_parameters (
769
+ self , * , request_options : typing .Optional [RequestOptions ] = None
770
+ ) -> GetOptimizableParametersResponse :
771
+ """
772
+ Gets the optimizable parameters of a circuit.
773
+
774
+ Parameters
775
+ ----------
776
+ request_options : typing.Optional[RequestOptions]
777
+ Request-specific configuration.
778
+
779
+ Returns
780
+ -------
781
+ GetOptimizableParametersResponse
782
+ Successful Response
783
+
784
+ Examples
785
+ --------
786
+ from axiomatic import Axiomatic
787
+
788
+ client = Axiomatic(
789
+ api_key="YOUR_API_KEY",
790
+ )
791
+ client.pic.circuit.get_optimizable_parameters()
792
+ """
793
+ _response = self ._client_wrapper .httpx_client .request (
794
+ "pic/circuit/optimizable-parameters/get" ,
795
+ method = "GET" ,
796
+ request_options = request_options ,
797
+ )
798
+ try :
799
+ if 200 <= _response .status_code < 300 :
800
+ return typing .cast (
801
+ GetOptimizableParametersResponse ,
802
+ parse_obj_as (
803
+ type_ = GetOptimizableParametersResponse , # type: ignore
804
+ object_ = _response .json (),
805
+ ),
806
+ )
807
+ if _response .status_code == 422 :
808
+ raise UnprocessableEntityError (
809
+ typing .cast (
810
+ HttpValidationError ,
811
+ parse_obj_as (
812
+ type_ = HttpValidationError , # type: ignore
813
+ object_ = _response .json (),
814
+ ),
815
+ )
816
+ )
817
+ _response_json = _response .json ()
818
+ except JSONDecodeError :
819
+ raise ApiError (status_code = _response .status_code , body = _response .text )
820
+ raise ApiError (status_code = _response .status_code , body = _response_json )
821
+
779
822
780
823
class AsyncCircuitClient :
781
824
def __init__ (self , * , client_wrapper : AsyncClientWrapper ):
@@ -1259,13 +1302,7 @@ async def optimize(
1259
1302
--------
1260
1303
import asyncio
1261
1304
1262
- from axiomatic import (
1263
- AsyncAxiomatic,
1264
- Computation,
1265
- Netlist,
1266
- Parameter,
1267
- StatementDictionary,
1268
- )
1305
+ from axiomatic import AsyncAxiomatic, Computation, Netlist, StatementDictionary
1269
1306
1270
1307
client = AsyncAxiomatic(
1271
1308
api_key="YOUR_API_KEY",
@@ -1282,11 +1319,7 @@ async def main() -> None:
1282
1319
arguments={"key": 1.1},
1283
1320
)
1284
1321
},
1285
- parameters=[
1286
- Parameter(
1287
- path="path",
1288
- )
1289
- ],
1322
+ parameters=[{"path": "path"}],
1290
1323
)
1291
1324
1292
1325
@@ -1305,9 +1338,7 @@ async def main() -> None:
1305
1338
"mapping" : convert_and_respect_annotation_metadata (
1306
1339
object_ = mapping , annotation = typing .Dict [str , Computation ], direction = "write"
1307
1340
),
1308
- "parameters" : convert_and_respect_annotation_metadata (
1309
- object_ = parameters , annotation = typing .Sequence [Parameter ], direction = "write"
1310
- ),
1341
+ "parameters" : parameters ,
1311
1342
"config" : convert_and_respect_annotation_metadata (
1312
1343
object_ = config , annotation = OptimizeConfig , direction = "write"
1313
1344
),
@@ -1594,3 +1625,65 @@ async def main() -> None:
1594
1625
except JSONDecodeError :
1595
1626
raise ApiError (status_code = _response .status_code , body = _response .text )
1596
1627
raise ApiError (status_code = _response .status_code , body = _response_json )
1628
+
1629
+ async def get_optimizable_parameters (
1630
+ self , * , request_options : typing .Optional [RequestOptions ] = None
1631
+ ) -> GetOptimizableParametersResponse :
1632
+ """
1633
+ Gets the optimizable parameters of a circuit.
1634
+
1635
+ Parameters
1636
+ ----------
1637
+ request_options : typing.Optional[RequestOptions]
1638
+ Request-specific configuration.
1639
+
1640
+ Returns
1641
+ -------
1642
+ GetOptimizableParametersResponse
1643
+ Successful Response
1644
+
1645
+ Examples
1646
+ --------
1647
+ import asyncio
1648
+
1649
+ from axiomatic import AsyncAxiomatic
1650
+
1651
+ client = AsyncAxiomatic(
1652
+ api_key="YOUR_API_KEY",
1653
+ )
1654
+
1655
+
1656
+ async def main() -> None:
1657
+ await client.pic.circuit.get_optimizable_parameters()
1658
+
1659
+
1660
+ asyncio.run(main())
1661
+ """
1662
+ _response = await self ._client_wrapper .httpx_client .request (
1663
+ "pic/circuit/optimizable-parameters/get" ,
1664
+ method = "GET" ,
1665
+ request_options = request_options ,
1666
+ )
1667
+ try :
1668
+ if 200 <= _response .status_code < 300 :
1669
+ return typing .cast (
1670
+ GetOptimizableParametersResponse ,
1671
+ parse_obj_as (
1672
+ type_ = GetOptimizableParametersResponse , # type: ignore
1673
+ object_ = _response .json (),
1674
+ ),
1675
+ )
1676
+ if _response .status_code == 422 :
1677
+ raise UnprocessableEntityError (
1678
+ typing .cast (
1679
+ HttpValidationError ,
1680
+ parse_obj_as (
1681
+ type_ = HttpValidationError , # type: ignore
1682
+ object_ = _response .json (),
1683
+ ),
1684
+ )
1685
+ )
1686
+ _response_json = _response .json ()
1687
+ except JSONDecodeError :
1688
+ raise ApiError (status_code = _response .status_code , body = _response .text )
1689
+ raise ApiError (status_code = _response .status_code , body = _response_json )
0 commit comments