mistralai 1.9.7__py3-none-any.whl → 1.9.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_version.py +2 -2
- {mistralai-1.9.7.dist-info → mistralai-1.9.8.dist-info}/METADATA +1 -1
- {mistralai-1.9.7.dist-info → mistralai-1.9.8.dist-info}/RECORD +40 -29
- mistralai_azure/_hooks/types.py +7 -0
- mistralai_azure/_version.py +3 -3
- mistralai_azure/basesdk.py +12 -20
- mistralai_azure/chat.py +16 -0
- mistralai_azure/httpclient.py +6 -16
- mistralai_azure/models/__init__.py +298 -103
- mistralai_azure/models/assistantmessage.py +1 -1
- mistralai_azure/models/chatcompletionrequest.py +20 -3
- mistralai_azure/models/chatcompletionresponse.py +6 -6
- mistralai_azure/models/chatcompletionstreamrequest.py +20 -3
- mistralai_azure/models/completionresponsestreamchoice.py +1 -1
- mistralai_azure/models/deltamessage.py +1 -1
- mistralai_azure/models/documenturlchunk.py +62 -0
- mistralai_azure/models/filechunk.py +23 -0
- mistralai_azure/models/imageurl.py +1 -1
- mistralai_azure/models/jsonschema.py +1 -1
- mistralai_azure/models/mistralpromptmode.py +8 -0
- mistralai_azure/models/ocrimageobject.py +89 -0
- mistralai_azure/models/ocrpagedimensions.py +25 -0
- mistralai_azure/models/ocrpageobject.py +64 -0
- mistralai_azure/models/ocrrequest.py +120 -0
- mistralai_azure/models/ocrresponse.py +68 -0
- mistralai_azure/models/ocrusageinfo.py +57 -0
- mistralai_azure/models/responseformat.py +1 -1
- mistralai_azure/models/toolmessage.py +1 -1
- mistralai_azure/models/usageinfo.py +71 -8
- mistralai_azure/models/usermessage.py +1 -1
- mistralai_azure/ocr.py +271 -0
- mistralai_azure/sdkconfiguration.py +0 -7
- mistralai_azure/types/basemodel.py +3 -3
- mistralai_azure/utils/__init__.py +130 -45
- mistralai_azure/utils/datetimes.py +23 -0
- mistralai_azure/utils/enums.py +67 -27
- mistralai_azure/utils/forms.py +49 -28
- mistralai_azure/utils/serializers.py +32 -3
- {mistralai-1.9.7.dist-info → mistralai-1.9.8.dist-info}/LICENSE +0 -0
- {mistralai-1.9.7.dist-info → mistralai-1.9.8.dist-info}/WHEEL +0 -0
mistralai/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai"
|
|
6
|
-
__version__: str = "1.9.
|
|
6
|
+
__version__: str = "1.9.8"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
8
|
__gen_version__: str = "2.634.2"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.9.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.9.8 2.634.2 1.0.0 mistralai"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -3,32 +3,41 @@ mistralai_azure/_hooks/__init__.py,sha256=9_7W5jAYw8rcO8Kfc-Ty-lB82BHfksAJJpVFb_
|
|
|
3
3
|
mistralai_azure/_hooks/custom_user_agent.py,sha256=0m-1JzJxOT42rvRTEuCiFLqbOMriOlsraSrAGaXAbyo,656
|
|
4
4
|
mistralai_azure/_hooks/registration.py,sha256=5BN-U92pwP5kUaN7EOso2vWrwZlLvRcU5Coccibqp20,741
|
|
5
5
|
mistralai_azure/_hooks/sdkhooks.py,sha256=urOhVMYX_n5KgMoNDNmGs4fsgUWoeSG6_GarhPxH-YU,2565
|
|
6
|
-
mistralai_azure/_hooks/types.py,sha256=
|
|
7
|
-
mistralai_azure/_version.py,sha256=
|
|
8
|
-
mistralai_azure/basesdk.py,sha256=
|
|
9
|
-
mistralai_azure/chat.py,sha256=
|
|
10
|
-
mistralai_azure/httpclient.py,sha256=
|
|
11
|
-
mistralai_azure/models/__init__.py,sha256=
|
|
12
|
-
mistralai_azure/models/assistantmessage.py,sha256=
|
|
6
|
+
mistralai_azure/_hooks/types.py,sha256=F5N_UYekLG4DK9X22awmKxTefZCtmJ8JoH7MQ_1vvq8,3059
|
|
7
|
+
mistralai_azure/_version.py,sha256=v9Stuq-LTWVt4os7IEen_TdltjSyuWmz27kACZK3WmY,472
|
|
8
|
+
mistralai_azure/basesdk.py,sha256=GDFjY61iCGIMrrhM_m5DSeyMZV27X2MEwCb4QG7SK0s,11810
|
|
9
|
+
mistralai_azure/chat.py,sha256=GN3z1pP9Cq8W2l5GNS4lgvE1Jtmj_wDZI-5-ALTozro,37218
|
|
10
|
+
mistralai_azure/httpclient.py,sha256=Eu73urOAiZQtdUIyOUnPccxCiBbWEKrXG-JrRG3SLM4,3946
|
|
11
|
+
mistralai_azure/models/__init__.py,sha256=mEq5qJ0R8y0G28Hsnme4xFZ6ZsN9TAfJkVpV-9gecWU,14188
|
|
12
|
+
mistralai_azure/models/assistantmessage.py,sha256=aR4_dCNMC5gaViAGN1g-HvBdvkJoe3LMLG1xKbPQU9U,2661
|
|
13
13
|
mistralai_azure/models/chatcompletionchoice.py,sha256=-JE13p36mWnyc3zxnHLJp1Q43QVgj5QRurnZslXdJc0,935
|
|
14
|
-
mistralai_azure/models/chatcompletionrequest.py,sha256=
|
|
15
|
-
mistralai_azure/models/chatcompletionresponse.py,sha256=
|
|
16
|
-
mistralai_azure/models/chatcompletionstreamrequest.py,sha256=
|
|
14
|
+
mistralai_azure/models/chatcompletionrequest.py,sha256=w2VNBLoNOT55acEBt9STL6t3YnKxTIG8ZO1TjPSWHMM,10515
|
|
15
|
+
mistralai_azure/models/chatcompletionresponse.py,sha256=Yn7xcGIzmc2i4jSpq53YgmwOSKYk8oXKyIYWo8QjYfo,715
|
|
16
|
+
mistralai_azure/models/chatcompletionstreamrequest.py,sha256=ewycVKlbjL6Y-DY-99xw3-WtwAr7Z67Q5oCNz0cUs6s,9651
|
|
17
17
|
mistralai_azure/models/completionchunk.py,sha256=yoA0tYoyK5RChQPbEvYUi1BVmuyH-QT5IYwEYJNtsXM,877
|
|
18
18
|
mistralai_azure/models/completionevent.py,sha256=8wkRAMMpDFfhFSm7OEmli80lsK98Tir7R6IxW-KxeuE,405
|
|
19
|
-
mistralai_azure/models/completionresponsestreamchoice.py,sha256=
|
|
19
|
+
mistralai_azure/models/completionresponsestreamchoice.py,sha256=ysp8H1ztx8B_jlnqKgcwEb7St0BCEWKR1QhnPRhxBvU,1840
|
|
20
20
|
mistralai_azure/models/contentchunk.py,sha256=a7A9ymr1Qvg4am-uqrGxqrmTf9NBMPiGbVncuOevchE,881
|
|
21
|
-
mistralai_azure/models/deltamessage.py,sha256=
|
|
21
|
+
mistralai_azure/models/deltamessage.py,sha256=uDjAlgTy_W9wIX7qQUWbwsf7zSLn0GkBvYyIg7d_sto,1976
|
|
22
|
+
mistralai_azure/models/documenturlchunk.py,sha256=bxo2zp8MmL-be5AMGLD2XBCmgfzJMVc7-relOfKsz3o,1741
|
|
23
|
+
mistralai_azure/models/filechunk.py,sha256=wR69lE1QRNUwYDgKOM1ZXg5-8qQjomZ0tPzSUXgxqGI,653
|
|
22
24
|
mistralai_azure/models/function.py,sha256=VKcPB1oJ8_jvfXRfqufa2Y9to5WdxS-hi9OLu78GNpM,540
|
|
23
25
|
mistralai_azure/models/functioncall.py,sha256=H2eemkzk2Zm1LEm11atVh6PGvr6XJn9SWqNUziT_WK8,562
|
|
24
26
|
mistralai_azure/models/functionname.py,sha256=4rGsO-FYjvLMRGDBbdZ3cLyiiwml_voRQQ924K2_S1M,473
|
|
25
27
|
mistralai_azure/models/httpvalidationerror.py,sha256=tcUK2zfyCZ1TJjmvF93E9G2Ah-S2UUSpM-ZJBbR4hgc,616
|
|
26
|
-
mistralai_azure/models/imageurl.py,sha256=
|
|
28
|
+
mistralai_azure/models/imageurl.py,sha256=TUOpT-mTQJ9VoMoVcN303592gGBgrx6NZmmDhui-8h8,1402
|
|
27
29
|
mistralai_azure/models/imageurlchunk.py,sha256=JWfOtcxm-AEzRdNny-KWAWXV275hSnWFfn_Ux6OjrYA,1000
|
|
28
|
-
mistralai_azure/models/jsonschema.py,sha256=
|
|
30
|
+
mistralai_azure/models/jsonschema.py,sha256=Cu_coSyKmQB3tB_6PLKmcsdaOeyuAJDx5Z6Y1POuJ0Q,1689
|
|
31
|
+
mistralai_azure/models/mistralpromptmode.py,sha256=WDDqWnoJyI_krKYEOWNbWNYByFnLEYED_6hoYUZY_AE,259
|
|
32
|
+
mistralai_azure/models/ocrimageobject.py,sha256=FmmDchJs3dB7ctG_S-pFoUBhHvaLs20fJl3oya32VOo,2839
|
|
33
|
+
mistralai_azure/models/ocrpagedimensions.py,sha256=y3tkCQcdNUd_QWi3rzH6iROyVzsr4f-hQ8qh8bbbmgI,615
|
|
34
|
+
mistralai_azure/models/ocrpageobject.py,sha256=wF0iD_OpB-FFsLyQTuf7BExUMtAw0hMPGX4l1z3rXo8,2097
|
|
35
|
+
mistralai_azure/models/ocrrequest.py,sha256=N56QyuUst9uYasdioz6607RPEQuUs7xPNWtpZsJvHGo,4368
|
|
36
|
+
mistralai_azure/models/ocrresponse.py,sha256=BXz6SzdBWPELQoNd6dp6o8E3b3KlN1oUNMq4-JHquE4,2079
|
|
37
|
+
mistralai_azure/models/ocrusageinfo.py,sha256=mWKzoh9WQKeQOuQrSagn2LlXj3rvPHml_84UtEgalp0,1608
|
|
29
38
|
mistralai_azure/models/prediction.py,sha256=GERxBI8NoS9Fc14FD4ityVfJfXNts1dxjoK3XIVHHc0,730
|
|
30
39
|
mistralai_azure/models/referencechunk.py,sha256=uiouhIPrWpVEhpY_Cea1Som9XapC4mM3R82hhND-j-s,525
|
|
31
|
-
mistralai_azure/models/responseformat.py,sha256=
|
|
40
|
+
mistralai_azure/models/responseformat.py,sha256=A82NwuTKo-xI7b6VPkOwgQnIkGpzRQAo4zbSjdyXhzw,2262
|
|
32
41
|
mistralai_azure/models/responseformats.py,sha256=O9lwS2M9m53DsRxTC4uRP12SvRhgaQoMjIYsDys5A7s,503
|
|
33
42
|
mistralai_azure/models/sdkerror.py,sha256=kd75e3JYF2TXNgRZopcV-oGdBWoBZqRcvrwqn2fsFYs,528
|
|
34
43
|
mistralai_azure/models/security.py,sha256=lPLcQ1OV2SA6ZJP5_lOFWUDVuPc-L90C3N127KMWdPo,627
|
|
@@ -38,21 +47,23 @@ mistralai_azure/models/tool.py,sha256=Li0qpB3KgGN0mtT8lKG1N_MfOOwGvzok0ZRK_J3Us8
|
|
|
38
47
|
mistralai_azure/models/toolcall.py,sha256=MYHTegL2wzO23cG9AyPS9YhomXWh8ekULwzIeGt31Pw,836
|
|
39
48
|
mistralai_azure/models/toolchoice.py,sha256=etDg86Frx-VoiccMlGP_Va3Vipy4UGMa9LMUGQFY6UY,1033
|
|
40
49
|
mistralai_azure/models/toolchoiceenum.py,sha256=Ca4ileCwuOjfPzIXLRIxT3RkE5zR7oqV6nXU-UjW0w0,197
|
|
41
|
-
mistralai_azure/models/toolmessage.py,sha256=
|
|
50
|
+
mistralai_azure/models/toolmessage.py,sha256=I-zRrc1Qs_l0lfNTeGSP90SohNUuzv1q3TbigaB7y8w,2075
|
|
42
51
|
mistralai_azure/models/tooltypes.py,sha256=AGC_JaMGWyMRJ1rCIGhLh5DWbyohdiQkEeKoW5a97Ro,250
|
|
43
|
-
mistralai_azure/models/usageinfo.py,sha256=
|
|
44
|
-
mistralai_azure/models/usermessage.py,sha256=
|
|
52
|
+
mistralai_azure/models/usageinfo.py,sha256=u9Ds73z87KyluvVCLjlTXnzCVjbBGlLWTBBPpGK6AcM,2349
|
|
53
|
+
mistralai_azure/models/usermessage.py,sha256=tzTfEH0wzDHf96C8AJanTxckrDJOpxtMOa3tiLHDxs4,1805
|
|
45
54
|
mistralai_azure/models/validationerror.py,sha256=vghbUqW9H5AsbYmW5i0C56eHPFC054x8SJA-mJZPKak,532
|
|
55
|
+
mistralai_azure/ocr.py,sha256=hHX6-72A_nSRt8aPOaBf5DPP9NVKdqddRkkWObK8KeM,11911
|
|
46
56
|
mistralai_azure/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
|
|
47
57
|
mistralai_azure/sdk.py,sha256=CVTTW027gX8y4rhprAbmkB5W7r3afru01yRSPwxpMk4,5437
|
|
48
|
-
mistralai_azure/sdkconfiguration.py,sha256=
|
|
58
|
+
mistralai_azure/sdkconfiguration.py,sha256=tqLLVewof7YZcBIykjMjGZIEtX_b_JKaMP9KHNdrRsM,1728
|
|
49
59
|
mistralai_azure/types/__init__.py,sha256=RArOwSgeeTIva6h-4ttjXwMUeCkz10nAFBL9D-QljI4,377
|
|
50
|
-
mistralai_azure/types/basemodel.py,sha256=
|
|
51
|
-
mistralai_azure/utils/__init__.py,sha256=
|
|
60
|
+
mistralai_azure/types/basemodel.py,sha256=L79WXvTECbSqaJzs8D3ud_KdIWkU7Cx2wbohDAktE9E,1127
|
|
61
|
+
mistralai_azure/utils/__init__.py,sha256=811KKdkxMaWDfz2lMohUWqrR4JnIWxqeNQ1lRGQU4DM,5341
|
|
52
62
|
mistralai_azure/utils/annotations.py,sha256=aR7mZG34FzgRdew7WZPYEu9QGBerpuKxCF4sek5Z_5Y,1699
|
|
53
|
-
mistralai_azure/utils/
|
|
63
|
+
mistralai_azure/utils/datetimes.py,sha256=oppAA5e3V35pQov1-FNLKxAaNF1_XWi-bQtyjjql3H8,855
|
|
64
|
+
mistralai_azure/utils/enums.py,sha256=REU6ydF8gsVL3xaeGX4sMNyiL3q5P9h29-f6Sa6luAE,2633
|
|
54
65
|
mistralai_azure/utils/eventstreaming.py,sha256=LtcrfJYw4nP2Oe4Wl0-cEURLzRGYReRGWNFY5wYECIE,6186
|
|
55
|
-
mistralai_azure/utils/forms.py,sha256=
|
|
66
|
+
mistralai_azure/utils/forms.py,sha256=EJdnrfIkuwpDtekyHutla0HjI_FypTYcmYNyPKEu_W0,6874
|
|
56
67
|
mistralai_azure/utils/headers.py,sha256=cPxWSmUILrefTGDzTH1Hdj7_Hlsj-EY6K5Tyc4iH4dk,3663
|
|
57
68
|
mistralai_azure/utils/logger.py,sha256=9nUtlKHo3RFsIVyMw5jq3wEKZMVwHnZMSc6xLp-otC0,520
|
|
58
69
|
mistralai_azure/utils/metadata.py,sha256=Per2KFXXOqOtoUWXrlIfjrSrBg199KrRW0nKQDgHIBU,3136
|
|
@@ -60,7 +71,7 @@ mistralai_azure/utils/queryparams.py,sha256=MTK6inMS1_WwjmMJEJmAn67tSHHJyarpdGRl
|
|
|
60
71
|
mistralai_azure/utils/requestbodies.py,sha256=ySjEyjcLi731LNUahWvLOrES2HihuA8VrOJx4eQ7Qzg,2101
|
|
61
72
|
mistralai_azure/utils/retries.py,sha256=6yhfZifqIat9i76xF0lTR2jLj1IN9BNGyqqxATlEFPU,6348
|
|
62
73
|
mistralai_azure/utils/security.py,sha256=ktep3HKwbFs-MLxUYTM8Jd4v-ZBum5_Z0u1PFIdYBX0,5516
|
|
63
|
-
mistralai_azure/utils/serializers.py,sha256=
|
|
74
|
+
mistralai_azure/utils/serializers.py,sha256=hiHBXM1AY8_N2Z_rvFfNSYwvLBkSQlPGFp8poasdU4s,5986
|
|
64
75
|
mistralai_azure/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
|
65
76
|
mistralai_azure/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
|
|
66
77
|
mistralai_gcp/__init__.py,sha256=Tz5Y5FzbIUT1AmaYiTwJI56XTmuldo9AalaAm4h_FdE,423
|
|
@@ -139,7 +150,7 @@ mistralai/_hooks/deprecation_warning.py,sha256=eyEOf7-o9uqqNWJnufD2RXp3dYrGV4in9
|
|
|
139
150
|
mistralai/_hooks/registration.py,sha256=ML0W-XbE4WYdJ4eGks_XxF2aLCJTaIWjQATFGzFwvyU,861
|
|
140
151
|
mistralai/_hooks/sdkhooks.py,sha256=s-orhdvnV89TmI3QiPC2LWQtYeM9RrsG1CTll-fYZmQ,2559
|
|
141
152
|
mistralai/_hooks/types.py,sha256=70IiFr5bfsJYafuDkXQWVfl6nY4dQkA5SZoEBCircqs,3047
|
|
142
|
-
mistralai/_version.py,sha256=
|
|
153
|
+
mistralai/_version.py,sha256=6FjB8zY1tFIrap8yREauj7OwtQdW0EpeYdqcdGIlUwA,460
|
|
143
154
|
mistralai/accesses.py,sha256=o5VCW-nyOfwzopHo0jSXrPKJ1fqJL88PZto1RwysXPA,27320
|
|
144
155
|
mistralai/agents.py,sha256=3E-c1YZOp3mS1PqA6OYekZmOcAdLCqWfq1o-hqUMsIw,33960
|
|
145
156
|
mistralai/async_client.py,sha256=KUdYxIIqoD6L7vB0EGwUR6lQ0NK5iCTHjnLVR9CVcJY,355
|
|
@@ -445,7 +456,7 @@ mistralai/utils/security.py,sha256=vWlpkikOnGN_HRRhJ7Pb8ywVAjiM3d3ey3oTWtM6jTU,6
|
|
|
445
456
|
mistralai/utils/serializers.py,sha256=hiHBXM1AY8_N2Z_rvFfNSYwvLBkSQlPGFp8poasdU4s,5986
|
|
446
457
|
mistralai/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
|
447
458
|
mistralai/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
|
|
448
|
-
mistralai-1.9.
|
|
449
|
-
mistralai-1.9.
|
|
450
|
-
mistralai-1.9.
|
|
451
|
-
mistralai-1.9.
|
|
459
|
+
mistralai-1.9.8.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
|
|
460
|
+
mistralai-1.9.8.dist-info/METADATA,sha256=1Dbq0gOz5mYZMZq-iWpXAabW8wXQ04G8GrRQe1Il8Oc,37249
|
|
461
|
+
mistralai-1.9.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
462
|
+
mistralai-1.9.8.dist-info/RECORD,,
|
mistralai_azure/_hooks/types.py
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
4
|
import httpx
|
|
5
5
|
from mistralai_azure.httpclient import HttpClient
|
|
6
|
+
from mistralai_azure.sdkconfiguration import SDKConfiguration
|
|
6
7
|
from typing import Any, Callable, List, Optional, Tuple, Union
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class HookContext:
|
|
11
|
+
config: SDKConfiguration
|
|
10
12
|
base_url: str
|
|
11
13
|
operation_id: str
|
|
12
14
|
oauth2_scopes: Optional[List[str]] = None
|
|
@@ -14,11 +16,13 @@ class HookContext:
|
|
|
14
16
|
|
|
15
17
|
def __init__(
|
|
16
18
|
self,
|
|
19
|
+
config: SDKConfiguration,
|
|
17
20
|
base_url: str,
|
|
18
21
|
operation_id: str,
|
|
19
22
|
oauth2_scopes: Optional[List[str]],
|
|
20
23
|
security_source: Optional[Union[Any, Callable[[], Any]]],
|
|
21
24
|
):
|
|
25
|
+
self.config = config
|
|
22
26
|
self.base_url = base_url
|
|
23
27
|
self.operation_id = operation_id
|
|
24
28
|
self.oauth2_scopes = oauth2_scopes
|
|
@@ -28,6 +32,7 @@ class HookContext:
|
|
|
28
32
|
class BeforeRequestContext(HookContext):
|
|
29
33
|
def __init__(self, hook_ctx: HookContext):
|
|
30
34
|
super().__init__(
|
|
35
|
+
hook_ctx.config,
|
|
31
36
|
hook_ctx.base_url,
|
|
32
37
|
hook_ctx.operation_id,
|
|
33
38
|
hook_ctx.oauth2_scopes,
|
|
@@ -38,6 +43,7 @@ class BeforeRequestContext(HookContext):
|
|
|
38
43
|
class AfterSuccessContext(HookContext):
|
|
39
44
|
def __init__(self, hook_ctx: HookContext):
|
|
40
45
|
super().__init__(
|
|
46
|
+
hook_ctx.config,
|
|
41
47
|
hook_ctx.base_url,
|
|
42
48
|
hook_ctx.operation_id,
|
|
43
49
|
hook_ctx.oauth2_scopes,
|
|
@@ -48,6 +54,7 @@ class AfterSuccessContext(HookContext):
|
|
|
48
54
|
class AfterErrorContext(HookContext):
|
|
49
55
|
def __init__(self, hook_ctx: HookContext):
|
|
50
56
|
super().__init__(
|
|
57
|
+
hook_ctx.config,
|
|
51
58
|
hook_ctx.base_url,
|
|
52
59
|
hook_ctx.operation_id,
|
|
53
60
|
hook_ctx.oauth2_scopes,
|
mistralai_azure/_version.py
CHANGED
|
@@ -4,9 +4,9 @@ import importlib.metadata
|
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai_azure"
|
|
6
6
|
__version__: str = "1.6.0"
|
|
7
|
-
__openapi_doc_version__: str = "0.0
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.6.0 2.
|
|
7
|
+
__openapi_doc_version__: str = "1.0.0"
|
|
8
|
+
__gen_version__: str = "2.634.2"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.6.0 2.634.2 1.0.0 mistralai_azure"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
mistralai_azure/basesdk.py
CHANGED
|
@@ -218,12 +218,12 @@ class BaseSDK:
|
|
|
218
218
|
client = self.sdk_configuration.client
|
|
219
219
|
logger = self.sdk_configuration.debug_logger
|
|
220
220
|
|
|
221
|
+
hooks = self.sdk_configuration.__dict__["_hooks"]
|
|
222
|
+
|
|
221
223
|
def do():
|
|
222
224
|
http_res = None
|
|
223
225
|
try:
|
|
224
|
-
req =
|
|
225
|
-
BeforeRequestContext(hook_ctx), request
|
|
226
|
-
)
|
|
226
|
+
req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
|
|
227
227
|
logger.debug(
|
|
228
228
|
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
229
229
|
req.method,
|
|
@@ -237,9 +237,7 @@ class BaseSDK:
|
|
|
237
237
|
|
|
238
238
|
http_res = client.send(req, stream=stream)
|
|
239
239
|
except Exception as e:
|
|
240
|
-
_, e =
|
|
241
|
-
AfterErrorContext(hook_ctx), None, e
|
|
242
|
-
)
|
|
240
|
+
_, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
|
|
243
241
|
if e is not None:
|
|
244
242
|
logger.debug("Request Exception", exc_info=True)
|
|
245
243
|
raise e
|
|
@@ -257,7 +255,7 @@ class BaseSDK:
|
|
|
257
255
|
)
|
|
258
256
|
|
|
259
257
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
260
|
-
result, err =
|
|
258
|
+
result, err = hooks.after_error(
|
|
261
259
|
AfterErrorContext(hook_ctx), http_res, None
|
|
262
260
|
)
|
|
263
261
|
if err is not None:
|
|
@@ -277,9 +275,7 @@ class BaseSDK:
|
|
|
277
275
|
http_res = do()
|
|
278
276
|
|
|
279
277
|
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
280
|
-
http_res =
|
|
281
|
-
AfterSuccessContext(hook_ctx), http_res
|
|
282
|
-
)
|
|
278
|
+
http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
|
|
283
279
|
|
|
284
280
|
return http_res
|
|
285
281
|
|
|
@@ -294,12 +290,12 @@ class BaseSDK:
|
|
|
294
290
|
client = self.sdk_configuration.async_client
|
|
295
291
|
logger = self.sdk_configuration.debug_logger
|
|
296
292
|
|
|
293
|
+
hooks = self.sdk_configuration.__dict__["_hooks"]
|
|
294
|
+
|
|
297
295
|
async def do():
|
|
298
296
|
http_res = None
|
|
299
297
|
try:
|
|
300
|
-
req =
|
|
301
|
-
BeforeRequestContext(hook_ctx), request
|
|
302
|
-
)
|
|
298
|
+
req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
|
|
303
299
|
logger.debug(
|
|
304
300
|
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
305
301
|
req.method,
|
|
@@ -313,9 +309,7 @@ class BaseSDK:
|
|
|
313
309
|
|
|
314
310
|
http_res = await client.send(req, stream=stream)
|
|
315
311
|
except Exception as e:
|
|
316
|
-
_, e =
|
|
317
|
-
AfterErrorContext(hook_ctx), None, e
|
|
318
|
-
)
|
|
312
|
+
_, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
|
|
319
313
|
if e is not None:
|
|
320
314
|
logger.debug("Request Exception", exc_info=True)
|
|
321
315
|
raise e
|
|
@@ -333,7 +327,7 @@ class BaseSDK:
|
|
|
333
327
|
)
|
|
334
328
|
|
|
335
329
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
336
|
-
result, err =
|
|
330
|
+
result, err = hooks.after_error(
|
|
337
331
|
AfterErrorContext(hook_ctx), http_res, None
|
|
338
332
|
)
|
|
339
333
|
if err is not None:
|
|
@@ -355,8 +349,6 @@ class BaseSDK:
|
|
|
355
349
|
http_res = await do()
|
|
356
350
|
|
|
357
351
|
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
358
|
-
http_res =
|
|
359
|
-
AfterSuccessContext(hook_ctx), http_res
|
|
360
|
-
)
|
|
352
|
+
http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
|
|
361
353
|
|
|
362
354
|
return http_res
|
mistralai_azure/chat.py
CHANGED
|
@@ -41,6 +41,7 @@ class Chat(BaseSDK):
|
|
|
41
41
|
Union[models.Prediction, models.PredictionTypedDict]
|
|
42
42
|
] = None,
|
|
43
43
|
parallel_tool_calls: Optional[bool] = None,
|
|
44
|
+
prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET,
|
|
44
45
|
safe_prompt: Optional[bool] = None,
|
|
45
46
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
46
47
|
server_url: Optional[str] = None,
|
|
@@ -67,6 +68,7 @@ class Chat(BaseSDK):
|
|
|
67
68
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
68
69
|
:param prediction:
|
|
69
70
|
:param parallel_tool_calls:
|
|
71
|
+
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
70
72
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
71
73
|
:param retries: Override the default retry configuration for this method
|
|
72
74
|
:param server_url: Override the default server URL for this method
|
|
@@ -106,6 +108,7 @@ class Chat(BaseSDK):
|
|
|
106
108
|
prediction, Optional[models.Prediction]
|
|
107
109
|
),
|
|
108
110
|
parallel_tool_calls=parallel_tool_calls,
|
|
111
|
+
prompt_mode=prompt_mode,
|
|
109
112
|
safe_prompt=safe_prompt,
|
|
110
113
|
)
|
|
111
114
|
|
|
@@ -138,6 +141,7 @@ class Chat(BaseSDK):
|
|
|
138
141
|
|
|
139
142
|
http_res = self.do_request(
|
|
140
143
|
hook_ctx=HookContext(
|
|
144
|
+
config=self.sdk_configuration,
|
|
141
145
|
base_url=base_url or "",
|
|
142
146
|
operation_id="stream_chat",
|
|
143
147
|
oauth2_scopes=[],
|
|
@@ -212,6 +216,7 @@ class Chat(BaseSDK):
|
|
|
212
216
|
Union[models.Prediction, models.PredictionTypedDict]
|
|
213
217
|
] = None,
|
|
214
218
|
parallel_tool_calls: Optional[bool] = None,
|
|
219
|
+
prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET,
|
|
215
220
|
safe_prompt: Optional[bool] = None,
|
|
216
221
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
217
222
|
server_url: Optional[str] = None,
|
|
@@ -238,6 +243,7 @@ class Chat(BaseSDK):
|
|
|
238
243
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
239
244
|
:param prediction:
|
|
240
245
|
:param parallel_tool_calls:
|
|
246
|
+
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
241
247
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
242
248
|
:param retries: Override the default retry configuration for this method
|
|
243
249
|
:param server_url: Override the default server URL for this method
|
|
@@ -277,6 +283,7 @@ class Chat(BaseSDK):
|
|
|
277
283
|
prediction, Optional[models.Prediction]
|
|
278
284
|
),
|
|
279
285
|
parallel_tool_calls=parallel_tool_calls,
|
|
286
|
+
prompt_mode=prompt_mode,
|
|
280
287
|
safe_prompt=safe_prompt,
|
|
281
288
|
)
|
|
282
289
|
|
|
@@ -309,6 +316,7 @@ class Chat(BaseSDK):
|
|
|
309
316
|
|
|
310
317
|
http_res = await self.do_request_async(
|
|
311
318
|
hook_ctx=HookContext(
|
|
319
|
+
config=self.sdk_configuration,
|
|
312
320
|
base_url=base_url or "",
|
|
313
321
|
operation_id="stream_chat",
|
|
314
322
|
oauth2_scopes=[],
|
|
@@ -391,6 +399,7 @@ class Chat(BaseSDK):
|
|
|
391
399
|
Union[models.Prediction, models.PredictionTypedDict]
|
|
392
400
|
] = None,
|
|
393
401
|
parallel_tool_calls: Optional[bool] = None,
|
|
402
|
+
prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET,
|
|
394
403
|
safe_prompt: Optional[bool] = None,
|
|
395
404
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
396
405
|
server_url: Optional[str] = None,
|
|
@@ -415,6 +424,7 @@ class Chat(BaseSDK):
|
|
|
415
424
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
416
425
|
:param prediction:
|
|
417
426
|
:param parallel_tool_calls:
|
|
427
|
+
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
418
428
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
419
429
|
:param retries: Override the default retry configuration for this method
|
|
420
430
|
:param server_url: Override the default server URL for this method
|
|
@@ -456,6 +466,7 @@ class Chat(BaseSDK):
|
|
|
456
466
|
prediction, Optional[models.Prediction]
|
|
457
467
|
),
|
|
458
468
|
parallel_tool_calls=parallel_tool_calls,
|
|
469
|
+
prompt_mode=prompt_mode,
|
|
459
470
|
safe_prompt=safe_prompt,
|
|
460
471
|
)
|
|
461
472
|
|
|
@@ -488,6 +499,7 @@ class Chat(BaseSDK):
|
|
|
488
499
|
|
|
489
500
|
http_res = self.do_request(
|
|
490
501
|
hook_ctx=HookContext(
|
|
502
|
+
config=self.sdk_configuration,
|
|
491
503
|
base_url=base_url or "",
|
|
492
504
|
operation_id="chat_completion_v1_chat_completions_post",
|
|
493
505
|
oauth2_scopes=[],
|
|
@@ -566,6 +578,7 @@ class Chat(BaseSDK):
|
|
|
566
578
|
Union[models.Prediction, models.PredictionTypedDict]
|
|
567
579
|
] = None,
|
|
568
580
|
parallel_tool_calls: Optional[bool] = None,
|
|
581
|
+
prompt_mode: OptionalNullable[models.MistralPromptMode] = UNSET,
|
|
569
582
|
safe_prompt: Optional[bool] = None,
|
|
570
583
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
571
584
|
server_url: Optional[str] = None,
|
|
@@ -590,6 +603,7 @@ class Chat(BaseSDK):
|
|
|
590
603
|
:param n: Number of completions to return for each request, input tokens are only billed once.
|
|
591
604
|
:param prediction:
|
|
592
605
|
:param parallel_tool_calls:
|
|
606
|
+
:param prompt_mode: Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used.
|
|
593
607
|
:param safe_prompt: Whether to inject a safety prompt before all conversations.
|
|
594
608
|
:param retries: Override the default retry configuration for this method
|
|
595
609
|
:param server_url: Override the default server URL for this method
|
|
@@ -631,6 +645,7 @@ class Chat(BaseSDK):
|
|
|
631
645
|
prediction, Optional[models.Prediction]
|
|
632
646
|
),
|
|
633
647
|
parallel_tool_calls=parallel_tool_calls,
|
|
648
|
+
prompt_mode=prompt_mode,
|
|
634
649
|
safe_prompt=safe_prompt,
|
|
635
650
|
)
|
|
636
651
|
|
|
@@ -663,6 +678,7 @@ class Chat(BaseSDK):
|
|
|
663
678
|
|
|
664
679
|
http_res = await self.do_request_async(
|
|
665
680
|
hook_ctx=HookContext(
|
|
681
|
+
config=self.sdk_configuration,
|
|
666
682
|
base_url=base_url or "",
|
|
667
683
|
operation_id="chat_completion_v1_chat_completions_post",
|
|
668
684
|
oauth2_scopes=[],
|
mistralai_azure/httpclient.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# pyright: reportReturnType = false
|
|
4
4
|
import asyncio
|
|
5
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
6
5
|
from typing_extensions import Protocol, runtime_checkable
|
|
7
6
|
import httpx
|
|
8
7
|
from typing import Any, Optional, Union
|
|
@@ -116,21 +115,12 @@ def close_clients(
|
|
|
116
115
|
pass
|
|
117
116
|
|
|
118
117
|
if async_client is not None and not async_client_supplied:
|
|
119
|
-
is_async = False
|
|
120
118
|
try:
|
|
121
|
-
asyncio.get_running_loop()
|
|
122
|
-
|
|
119
|
+
loop = asyncio.get_running_loop()
|
|
120
|
+
asyncio.run_coroutine_threadsafe(async_client.aclose(), loop)
|
|
123
121
|
except RuntimeError:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
try:
|
|
127
|
-
# If this function is called in an async loop then start another
|
|
128
|
-
# loop in a separate thread to close the async http client.
|
|
129
|
-
if is_async:
|
|
130
|
-
with ThreadPoolExecutor(max_workers=1) as executor:
|
|
131
|
-
future = executor.submit(asyncio.run, async_client.aclose())
|
|
132
|
-
future.result()
|
|
133
|
-
else:
|
|
122
|
+
try:
|
|
134
123
|
asyncio.run(async_client.aclose())
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
except RuntimeError:
|
|
125
|
+
# best effort
|
|
126
|
+
pass
|