mistralai 1.3.0__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.0.dist-info → mistralai-1.4.0.dist-info}/METADATA +9 -41
- {mistralai-1.3.0.dist-info → mistralai-1.4.0.dist-info}/RECORD +30 -29
- mistralai_azure/_hooks/custom_user_agent.py +1 -1
- mistralai_gcp/sdk.py +1 -2
- {mistralai-1.3.0.dist-info → mistralai-1.4.0.dist-info}/LICENSE +0 -0
- {mistralai-1.3.0.dist-info → mistralai-1.4.0.dist-info}/WHEEL +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,9 +1,9 @@
|
|
|
1
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
5
|
Author: Mistral
|
|
6
|
-
Requires-Python: >=3.8
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: Programming Language :: Python :: 3.8
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -117,9 +117,7 @@ with Mistral(
|
|
|
117
117
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
118
118
|
"role": "user",
|
|
119
119
|
},
|
|
120
|
-
])
|
|
121
|
-
|
|
122
|
-
assert res is not None
|
|
120
|
+
], stream=False)
|
|
123
121
|
|
|
124
122
|
# Handle response
|
|
125
123
|
print(res)
|
|
@@ -144,9 +142,7 @@ async def main():
|
|
|
144
142
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
145
143
|
"role": "user",
|
|
146
144
|
},
|
|
147
|
-
])
|
|
148
|
-
|
|
149
|
-
assert res is not None
|
|
145
|
+
], stream=False)
|
|
150
146
|
|
|
151
147
|
# Handle response
|
|
152
148
|
print(res)
|
|
@@ -172,8 +168,6 @@ with Mistral(
|
|
|
172
168
|
"content": open("example.file", "rb"),
|
|
173
169
|
})
|
|
174
170
|
|
|
175
|
-
assert res is not None
|
|
176
|
-
|
|
177
171
|
# Handle response
|
|
178
172
|
print(res)
|
|
179
173
|
```
|
|
@@ -197,8 +191,6 @@ async def main():
|
|
|
197
191
|
"content": open("example.file", "rb"),
|
|
198
192
|
})
|
|
199
193
|
|
|
200
|
-
assert res is not None
|
|
201
|
-
|
|
202
194
|
# Handle response
|
|
203
195
|
print(res)
|
|
204
196
|
|
|
@@ -223,9 +215,7 @@ with Mistral(
|
|
|
223
215
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
224
216
|
"role": "user",
|
|
225
217
|
},
|
|
226
|
-
], agent_id="<
|
|
227
|
-
|
|
228
|
-
assert res is not None
|
|
218
|
+
], agent_id="<id>", stream=False)
|
|
229
219
|
|
|
230
220
|
# Handle response
|
|
231
221
|
print(res)
|
|
@@ -250,9 +240,7 @@ async def main():
|
|
|
250
240
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
251
241
|
"role": "user",
|
|
252
242
|
},
|
|
253
|
-
], agent_id="<
|
|
254
|
-
|
|
255
|
-
assert res is not None
|
|
243
|
+
], agent_id="<id>", stream=False)
|
|
256
244
|
|
|
257
245
|
# Handle response
|
|
258
246
|
print(res)
|
|
@@ -276,9 +264,7 @@ with Mistral(
|
|
|
276
264
|
res = mistral.embeddings.create(inputs=[
|
|
277
265
|
"Embed this sentence.",
|
|
278
266
|
"As well as this one.",
|
|
279
|
-
], model="
|
|
280
|
-
|
|
281
|
-
assert res is not None
|
|
267
|
+
], model="mistral-embed")
|
|
282
268
|
|
|
283
269
|
# Handle response
|
|
284
270
|
print(res)
|
|
@@ -301,9 +287,7 @@ async def main():
|
|
|
301
287
|
res = await mistral.embeddings.create_async(inputs=[
|
|
302
288
|
"Embed this sentence.",
|
|
303
289
|
"As well as this one.",
|
|
304
|
-
], model="
|
|
305
|
-
|
|
306
|
-
assert res is not None
|
|
290
|
+
], model="mistral-embed")
|
|
307
291
|
|
|
308
292
|
# Handle response
|
|
309
293
|
print(res)
|
|
@@ -505,9 +489,7 @@ with Mistral(
|
|
|
505
489
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
506
490
|
"role": "user",
|
|
507
491
|
},
|
|
508
|
-
])
|
|
509
|
-
|
|
510
|
-
assert res is not None
|
|
492
|
+
], stream=True)
|
|
511
493
|
|
|
512
494
|
with res as event_stream:
|
|
513
495
|
for event in event_stream:
|
|
@@ -544,8 +526,6 @@ with Mistral(
|
|
|
544
526
|
"content": open("example.file", "rb"),
|
|
545
527
|
})
|
|
546
528
|
|
|
547
|
-
assert res is not None
|
|
548
|
-
|
|
549
529
|
# Handle response
|
|
550
530
|
print(res)
|
|
551
531
|
|
|
@@ -570,8 +550,6 @@ with Mistral(
|
|
|
570
550
|
res = mistral.models.list(,
|
|
571
551
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
572
552
|
|
|
573
|
-
assert res is not None
|
|
574
|
-
|
|
575
553
|
# Handle response
|
|
576
554
|
print(res)
|
|
577
555
|
|
|
@@ -590,8 +568,6 @@ with Mistral(
|
|
|
590
568
|
|
|
591
569
|
res = mistral.models.list()
|
|
592
570
|
|
|
593
|
-
assert res is not None
|
|
594
|
-
|
|
595
571
|
# Handle response
|
|
596
572
|
print(res)
|
|
597
573
|
|
|
@@ -633,8 +609,6 @@ with Mistral(
|
|
|
633
609
|
|
|
634
610
|
res = mistral.models.list()
|
|
635
611
|
|
|
636
|
-
assert res is not None
|
|
637
|
-
|
|
638
612
|
# Handle response
|
|
639
613
|
print(res)
|
|
640
614
|
|
|
@@ -671,8 +645,6 @@ with Mistral(
|
|
|
671
645
|
|
|
672
646
|
res = mistral.models.list()
|
|
673
647
|
|
|
674
|
-
assert res is not None
|
|
675
|
-
|
|
676
648
|
# Handle response
|
|
677
649
|
print(res)
|
|
678
650
|
|
|
@@ -692,8 +664,6 @@ with Mistral(
|
|
|
692
664
|
|
|
693
665
|
res = mistral.models.list()
|
|
694
666
|
|
|
695
|
-
assert res is not None
|
|
696
|
-
|
|
697
667
|
# Handle response
|
|
698
668
|
print(res)
|
|
699
669
|
|
|
@@ -803,8 +773,6 @@ with Mistral(
|
|
|
803
773
|
|
|
804
774
|
res = mistral.models.list()
|
|
805
775
|
|
|
806
|
-
assert res is not None
|
|
807
|
-
|
|
808
776
|
# Handle response
|
|
809
777
|
print(res)
|
|
810
778
|
|