mistralai 1.3.1__py3-none-any.whl → 1.4.0__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/__init__.py +10 -1
- mistralai/_version.py +4 -1
- mistralai/agents.py +58 -14
- mistralai/chat.py +58 -14
- mistralai/classifiers.py +32 -20
- mistralai/embeddings.py +16 -10
- mistralai/files.py +94 -34
- mistralai/fim.py +30 -14
- mistralai/jobs.py +80 -32
- mistralai/mistral_jobs.py +64 -24
- mistralai/models/__init__.py +5 -0
- mistralai/models/agentscompletionrequest.py +5 -0
- mistralai/models/agentscompletionstreamrequest.py +5 -0
- mistralai/models/chatcompletionrequest.py +5 -0
- mistralai/models/chatcompletionstreamrequest.py +5 -0
- mistralai/models/fileschema.py +3 -2
- mistralai/models/function.py +3 -0
- mistralai/models/prediction.py +26 -0
- mistralai/models/retrievefileout.py +3 -2
- mistralai/models/toolcall.py +3 -0
- mistralai/models/uploadfileout.py +3 -2
- mistralai/models_.py +92 -48
- mistralai/sdk.py +2 -1
- mistralai/sdkconfiguration.py +10 -4
- {mistralai-1.3.1.dist-info → mistralai-1.4.0.dist-info}/METADATA +9 -42
- {mistralai-1.3.1.dist-info → mistralai-1.4.0.dist-info}/RECORD +30 -30
- {mistralai-1.3.1.dist-info → mistralai-1.4.0.dist-info}/WHEEL +1 -1
- mistralai_azure/_hooks/custom_user_agent.py +1 -1
- mistralai_gcp/sdk.py +1 -2
- py.typed +0 -1
- {mistralai-1.3.1.dist-info → mistralai-1.4.0.dist-info}/LICENSE +0 -0
mistralai/models_.py
CHANGED
|
@@ -18,7 +18,7 @@ class Models(BaseSDK):
|
|
|
18
18
|
server_url: Optional[str] = None,
|
|
19
19
|
timeout_ms: Optional[int] = None,
|
|
20
20
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
21
|
-
) ->
|
|
21
|
+
) -> models.ModelList:
|
|
22
22
|
r"""List Models
|
|
23
23
|
|
|
24
24
|
List all models available to the user.
|
|
@@ -74,11 +74,16 @@ class Models(BaseSDK):
|
|
|
74
74
|
|
|
75
75
|
data: Any = None
|
|
76
76
|
if utils.match_response(http_res, "200", "application/json"):
|
|
77
|
-
return utils.unmarshal_json(http_res.text,
|
|
77
|
+
return utils.unmarshal_json(http_res.text, models.ModelList)
|
|
78
78
|
if utils.match_response(http_res, "422", "application/json"):
|
|
79
79
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
80
80
|
raise models.HTTPValidationError(data=data)
|
|
81
|
-
if utils.match_response(http_res,
|
|
81
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
82
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
83
|
+
raise models.SDKError(
|
|
84
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
85
|
+
)
|
|
86
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
82
87
|
http_res_text = utils.stream_to_text(http_res)
|
|
83
88
|
raise models.SDKError(
|
|
84
89
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -100,7 +105,7 @@ class Models(BaseSDK):
|
|
|
100
105
|
server_url: Optional[str] = None,
|
|
101
106
|
timeout_ms: Optional[int] = None,
|
|
102
107
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
103
|
-
) ->
|
|
108
|
+
) -> models.ModelList:
|
|
104
109
|
r"""List Models
|
|
105
110
|
|
|
106
111
|
List all models available to the user.
|
|
@@ -156,11 +161,16 @@ class Models(BaseSDK):
|
|
|
156
161
|
|
|
157
162
|
data: Any = None
|
|
158
163
|
if utils.match_response(http_res, "200", "application/json"):
|
|
159
|
-
return utils.unmarshal_json(http_res.text,
|
|
164
|
+
return utils.unmarshal_json(http_res.text, models.ModelList)
|
|
160
165
|
if utils.match_response(http_res, "422", "application/json"):
|
|
161
166
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
162
167
|
raise models.HTTPValidationError(data=data)
|
|
163
|
-
if utils.match_response(http_res,
|
|
168
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
169
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
170
|
+
raise models.SDKError(
|
|
171
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
172
|
+
)
|
|
173
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
164
174
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
165
175
|
raise models.SDKError(
|
|
166
176
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -183,9 +193,7 @@ class Models(BaseSDK):
|
|
|
183
193
|
server_url: Optional[str] = None,
|
|
184
194
|
timeout_ms: Optional[int] = None,
|
|
185
195
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
186
|
-
) ->
|
|
187
|
-
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet
|
|
188
|
-
]:
|
|
196
|
+
) -> models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet:
|
|
189
197
|
r"""Retrieve Model
|
|
190
198
|
|
|
191
199
|
Retrieve a model information.
|
|
@@ -249,14 +257,17 @@ class Models(BaseSDK):
|
|
|
249
257
|
if utils.match_response(http_res, "200", "application/json"):
|
|
250
258
|
return utils.unmarshal_json(
|
|
251
259
|
http_res.text,
|
|
252
|
-
|
|
253
|
-
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet
|
|
254
|
-
],
|
|
260
|
+
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet,
|
|
255
261
|
)
|
|
256
262
|
if utils.match_response(http_res, "422", "application/json"):
|
|
257
263
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
258
264
|
raise models.HTTPValidationError(data=data)
|
|
259
|
-
if utils.match_response(http_res,
|
|
265
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
266
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
267
|
+
raise models.SDKError(
|
|
268
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
269
|
+
)
|
|
270
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
260
271
|
http_res_text = utils.stream_to_text(http_res)
|
|
261
272
|
raise models.SDKError(
|
|
262
273
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -279,9 +290,7 @@ class Models(BaseSDK):
|
|
|
279
290
|
server_url: Optional[str] = None,
|
|
280
291
|
timeout_ms: Optional[int] = None,
|
|
281
292
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
282
|
-
) ->
|
|
283
|
-
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet
|
|
284
|
-
]:
|
|
293
|
+
) -> models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet:
|
|
285
294
|
r"""Retrieve Model
|
|
286
295
|
|
|
287
296
|
Retrieve a model information.
|
|
@@ -345,14 +354,17 @@ class Models(BaseSDK):
|
|
|
345
354
|
if utils.match_response(http_res, "200", "application/json"):
|
|
346
355
|
return utils.unmarshal_json(
|
|
347
356
|
http_res.text,
|
|
348
|
-
|
|
349
|
-
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet
|
|
350
|
-
],
|
|
357
|
+
models.RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGet,
|
|
351
358
|
)
|
|
352
359
|
if utils.match_response(http_res, "422", "application/json"):
|
|
353
360
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
354
361
|
raise models.HTTPValidationError(data=data)
|
|
355
|
-
if utils.match_response(http_res,
|
|
362
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
363
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
364
|
+
raise models.SDKError(
|
|
365
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
366
|
+
)
|
|
367
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
356
368
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
357
369
|
raise models.SDKError(
|
|
358
370
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -375,7 +387,7 @@ class Models(BaseSDK):
|
|
|
375
387
|
server_url: Optional[str] = None,
|
|
376
388
|
timeout_ms: Optional[int] = None,
|
|
377
389
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
378
|
-
) ->
|
|
390
|
+
) -> models.DeleteModelOut:
|
|
379
391
|
r"""Delete Model
|
|
380
392
|
|
|
381
393
|
Delete a fine-tuned model.
|
|
@@ -437,11 +449,16 @@ class Models(BaseSDK):
|
|
|
437
449
|
|
|
438
450
|
data: Any = None
|
|
439
451
|
if utils.match_response(http_res, "200", "application/json"):
|
|
440
|
-
return utils.unmarshal_json(http_res.text,
|
|
452
|
+
return utils.unmarshal_json(http_res.text, models.DeleteModelOut)
|
|
441
453
|
if utils.match_response(http_res, "422", "application/json"):
|
|
442
454
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
443
455
|
raise models.HTTPValidationError(data=data)
|
|
444
|
-
if utils.match_response(http_res,
|
|
456
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
457
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
458
|
+
raise models.SDKError(
|
|
459
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
460
|
+
)
|
|
461
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
445
462
|
http_res_text = utils.stream_to_text(http_res)
|
|
446
463
|
raise models.SDKError(
|
|
447
464
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -464,7 +481,7 @@ class Models(BaseSDK):
|
|
|
464
481
|
server_url: Optional[str] = None,
|
|
465
482
|
timeout_ms: Optional[int] = None,
|
|
466
483
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
467
|
-
) ->
|
|
484
|
+
) -> models.DeleteModelOut:
|
|
468
485
|
r"""Delete Model
|
|
469
486
|
|
|
470
487
|
Delete a fine-tuned model.
|
|
@@ -526,11 +543,16 @@ class Models(BaseSDK):
|
|
|
526
543
|
|
|
527
544
|
data: Any = None
|
|
528
545
|
if utils.match_response(http_res, "200", "application/json"):
|
|
529
|
-
return utils.unmarshal_json(http_res.text,
|
|
546
|
+
return utils.unmarshal_json(http_res.text, models.DeleteModelOut)
|
|
530
547
|
if utils.match_response(http_res, "422", "application/json"):
|
|
531
548
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
532
549
|
raise models.HTTPValidationError(data=data)
|
|
533
|
-
if utils.match_response(http_res,
|
|
550
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
551
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
552
|
+
raise models.SDKError(
|
|
553
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
554
|
+
)
|
|
555
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
534
556
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
535
557
|
raise models.SDKError(
|
|
536
558
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -555,7 +577,7 @@ class Models(BaseSDK):
|
|
|
555
577
|
server_url: Optional[str] = None,
|
|
556
578
|
timeout_ms: Optional[int] = None,
|
|
557
579
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
558
|
-
) ->
|
|
580
|
+
) -> models.FTModelOut:
|
|
559
581
|
r"""Update Fine Tuned Model
|
|
560
582
|
|
|
561
583
|
Update a model name or description.
|
|
@@ -625,8 +647,13 @@ class Models(BaseSDK):
|
|
|
625
647
|
)
|
|
626
648
|
|
|
627
649
|
if utils.match_response(http_res, "200", "application/json"):
|
|
628
|
-
return utils.unmarshal_json(http_res.text,
|
|
629
|
-
if utils.match_response(http_res,
|
|
650
|
+
return utils.unmarshal_json(http_res.text, models.FTModelOut)
|
|
651
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
652
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
653
|
+
raise models.SDKError(
|
|
654
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
655
|
+
)
|
|
656
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
630
657
|
http_res_text = utils.stream_to_text(http_res)
|
|
631
658
|
raise models.SDKError(
|
|
632
659
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -651,7 +678,7 @@ class Models(BaseSDK):
|
|
|
651
678
|
server_url: Optional[str] = None,
|
|
652
679
|
timeout_ms: Optional[int] = None,
|
|
653
680
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
654
|
-
) ->
|
|
681
|
+
) -> models.FTModelOut:
|
|
655
682
|
r"""Update Fine Tuned Model
|
|
656
683
|
|
|
657
684
|
Update a model name or description.
|
|
@@ -721,8 +748,13 @@ class Models(BaseSDK):
|
|
|
721
748
|
)
|
|
722
749
|
|
|
723
750
|
if utils.match_response(http_res, "200", "application/json"):
|
|
724
|
-
return utils.unmarshal_json(http_res.text,
|
|
725
|
-
if utils.match_response(http_res,
|
|
751
|
+
return utils.unmarshal_json(http_res.text, models.FTModelOut)
|
|
752
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
753
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
754
|
+
raise models.SDKError(
|
|
755
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
756
|
+
)
|
|
757
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
726
758
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
727
759
|
raise models.SDKError(
|
|
728
760
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -745,7 +777,7 @@ class Models(BaseSDK):
|
|
|
745
777
|
server_url: Optional[str] = None,
|
|
746
778
|
timeout_ms: Optional[int] = None,
|
|
747
779
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
748
|
-
) ->
|
|
780
|
+
) -> models.ArchiveFTModelOut:
|
|
749
781
|
r"""Archive Fine Tuned Model
|
|
750
782
|
|
|
751
783
|
Archive a fine-tuned model.
|
|
@@ -806,10 +838,13 @@ class Models(BaseSDK):
|
|
|
806
838
|
)
|
|
807
839
|
|
|
808
840
|
if utils.match_response(http_res, "200", "application/json"):
|
|
809
|
-
return utils.unmarshal_json(
|
|
810
|
-
|
|
841
|
+
return utils.unmarshal_json(http_res.text, models.ArchiveFTModelOut)
|
|
842
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
843
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
844
|
+
raise models.SDKError(
|
|
845
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
811
846
|
)
|
|
812
|
-
if utils.match_response(http_res,
|
|
847
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
813
848
|
http_res_text = utils.stream_to_text(http_res)
|
|
814
849
|
raise models.SDKError(
|
|
815
850
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -832,7 +867,7 @@ class Models(BaseSDK):
|
|
|
832
867
|
server_url: Optional[str] = None,
|
|
833
868
|
timeout_ms: Optional[int] = None,
|
|
834
869
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
835
|
-
) ->
|
|
870
|
+
) -> models.ArchiveFTModelOut:
|
|
836
871
|
r"""Archive Fine Tuned Model
|
|
837
872
|
|
|
838
873
|
Archive a fine-tuned model.
|
|
@@ -893,10 +928,13 @@ class Models(BaseSDK):
|
|
|
893
928
|
)
|
|
894
929
|
|
|
895
930
|
if utils.match_response(http_res, "200", "application/json"):
|
|
896
|
-
return utils.unmarshal_json(
|
|
897
|
-
|
|
931
|
+
return utils.unmarshal_json(http_res.text, models.ArchiveFTModelOut)
|
|
932
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
933
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
934
|
+
raise models.SDKError(
|
|
935
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
898
936
|
)
|
|
899
|
-
if utils.match_response(http_res,
|
|
937
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
900
938
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
901
939
|
raise models.SDKError(
|
|
902
940
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -919,7 +957,7 @@ class Models(BaseSDK):
|
|
|
919
957
|
server_url: Optional[str] = None,
|
|
920
958
|
timeout_ms: Optional[int] = None,
|
|
921
959
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
922
|
-
) ->
|
|
960
|
+
) -> models.UnarchiveFTModelOut:
|
|
923
961
|
r"""Unarchive Fine Tuned Model
|
|
924
962
|
|
|
925
963
|
Un-archive a fine-tuned model.
|
|
@@ -980,10 +1018,13 @@ class Models(BaseSDK):
|
|
|
980
1018
|
)
|
|
981
1019
|
|
|
982
1020
|
if utils.match_response(http_res, "200", "application/json"):
|
|
983
|
-
return utils.unmarshal_json(
|
|
984
|
-
|
|
1021
|
+
return utils.unmarshal_json(http_res.text, models.UnarchiveFTModelOut)
|
|
1022
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1023
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1024
|
+
raise models.SDKError(
|
|
1025
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
985
1026
|
)
|
|
986
|
-
if utils.match_response(http_res,
|
|
1027
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
987
1028
|
http_res_text = utils.stream_to_text(http_res)
|
|
988
1029
|
raise models.SDKError(
|
|
989
1030
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
@@ -1006,7 +1047,7 @@ class Models(BaseSDK):
|
|
|
1006
1047
|
server_url: Optional[str] = None,
|
|
1007
1048
|
timeout_ms: Optional[int] = None,
|
|
1008
1049
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1009
|
-
) ->
|
|
1050
|
+
) -> models.UnarchiveFTModelOut:
|
|
1010
1051
|
r"""Unarchive Fine Tuned Model
|
|
1011
1052
|
|
|
1012
1053
|
Un-archive a fine-tuned model.
|
|
@@ -1067,10 +1108,13 @@ class Models(BaseSDK):
|
|
|
1067
1108
|
)
|
|
1068
1109
|
|
|
1069
1110
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1070
|
-
return utils.unmarshal_json(
|
|
1071
|
-
|
|
1111
|
+
return utils.unmarshal_json(http_res.text, models.UnarchiveFTModelOut)
|
|
1112
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1113
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1114
|
+
raise models.SDKError(
|
|
1115
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1072
1116
|
)
|
|
1073
|
-
if utils.match_response(http_res,
|
|
1117
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1074
1118
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1075
1119
|
raise models.SDKError(
|
|
1076
1120
|
"API error occurred", http_res.status_code, http_res_text, http_res
|
mistralai/sdk.py
CHANGED
|
@@ -83,7 +83,8 @@ class Mistral(BaseSDK):
|
|
|
83
83
|
|
|
84
84
|
security: Any = None
|
|
85
85
|
if callable(api_key):
|
|
86
|
-
|
|
86
|
+
# pylint: disable=unnecessary-lambda-assignment
|
|
87
|
+
security = lambda: models.Security(api_key=api_key())
|
|
87
88
|
else:
|
|
88
89
|
security = models.Security(api_key=api_key)
|
|
89
90
|
|
mistralai/sdkconfiguration.py
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from ._hooks import SDKHooks
|
|
4
|
+
from ._version import (
|
|
5
|
+
__gen_version__,
|
|
6
|
+
__openapi_doc_version__,
|
|
7
|
+
__user_agent__,
|
|
8
|
+
__version__,
|
|
9
|
+
)
|
|
4
10
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
5
11
|
from .utils import Logger, RetryConfig, remove_suffix
|
|
6
12
|
from dataclasses import dataclass
|
|
@@ -27,10 +33,10 @@ class SDKConfiguration:
|
|
|
27
33
|
server_url: Optional[str] = ""
|
|
28
34
|
server: Optional[str] = ""
|
|
29
35
|
language: str = "python"
|
|
30
|
-
openapi_doc_version: str =
|
|
31
|
-
sdk_version: str =
|
|
32
|
-
gen_version: str =
|
|
33
|
-
user_agent: str =
|
|
36
|
+
openapi_doc_version: str = __openapi_doc_version__
|
|
37
|
+
sdk_version: str = __version__
|
|
38
|
+
gen_version: str = __gen_version__
|
|
39
|
+
user_agent: str = __user_agent__
|
|
34
40
|
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
35
41
|
timeout_ms: Optional[int] = None
|
|
36
42
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: mistralai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Python Client SDK for the Mistral AI API.
|
|
5
|
-
Home-page: https://github.com/mistralai/client-python.git
|
|
6
5
|
Author: Mistral
|
|
7
6
|
Requires-Python: >=3.8
|
|
8
7
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -118,9 +117,7 @@ with Mistral(
|
|
|
118
117
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
119
118
|
"role": "user",
|
|
120
119
|
},
|
|
121
|
-
])
|
|
122
|
-
|
|
123
|
-
assert res is not None
|
|
120
|
+
], stream=False)
|
|
124
121
|
|
|
125
122
|
# Handle response
|
|
126
123
|
print(res)
|
|
@@ -145,9 +142,7 @@ async def main():
|
|
|
145
142
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
146
143
|
"role": "user",
|
|
147
144
|
},
|
|
148
|
-
])
|
|
149
|
-
|
|
150
|
-
assert res is not None
|
|
145
|
+
], stream=False)
|
|
151
146
|
|
|
152
147
|
# Handle response
|
|
153
148
|
print(res)
|
|
@@ -173,8 +168,6 @@ with Mistral(
|
|
|
173
168
|
"content": open("example.file", "rb"),
|
|
174
169
|
})
|
|
175
170
|
|
|
176
|
-
assert res is not None
|
|
177
|
-
|
|
178
171
|
# Handle response
|
|
179
172
|
print(res)
|
|
180
173
|
```
|
|
@@ -198,8 +191,6 @@ async def main():
|
|
|
198
191
|
"content": open("example.file", "rb"),
|
|
199
192
|
})
|
|
200
193
|
|
|
201
|
-
assert res is not None
|
|
202
|
-
|
|
203
194
|
# Handle response
|
|
204
195
|
print(res)
|
|
205
196
|
|
|
@@ -224,9 +215,7 @@ with Mistral(
|
|
|
224
215
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
225
216
|
"role": "user",
|
|
226
217
|
},
|
|
227
|
-
], agent_id="<
|
|
228
|
-
|
|
229
|
-
assert res is not None
|
|
218
|
+
], agent_id="<id>", stream=False)
|
|
230
219
|
|
|
231
220
|
# Handle response
|
|
232
221
|
print(res)
|
|
@@ -251,9 +240,7 @@ async def main():
|
|
|
251
240
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
252
241
|
"role": "user",
|
|
253
242
|
},
|
|
254
|
-
], agent_id="<
|
|
255
|
-
|
|
256
|
-
assert res is not None
|
|
243
|
+
], agent_id="<id>", stream=False)
|
|
257
244
|
|
|
258
245
|
# Handle response
|
|
259
246
|
print(res)
|
|
@@ -277,9 +264,7 @@ with Mistral(
|
|
|
277
264
|
res = mistral.embeddings.create(inputs=[
|
|
278
265
|
"Embed this sentence.",
|
|
279
266
|
"As well as this one.",
|
|
280
|
-
], model="
|
|
281
|
-
|
|
282
|
-
assert res is not None
|
|
267
|
+
], model="mistral-embed")
|
|
283
268
|
|
|
284
269
|
# Handle response
|
|
285
270
|
print(res)
|
|
@@ -302,9 +287,7 @@ async def main():
|
|
|
302
287
|
res = await mistral.embeddings.create_async(inputs=[
|
|
303
288
|
"Embed this sentence.",
|
|
304
289
|
"As well as this one.",
|
|
305
|
-
], model="
|
|
306
|
-
|
|
307
|
-
assert res is not None
|
|
290
|
+
], model="mistral-embed")
|
|
308
291
|
|
|
309
292
|
# Handle response
|
|
310
293
|
print(res)
|
|
@@ -506,9 +489,7 @@ with Mistral(
|
|
|
506
489
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
507
490
|
"role": "user",
|
|
508
491
|
},
|
|
509
|
-
])
|
|
510
|
-
|
|
511
|
-
assert res is not None
|
|
492
|
+
], stream=True)
|
|
512
493
|
|
|
513
494
|
with res as event_stream:
|
|
514
495
|
for event in event_stream:
|
|
@@ -545,8 +526,6 @@ with Mistral(
|
|
|
545
526
|
"content": open("example.file", "rb"),
|
|
546
527
|
})
|
|
547
528
|
|
|
548
|
-
assert res is not None
|
|
549
|
-
|
|
550
529
|
# Handle response
|
|
551
530
|
print(res)
|
|
552
531
|
|
|
@@ -571,8 +550,6 @@ with Mistral(
|
|
|
571
550
|
res = mistral.models.list(,
|
|
572
551
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
573
552
|
|
|
574
|
-
assert res is not None
|
|
575
|
-
|
|
576
553
|
# Handle response
|
|
577
554
|
print(res)
|
|
578
555
|
|
|
@@ -591,8 +568,6 @@ with Mistral(
|
|
|
591
568
|
|
|
592
569
|
res = mistral.models.list()
|
|
593
570
|
|
|
594
|
-
assert res is not None
|
|
595
|
-
|
|
596
571
|
# Handle response
|
|
597
572
|
print(res)
|
|
598
573
|
|
|
@@ -634,8 +609,6 @@ with Mistral(
|
|
|
634
609
|
|
|
635
610
|
res = mistral.models.list()
|
|
636
611
|
|
|
637
|
-
assert res is not None
|
|
638
|
-
|
|
639
612
|
# Handle response
|
|
640
613
|
print(res)
|
|
641
614
|
|
|
@@ -672,8 +645,6 @@ with Mistral(
|
|
|
672
645
|
|
|
673
646
|
res = mistral.models.list()
|
|
674
647
|
|
|
675
|
-
assert res is not None
|
|
676
|
-
|
|
677
648
|
# Handle response
|
|
678
649
|
print(res)
|
|
679
650
|
|
|
@@ -693,8 +664,6 @@ with Mistral(
|
|
|
693
664
|
|
|
694
665
|
res = mistral.models.list()
|
|
695
666
|
|
|
696
|
-
assert res is not None
|
|
697
|
-
|
|
698
667
|
# Handle response
|
|
699
668
|
print(res)
|
|
700
669
|
|
|
@@ -804,8 +773,6 @@ with Mistral(
|
|
|
804
773
|
|
|
805
774
|
res = mistral.models.list()
|
|
806
775
|
|
|
807
|
-
assert res is not None
|
|
808
|
-
|
|
809
776
|
# Handle response
|
|
810
777
|
print(res)
|
|
811
778
|
|