mistralai 1.8.1__py3-none-any.whl → 1.9.1__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/_hooks/types.py +7 -0
- mistralai/_version.py +3 -3
- mistralai/agents.py +16 -0
- mistralai/basesdk.py +12 -20
- mistralai/beta.py +1 -1
- mistralai/chat.py +16 -0
- mistralai/classifiers.py +8 -0
- mistralai/conversations.py +35 -15
- mistralai/embeddings.py +2 -0
- mistralai/extra/run/context.py +2 -4
- mistralai/files.py +12 -0
- mistralai/fim.py +4 -0
- mistralai/httpclient.py +6 -16
- mistralai/jobs.py +10 -0
- mistralai/mistral_agents.py +10 -0
- mistralai/mistral_jobs.py +8 -0
- mistralai/models/__init__.py +1357 -722
- mistralai/models/agent.py +1 -1
- mistralai/models/agentconversation.py +1 -1
- mistralai/models/agentcreationrequest.py +1 -1
- mistralai/models/agenthandoffentry.py +1 -1
- mistralai/models/agents_api_v1_conversations_getop.py +2 -0
- mistralai/models/agents_api_v1_conversations_historyop.py +2 -0
- mistralai/models/agents_api_v1_conversations_messagesop.py +2 -0
- mistralai/models/agents_api_v1_conversations_restart_streamop.py +2 -0
- mistralai/models/agents_api_v1_conversations_restartop.py +2 -0
- mistralai/models/agentscompletionrequest.py +13 -3
- mistralai/models/agentscompletionstreamrequest.py +13 -3
- mistralai/models/agentupdaterequest.py +1 -1
- mistralai/models/assistantmessage.py +1 -1
- mistralai/models/basemodelcard.py +8 -6
- mistralai/models/batchjobin.py +1 -1
- mistralai/models/batchjobout.py +1 -1
- mistralai/models/chatcompletionrequest.py +20 -3
- mistralai/models/chatcompletionstreamrequest.py +20 -3
- mistralai/models/classifierdetailedjobout.py +1 -1
- mistralai/models/classifierftmodelout.py +1 -1
- mistralai/models/classifierjobout.py +1 -1
- mistralai/models/classifiertargetin.py +1 -1
- mistralai/models/classifiertrainingparameters.py +1 -1
- mistralai/models/classifiertrainingparametersin.py +1 -1
- mistralai/models/completionargs.py +1 -1
- mistralai/models/completiondetailedjobout.py +1 -1
- mistralai/models/completionftmodelout.py +1 -1
- mistralai/models/completionjobout.py +1 -1
- mistralai/models/completionresponsestreamchoice.py +1 -1
- mistralai/models/completiontrainingparameters.py +1 -1
- mistralai/models/completiontrainingparametersin.py +1 -1
- mistralai/models/contentchunk.py +3 -0
- mistralai/models/conversationrequest.py +1 -1
- mistralai/models/conversationstreamrequest.py +1 -1
- mistralai/models/conversationusageinfo.py +1 -1
- mistralai/models/deltamessage.py +1 -1
- mistralai/models/documenturlchunk.py +1 -1
- mistralai/models/embeddingrequest.py +1 -1
- mistralai/models/eventout.py +1 -1
- mistralai/models/filechunk.py +23 -0
- mistralai/models/files_api_routes_list_filesop.py +1 -1
- mistralai/models/fileschema.py +1 -1
- mistralai/models/fimcompletionrequest.py +1 -1
- mistralai/models/fimcompletionstreamrequest.py +1 -1
- mistralai/models/ftmodelcard.py +9 -6
- mistralai/models/functioncallentry.py +1 -1
- mistralai/models/functionresultentry.py +1 -1
- mistralai/models/githubrepositoryin.py +1 -1
- mistralai/models/githubrepositoryout.py +1 -1
- mistralai/models/imageurl.py +1 -1
- mistralai/models/inputentries.py +21 -2
- mistralai/models/jobin.py +1 -1
- mistralai/models/jobmetadataout.py +1 -1
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +1 -1
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +1 -1
- mistralai/models/jsonschema.py +1 -1
- mistralai/models/legacyjobmetadataout.py +1 -1
- mistralai/models/messageinputentry.py +4 -4
- mistralai/models/messageoutputentry.py +1 -1
- mistralai/models/messageoutputevent.py +1 -1
- mistralai/models/metricout.py +1 -1
- mistralai/models/mistralpromptmode.py +8 -0
- mistralai/models/modelcapabilities.py +3 -0
- mistralai/models/modelconversation.py +1 -1
- mistralai/models/ocrimageobject.py +1 -1
- mistralai/models/ocrpageobject.py +1 -1
- mistralai/models/ocrrequest.py +5 -3
- mistralai/models/ocrresponse.py +1 -1
- mistralai/models/ocrusageinfo.py +1 -1
- mistralai/models/responseformat.py +1 -1
- mistralai/models/retrievefileout.py +1 -1
- mistralai/models/toolexecutionentry.py +1 -1
- mistralai/models/toolfilechunk.py +1 -1
- mistralai/models/toolmessage.py +1 -1
- mistralai/models/toolreferencechunk.py +1 -1
- mistralai/models/updateftmodelin.py +1 -1
- mistralai/models/uploadfileout.py +1 -1
- mistralai/models/usermessage.py +1 -1
- mistralai/models/wandbintegration.py +1 -1
- mistralai/models/wandbintegrationout.py +1 -1
- mistralai/models_.py +14 -2
- mistralai/ocr.py +2 -0
- mistralai/sdk.py +68 -40
- mistralai/sdkconfiguration.py +0 -7
- mistralai/types/basemodel.py +3 -3
- mistralai/utils/__init__.py +131 -45
- mistralai/utils/datetimes.py +23 -0
- mistralai/utils/enums.py +67 -27
- mistralai/utils/forms.py +49 -28
- mistralai/utils/serializers.py +32 -3
- {mistralai-1.8.1.dist-info → mistralai-1.9.1.dist-info}/METADATA +13 -6
- {mistralai-1.8.1.dist-info → mistralai-1.9.1.dist-info}/RECORD +111 -108
- {mistralai-1.8.1.dist-info → mistralai-1.9.1.dist-info}/LICENSE +0 -0
- {mistralai-1.8.1.dist-info → mistralai-1.9.1.dist-info}/WHEEL +0 -0
mistralai/conversations.py
CHANGED
|
@@ -35,7 +35,7 @@ if typing.TYPE_CHECKING:
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class Conversations(BaseSDK):
|
|
38
|
-
r"""(beta)
|
|
38
|
+
r"""(beta) Conversations API"""
|
|
39
39
|
|
|
40
40
|
# region sdk-class-body
|
|
41
41
|
# Custom run code allowing client side execution of code
|
|
@@ -313,6 +313,7 @@ class Conversations(BaseSDK):
|
|
|
313
313
|
|
|
314
314
|
http_res = self.do_request(
|
|
315
315
|
hook_ctx=HookContext(
|
|
316
|
+
config=self.sdk_configuration,
|
|
316
317
|
base_url=base_url or "",
|
|
317
318
|
operation_id="agents_api_v1_conversations_start",
|
|
318
319
|
oauth2_scopes=[],
|
|
@@ -451,6 +452,7 @@ class Conversations(BaseSDK):
|
|
|
451
452
|
|
|
452
453
|
http_res = await self.do_request_async(
|
|
453
454
|
hook_ctx=HookContext(
|
|
455
|
+
config=self.sdk_configuration,
|
|
454
456
|
base_url=base_url or "",
|
|
455
457
|
operation_id="agents_api_v1_conversations_start",
|
|
456
458
|
oauth2_scopes=[],
|
|
@@ -553,6 +555,7 @@ class Conversations(BaseSDK):
|
|
|
553
555
|
|
|
554
556
|
http_res = self.do_request(
|
|
555
557
|
hook_ctx=HookContext(
|
|
558
|
+
config=self.sdk_configuration,
|
|
556
559
|
base_url=base_url or "",
|
|
557
560
|
operation_id="agents_api_v1_conversations_list",
|
|
558
561
|
oauth2_scopes=[],
|
|
@@ -655,6 +658,7 @@ class Conversations(BaseSDK):
|
|
|
655
658
|
|
|
656
659
|
http_res = await self.do_request_async(
|
|
657
660
|
hook_ctx=HookContext(
|
|
661
|
+
config=self.sdk_configuration,
|
|
658
662
|
base_url=base_url or "",
|
|
659
663
|
operation_id="agents_api_v1_conversations_list",
|
|
660
664
|
oauth2_scopes=[],
|
|
@@ -708,7 +712,7 @@ class Conversations(BaseSDK):
|
|
|
708
712
|
|
|
709
713
|
Given a conversation_id retrieve a conversation entity with its attributes.
|
|
710
714
|
|
|
711
|
-
:param conversation_id:
|
|
715
|
+
:param conversation_id: ID of the conversation from which we are fetching metadata.
|
|
712
716
|
:param retries: Override the default retry configuration for this method
|
|
713
717
|
:param server_url: Override the default server URL for this method
|
|
714
718
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -754,6 +758,7 @@ class Conversations(BaseSDK):
|
|
|
754
758
|
|
|
755
759
|
http_res = self.do_request(
|
|
756
760
|
hook_ctx=HookContext(
|
|
761
|
+
config=self.sdk_configuration,
|
|
757
762
|
base_url=base_url or "",
|
|
758
763
|
operation_id="agents_api_v1_conversations_get",
|
|
759
764
|
oauth2_scopes=[],
|
|
@@ -810,7 +815,7 @@ class Conversations(BaseSDK):
|
|
|
810
815
|
|
|
811
816
|
Given a conversation_id retrieve a conversation entity with its attributes.
|
|
812
817
|
|
|
813
|
-
:param conversation_id:
|
|
818
|
+
:param conversation_id: ID of the conversation from which we are fetching metadata.
|
|
814
819
|
:param retries: Override the default retry configuration for this method
|
|
815
820
|
:param server_url: Override the default server URL for this method
|
|
816
821
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -856,6 +861,7 @@ class Conversations(BaseSDK):
|
|
|
856
861
|
|
|
857
862
|
http_res = await self.do_request_async(
|
|
858
863
|
hook_ctx=HookContext(
|
|
864
|
+
config=self.sdk_configuration,
|
|
859
865
|
base_url=base_url or "",
|
|
860
866
|
operation_id="agents_api_v1_conversations_get",
|
|
861
867
|
oauth2_scopes=[],
|
|
@@ -988,6 +994,7 @@ class Conversations(BaseSDK):
|
|
|
988
994
|
|
|
989
995
|
http_res = self.do_request(
|
|
990
996
|
hook_ctx=HookContext(
|
|
997
|
+
config=self.sdk_configuration,
|
|
991
998
|
base_url=base_url or "",
|
|
992
999
|
operation_id="agents_api_v1_conversations_append",
|
|
993
1000
|
oauth2_scopes=[],
|
|
@@ -1117,6 +1124,7 @@ class Conversations(BaseSDK):
|
|
|
1117
1124
|
|
|
1118
1125
|
http_res = await self.do_request_async(
|
|
1119
1126
|
hook_ctx=HookContext(
|
|
1127
|
+
config=self.sdk_configuration,
|
|
1120
1128
|
base_url=base_url or "",
|
|
1121
1129
|
operation_id="agents_api_v1_conversations_append",
|
|
1122
1130
|
oauth2_scopes=[],
|
|
@@ -1170,7 +1178,7 @@ class Conversations(BaseSDK):
|
|
|
1170
1178
|
|
|
1171
1179
|
Given a conversation_id retrieve all the entries belonging to that conversation. The entries are sorted in the order they were appended, those can be messages, connectors or function_call.
|
|
1172
1180
|
|
|
1173
|
-
:param conversation_id:
|
|
1181
|
+
:param conversation_id: ID of the conversation from which we are fetching entries.
|
|
1174
1182
|
:param retries: Override the default retry configuration for this method
|
|
1175
1183
|
:param server_url: Override the default server URL for this method
|
|
1176
1184
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1216,6 +1224,7 @@ class Conversations(BaseSDK):
|
|
|
1216
1224
|
|
|
1217
1225
|
http_res = self.do_request(
|
|
1218
1226
|
hook_ctx=HookContext(
|
|
1227
|
+
config=self.sdk_configuration,
|
|
1219
1228
|
base_url=base_url or "",
|
|
1220
1229
|
operation_id="agents_api_v1_conversations_history",
|
|
1221
1230
|
oauth2_scopes=[],
|
|
@@ -1269,7 +1278,7 @@ class Conversations(BaseSDK):
|
|
|
1269
1278
|
|
|
1270
1279
|
Given a conversation_id retrieve all the entries belonging to that conversation. The entries are sorted in the order they were appended, those can be messages, connectors or function_call.
|
|
1271
1280
|
|
|
1272
|
-
:param conversation_id:
|
|
1281
|
+
:param conversation_id: ID of the conversation from which we are fetching entries.
|
|
1273
1282
|
:param retries: Override the default retry configuration for this method
|
|
1274
1283
|
:param server_url: Override the default server URL for this method
|
|
1275
1284
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1315,6 +1324,7 @@ class Conversations(BaseSDK):
|
|
|
1315
1324
|
|
|
1316
1325
|
http_res = await self.do_request_async(
|
|
1317
1326
|
hook_ctx=HookContext(
|
|
1327
|
+
config=self.sdk_configuration,
|
|
1318
1328
|
base_url=base_url or "",
|
|
1319
1329
|
operation_id="agents_api_v1_conversations_history",
|
|
1320
1330
|
oauth2_scopes=[],
|
|
@@ -1368,7 +1378,7 @@ class Conversations(BaseSDK):
|
|
|
1368
1378
|
|
|
1369
1379
|
Given a conversation_id retrieve all the messages belonging to that conversation. This is similar to retrieving all entries except we filter the messages only.
|
|
1370
1380
|
|
|
1371
|
-
:param conversation_id:
|
|
1381
|
+
:param conversation_id: ID of the conversation from which we are fetching messages.
|
|
1372
1382
|
:param retries: Override the default retry configuration for this method
|
|
1373
1383
|
:param server_url: Override the default server URL for this method
|
|
1374
1384
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1414,6 +1424,7 @@ class Conversations(BaseSDK):
|
|
|
1414
1424
|
|
|
1415
1425
|
http_res = self.do_request(
|
|
1416
1426
|
hook_ctx=HookContext(
|
|
1427
|
+
config=self.sdk_configuration,
|
|
1417
1428
|
base_url=base_url or "",
|
|
1418
1429
|
operation_id="agents_api_v1_conversations_messages",
|
|
1419
1430
|
oauth2_scopes=[],
|
|
@@ -1467,7 +1478,7 @@ class Conversations(BaseSDK):
|
|
|
1467
1478
|
|
|
1468
1479
|
Given a conversation_id retrieve all the messages belonging to that conversation. This is similar to retrieving all entries except we filter the messages only.
|
|
1469
1480
|
|
|
1470
|
-
:param conversation_id:
|
|
1481
|
+
:param conversation_id: ID of the conversation from which we are fetching messages.
|
|
1471
1482
|
:param retries: Override the default retry configuration for this method
|
|
1472
1483
|
:param server_url: Override the default server URL for this method
|
|
1473
1484
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1513,6 +1524,7 @@ class Conversations(BaseSDK):
|
|
|
1513
1524
|
|
|
1514
1525
|
http_res = await self.do_request_async(
|
|
1515
1526
|
hook_ctx=HookContext(
|
|
1527
|
+
config=self.sdk_configuration,
|
|
1516
1528
|
base_url=base_url or "",
|
|
1517
1529
|
operation_id="agents_api_v1_conversations_messages",
|
|
1518
1530
|
oauth2_scopes=[],
|
|
@@ -1576,7 +1588,7 @@ class Conversations(BaseSDK):
|
|
|
1576
1588
|
|
|
1577
1589
|
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
|
|
1578
1590
|
|
|
1579
|
-
:param conversation_id:
|
|
1591
|
+
:param conversation_id: ID of the original conversation which is being restarted.
|
|
1580
1592
|
:param inputs:
|
|
1581
1593
|
:param from_entry_id:
|
|
1582
1594
|
:param stream:
|
|
@@ -1605,10 +1617,10 @@ class Conversations(BaseSDK):
|
|
|
1605
1617
|
stream=stream,
|
|
1606
1618
|
store=store,
|
|
1607
1619
|
handoff_execution=handoff_execution,
|
|
1608
|
-
from_entry_id=from_entry_id,
|
|
1609
1620
|
completion_args=utils.get_pydantic_model(
|
|
1610
1621
|
completion_args, Optional[models.CompletionArgs]
|
|
1611
1622
|
),
|
|
1623
|
+
from_entry_id=from_entry_id,
|
|
1612
1624
|
),
|
|
1613
1625
|
)
|
|
1614
1626
|
|
|
@@ -1645,6 +1657,7 @@ class Conversations(BaseSDK):
|
|
|
1645
1657
|
|
|
1646
1658
|
http_res = self.do_request(
|
|
1647
1659
|
hook_ctx=HookContext(
|
|
1660
|
+
config=self.sdk_configuration,
|
|
1648
1661
|
base_url=base_url or "",
|
|
1649
1662
|
operation_id="agents_api_v1_conversations_restart",
|
|
1650
1663
|
oauth2_scopes=[],
|
|
@@ -1708,7 +1721,7 @@ class Conversations(BaseSDK):
|
|
|
1708
1721
|
|
|
1709
1722
|
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
|
|
1710
1723
|
|
|
1711
|
-
:param conversation_id:
|
|
1724
|
+
:param conversation_id: ID of the original conversation which is being restarted.
|
|
1712
1725
|
:param inputs:
|
|
1713
1726
|
:param from_entry_id:
|
|
1714
1727
|
:param stream:
|
|
@@ -1737,10 +1750,10 @@ class Conversations(BaseSDK):
|
|
|
1737
1750
|
stream=stream,
|
|
1738
1751
|
store=store,
|
|
1739
1752
|
handoff_execution=handoff_execution,
|
|
1740
|
-
from_entry_id=from_entry_id,
|
|
1741
1753
|
completion_args=utils.get_pydantic_model(
|
|
1742
1754
|
completion_args, Optional[models.CompletionArgs]
|
|
1743
1755
|
),
|
|
1756
|
+
from_entry_id=from_entry_id,
|
|
1744
1757
|
),
|
|
1745
1758
|
)
|
|
1746
1759
|
|
|
@@ -1777,6 +1790,7 @@ class Conversations(BaseSDK):
|
|
|
1777
1790
|
|
|
1778
1791
|
http_res = await self.do_request_async(
|
|
1779
1792
|
hook_ctx=HookContext(
|
|
1793
|
+
config=self.sdk_configuration,
|
|
1780
1794
|
base_url=base_url or "",
|
|
1781
1795
|
operation_id="agents_api_v1_conversations_restart",
|
|
1782
1796
|
oauth2_scopes=[],
|
|
@@ -1922,6 +1936,7 @@ class Conversations(BaseSDK):
|
|
|
1922
1936
|
|
|
1923
1937
|
http_res = self.do_request(
|
|
1924
1938
|
hook_ctx=HookContext(
|
|
1939
|
+
config=self.sdk_configuration,
|
|
1925
1940
|
base_url=base_url or "",
|
|
1926
1941
|
operation_id="agents_api_v1_conversations_start_stream",
|
|
1927
1942
|
oauth2_scopes=[],
|
|
@@ -2072,6 +2087,7 @@ class Conversations(BaseSDK):
|
|
|
2072
2087
|
|
|
2073
2088
|
http_res = await self.do_request_async(
|
|
2074
2089
|
hook_ctx=HookContext(
|
|
2090
|
+
config=self.sdk_configuration,
|
|
2075
2091
|
base_url=base_url or "",
|
|
2076
2092
|
operation_id="agents_api_v1_conversations_start_stream",
|
|
2077
2093
|
oauth2_scopes=[],
|
|
@@ -2206,6 +2222,7 @@ class Conversations(BaseSDK):
|
|
|
2206
2222
|
|
|
2207
2223
|
http_res = self.do_request(
|
|
2208
2224
|
hook_ctx=HookContext(
|
|
2225
|
+
config=self.sdk_configuration,
|
|
2209
2226
|
base_url=base_url or "",
|
|
2210
2227
|
operation_id="agents_api_v1_conversations_append_stream",
|
|
2211
2228
|
oauth2_scopes=[],
|
|
@@ -2340,6 +2357,7 @@ class Conversations(BaseSDK):
|
|
|
2340
2357
|
|
|
2341
2358
|
http_res = await self.do_request_async(
|
|
2342
2359
|
hook_ctx=HookContext(
|
|
2360
|
+
config=self.sdk_configuration,
|
|
2343
2361
|
base_url=base_url or "",
|
|
2344
2362
|
operation_id="agents_api_v1_conversations_append_stream",
|
|
2345
2363
|
oauth2_scopes=[],
|
|
@@ -2408,7 +2426,7 @@ class Conversations(BaseSDK):
|
|
|
2408
2426
|
|
|
2409
2427
|
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
|
|
2410
2428
|
|
|
2411
|
-
:param conversation_id:
|
|
2429
|
+
:param conversation_id: ID of the original conversation which is being restarted.
|
|
2412
2430
|
:param inputs:
|
|
2413
2431
|
:param from_entry_id:
|
|
2414
2432
|
:param stream:
|
|
@@ -2437,10 +2455,10 @@ class Conversations(BaseSDK):
|
|
|
2437
2455
|
stream=stream,
|
|
2438
2456
|
store=store,
|
|
2439
2457
|
handoff_execution=handoff_execution,
|
|
2440
|
-
from_entry_id=from_entry_id,
|
|
2441
2458
|
completion_args=utils.get_pydantic_model(
|
|
2442
2459
|
completion_args, Optional[models.CompletionArgs]
|
|
2443
2460
|
),
|
|
2461
|
+
from_entry_id=from_entry_id,
|
|
2444
2462
|
),
|
|
2445
2463
|
)
|
|
2446
2464
|
|
|
@@ -2477,6 +2495,7 @@ class Conversations(BaseSDK):
|
|
|
2477
2495
|
|
|
2478
2496
|
http_res = self.do_request(
|
|
2479
2497
|
hook_ctx=HookContext(
|
|
2498
|
+
config=self.sdk_configuration,
|
|
2480
2499
|
base_url=base_url or "",
|
|
2481
2500
|
operation_id="agents_api_v1_conversations_restart_stream",
|
|
2482
2501
|
oauth2_scopes=[],
|
|
@@ -2545,7 +2564,7 @@ class Conversations(BaseSDK):
|
|
|
2545
2564
|
|
|
2546
2565
|
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
|
|
2547
2566
|
|
|
2548
|
-
:param conversation_id:
|
|
2567
|
+
:param conversation_id: ID of the original conversation which is being restarted.
|
|
2549
2568
|
:param inputs:
|
|
2550
2569
|
:param from_entry_id:
|
|
2551
2570
|
:param stream:
|
|
@@ -2574,10 +2593,10 @@ class Conversations(BaseSDK):
|
|
|
2574
2593
|
stream=stream,
|
|
2575
2594
|
store=store,
|
|
2576
2595
|
handoff_execution=handoff_execution,
|
|
2577
|
-
from_entry_id=from_entry_id,
|
|
2578
2596
|
completion_args=utils.get_pydantic_model(
|
|
2579
2597
|
completion_args, Optional[models.CompletionArgs]
|
|
2580
2598
|
),
|
|
2599
|
+
from_entry_id=from_entry_id,
|
|
2581
2600
|
),
|
|
2582
2601
|
)
|
|
2583
2602
|
|
|
@@ -2614,6 +2633,7 @@ class Conversations(BaseSDK):
|
|
|
2614
2633
|
|
|
2615
2634
|
http_res = await self.do_request_async(
|
|
2616
2635
|
hook_ctx=HookContext(
|
|
2636
|
+
config=self.sdk_configuration,
|
|
2617
2637
|
base_url=base_url or "",
|
|
2618
2638
|
operation_id="agents_api_v1_conversations_restart_stream",
|
|
2619
2639
|
oauth2_scopes=[],
|
mistralai/embeddings.py
CHANGED
|
@@ -84,6 +84,7 @@ class Embeddings(BaseSDK):
|
|
|
84
84
|
|
|
85
85
|
http_res = self.do_request(
|
|
86
86
|
hook_ctx=HookContext(
|
|
87
|
+
config=self.sdk_configuration,
|
|
87
88
|
base_url=base_url or "",
|
|
88
89
|
operation_id="embeddings_v1_embeddings_post",
|
|
89
90
|
oauth2_scopes=[],
|
|
@@ -197,6 +198,7 @@ class Embeddings(BaseSDK):
|
|
|
197
198
|
|
|
198
199
|
http_res = await self.do_request_async(
|
|
199
200
|
hook_ctx=HookContext(
|
|
201
|
+
config=self.sdk_configuration,
|
|
200
202
|
base_url=base_url or "",
|
|
201
203
|
operation_id="embeddings_v1_embeddings_post",
|
|
202
204
|
oauth2_scopes=[],
|
mistralai/extra/run/context.py
CHANGED
|
@@ -30,7 +30,6 @@ from mistralai.models import (
|
|
|
30
30
|
FunctionTool,
|
|
31
31
|
MessageInputEntry,
|
|
32
32
|
InputEntries,
|
|
33
|
-
ResponseFormatTypedDict,
|
|
34
33
|
)
|
|
35
34
|
|
|
36
35
|
from logging import getLogger
|
|
@@ -229,9 +228,8 @@ class RunContext:
|
|
|
229
228
|
elif isinstance(completion_args, CompletionArgs) and self.output_format:
|
|
230
229
|
completion_args.response_format = self.response_format
|
|
231
230
|
elif isinstance(completion_args, dict) and self.output_format:
|
|
232
|
-
completion_args
|
|
233
|
-
|
|
234
|
-
)
|
|
231
|
+
completion_args = CompletionArgs.model_validate(completion_args)
|
|
232
|
+
completion_args.response_format = self.response_format
|
|
235
233
|
request_tools = []
|
|
236
234
|
if isinstance(tools, list):
|
|
237
235
|
for tool in tools:
|
mistralai/files.py
CHANGED
|
@@ -85,6 +85,7 @@ class Files(BaseSDK):
|
|
|
85
85
|
|
|
86
86
|
http_res = self.do_request(
|
|
87
87
|
hook_ctx=HookContext(
|
|
88
|
+
config=self.sdk_configuration,
|
|
88
89
|
base_url=base_url or "",
|
|
89
90
|
operation_id="files_api_routes_upload_file",
|
|
90
91
|
oauth2_scopes=[],
|
|
@@ -192,6 +193,7 @@ class Files(BaseSDK):
|
|
|
192
193
|
|
|
193
194
|
http_res = await self.do_request_async(
|
|
194
195
|
hook_ctx=HookContext(
|
|
196
|
+
config=self.sdk_configuration,
|
|
195
197
|
base_url=base_url or "",
|
|
196
198
|
operation_id="files_api_routes_upload_file",
|
|
197
199
|
oauth2_scopes=[],
|
|
@@ -300,6 +302,7 @@ class Files(BaseSDK):
|
|
|
300
302
|
|
|
301
303
|
http_res = self.do_request(
|
|
302
304
|
hook_ctx=HookContext(
|
|
305
|
+
config=self.sdk_configuration,
|
|
303
306
|
base_url=base_url or "",
|
|
304
307
|
operation_id="files_api_routes_list_files",
|
|
305
308
|
oauth2_scopes=[],
|
|
@@ -408,6 +411,7 @@ class Files(BaseSDK):
|
|
|
408
411
|
|
|
409
412
|
http_res = await self.do_request_async(
|
|
410
413
|
hook_ctx=HookContext(
|
|
414
|
+
config=self.sdk_configuration,
|
|
411
415
|
base_url=base_url or "",
|
|
412
416
|
operation_id="files_api_routes_list_files",
|
|
413
417
|
oauth2_scopes=[],
|
|
@@ -501,6 +505,7 @@ class Files(BaseSDK):
|
|
|
501
505
|
|
|
502
506
|
http_res = self.do_request(
|
|
503
507
|
hook_ctx=HookContext(
|
|
508
|
+
config=self.sdk_configuration,
|
|
504
509
|
base_url=base_url or "",
|
|
505
510
|
operation_id="files_api_routes_retrieve_file",
|
|
506
511
|
oauth2_scopes=[],
|
|
@@ -594,6 +599,7 @@ class Files(BaseSDK):
|
|
|
594
599
|
|
|
595
600
|
http_res = await self.do_request_async(
|
|
596
601
|
hook_ctx=HookContext(
|
|
602
|
+
config=self.sdk_configuration,
|
|
597
603
|
base_url=base_url or "",
|
|
598
604
|
operation_id="files_api_routes_retrieve_file",
|
|
599
605
|
oauth2_scopes=[],
|
|
@@ -687,6 +693,7 @@ class Files(BaseSDK):
|
|
|
687
693
|
|
|
688
694
|
http_res = self.do_request(
|
|
689
695
|
hook_ctx=HookContext(
|
|
696
|
+
config=self.sdk_configuration,
|
|
690
697
|
base_url=base_url or "",
|
|
691
698
|
operation_id="files_api_routes_delete_file",
|
|
692
699
|
oauth2_scopes=[],
|
|
@@ -780,6 +787,7 @@ class Files(BaseSDK):
|
|
|
780
787
|
|
|
781
788
|
http_res = await self.do_request_async(
|
|
782
789
|
hook_ctx=HookContext(
|
|
790
|
+
config=self.sdk_configuration,
|
|
783
791
|
base_url=base_url or "",
|
|
784
792
|
operation_id="files_api_routes_delete_file",
|
|
785
793
|
oauth2_scopes=[],
|
|
@@ -873,6 +881,7 @@ class Files(BaseSDK):
|
|
|
873
881
|
|
|
874
882
|
http_res = self.do_request(
|
|
875
883
|
hook_ctx=HookContext(
|
|
884
|
+
config=self.sdk_configuration,
|
|
876
885
|
base_url=base_url or "",
|
|
877
886
|
operation_id="files_api_routes_download_file",
|
|
878
887
|
oauth2_scopes=[],
|
|
@@ -967,6 +976,7 @@ class Files(BaseSDK):
|
|
|
967
976
|
|
|
968
977
|
http_res = await self.do_request_async(
|
|
969
978
|
hook_ctx=HookContext(
|
|
979
|
+
config=self.sdk_configuration,
|
|
970
980
|
base_url=base_url or "",
|
|
971
981
|
operation_id="files_api_routes_download_file",
|
|
972
982
|
oauth2_scopes=[],
|
|
@@ -1062,6 +1072,7 @@ class Files(BaseSDK):
|
|
|
1062
1072
|
|
|
1063
1073
|
http_res = self.do_request(
|
|
1064
1074
|
hook_ctx=HookContext(
|
|
1075
|
+
config=self.sdk_configuration,
|
|
1065
1076
|
base_url=base_url or "",
|
|
1066
1077
|
operation_id="files_api_routes_get_signed_url",
|
|
1067
1078
|
oauth2_scopes=[],
|
|
@@ -1156,6 +1167,7 @@ class Files(BaseSDK):
|
|
|
1156
1167
|
|
|
1157
1168
|
http_res = await self.do_request_async(
|
|
1158
1169
|
hook_ctx=HookContext(
|
|
1170
|
+
config=self.sdk_configuration,
|
|
1159
1171
|
base_url=base_url or "",
|
|
1160
1172
|
operation_id="files_api_routes_get_signed_url",
|
|
1161
1173
|
oauth2_scopes=[],
|
mistralai/fim.py
CHANGED
|
@@ -105,6 +105,7 @@ class Fim(BaseSDK):
|
|
|
105
105
|
|
|
106
106
|
http_res = self.do_request(
|
|
107
107
|
hook_ctx=HookContext(
|
|
108
|
+
config=self.sdk_configuration,
|
|
108
109
|
base_url=base_url or "",
|
|
109
110
|
operation_id="fim_completion_v1_fim_completions_post",
|
|
110
111
|
oauth2_scopes=[],
|
|
@@ -239,6 +240,7 @@ class Fim(BaseSDK):
|
|
|
239
240
|
|
|
240
241
|
http_res = await self.do_request_async(
|
|
241
242
|
hook_ctx=HookContext(
|
|
243
|
+
config=self.sdk_configuration,
|
|
242
244
|
base_url=base_url or "",
|
|
243
245
|
operation_id="fim_completion_v1_fim_completions_post",
|
|
244
246
|
oauth2_scopes=[],
|
|
@@ -373,6 +375,7 @@ class Fim(BaseSDK):
|
|
|
373
375
|
|
|
374
376
|
http_res = self.do_request(
|
|
375
377
|
hook_ctx=HookContext(
|
|
378
|
+
config=self.sdk_configuration,
|
|
376
379
|
base_url=base_url or "",
|
|
377
380
|
operation_id="stream_fim",
|
|
378
381
|
oauth2_scopes=[],
|
|
@@ -513,6 +516,7 @@ class Fim(BaseSDK):
|
|
|
513
516
|
|
|
514
517
|
http_res = await self.do_request_async(
|
|
515
518
|
hook_ctx=HookContext(
|
|
519
|
+
config=self.sdk_configuration,
|
|
516
520
|
base_url=base_url or "",
|
|
517
521
|
operation_id="stream_fim",
|
|
518
522
|
oauth2_scopes=[],
|
mistralai/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
|
mistralai/jobs.py
CHANGED
|
@@ -96,6 +96,7 @@ class Jobs(BaseSDK):
|
|
|
96
96
|
|
|
97
97
|
http_res = self.do_request(
|
|
98
98
|
hook_ctx=HookContext(
|
|
99
|
+
config=self.sdk_configuration,
|
|
99
100
|
base_url=base_url or "",
|
|
100
101
|
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_jobs",
|
|
101
102
|
oauth2_scopes=[],
|
|
@@ -216,6 +217,7 @@ class Jobs(BaseSDK):
|
|
|
216
217
|
|
|
217
218
|
http_res = await self.do_request_async(
|
|
218
219
|
hook_ctx=HookContext(
|
|
220
|
+
config=self.sdk_configuration,
|
|
219
221
|
base_url=base_url or "",
|
|
220
222
|
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_jobs",
|
|
221
223
|
oauth2_scopes=[],
|
|
@@ -367,6 +369,7 @@ class Jobs(BaseSDK):
|
|
|
367
369
|
|
|
368
370
|
http_res = self.do_request(
|
|
369
371
|
hook_ctx=HookContext(
|
|
372
|
+
config=self.sdk_configuration,
|
|
370
373
|
base_url=base_url or "",
|
|
371
374
|
operation_id="jobs_api_routes_fine_tuning_create_fine_tuning_job",
|
|
372
375
|
oauth2_scopes=[],
|
|
@@ -520,6 +523,7 @@ class Jobs(BaseSDK):
|
|
|
520
523
|
|
|
521
524
|
http_res = await self.do_request_async(
|
|
522
525
|
hook_ctx=HookContext(
|
|
526
|
+
config=self.sdk_configuration,
|
|
523
527
|
base_url=base_url or "",
|
|
524
528
|
operation_id="jobs_api_routes_fine_tuning_create_fine_tuning_job",
|
|
525
529
|
oauth2_scopes=[],
|
|
@@ -615,6 +619,7 @@ class Jobs(BaseSDK):
|
|
|
615
619
|
|
|
616
620
|
http_res = self.do_request(
|
|
617
621
|
hook_ctx=HookContext(
|
|
622
|
+
config=self.sdk_configuration,
|
|
618
623
|
base_url=base_url or "",
|
|
619
624
|
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_job",
|
|
620
625
|
oauth2_scopes=[],
|
|
@@ -710,6 +715,7 @@ class Jobs(BaseSDK):
|
|
|
710
715
|
|
|
711
716
|
http_res = await self.do_request_async(
|
|
712
717
|
hook_ctx=HookContext(
|
|
718
|
+
config=self.sdk_configuration,
|
|
713
719
|
base_url=base_url or "",
|
|
714
720
|
operation_id="jobs_api_routes_fine_tuning_get_fine_tuning_job",
|
|
715
721
|
oauth2_scopes=[],
|
|
@@ -805,6 +811,7 @@ class Jobs(BaseSDK):
|
|
|
805
811
|
|
|
806
812
|
http_res = self.do_request(
|
|
807
813
|
hook_ctx=HookContext(
|
|
814
|
+
config=self.sdk_configuration,
|
|
808
815
|
base_url=base_url or "",
|
|
809
816
|
operation_id="jobs_api_routes_fine_tuning_cancel_fine_tuning_job",
|
|
810
817
|
oauth2_scopes=[],
|
|
@@ -900,6 +907,7 @@ class Jobs(BaseSDK):
|
|
|
900
907
|
|
|
901
908
|
http_res = await self.do_request_async(
|
|
902
909
|
hook_ctx=HookContext(
|
|
910
|
+
config=self.sdk_configuration,
|
|
903
911
|
base_url=base_url or "",
|
|
904
912
|
operation_id="jobs_api_routes_fine_tuning_cancel_fine_tuning_job",
|
|
905
913
|
oauth2_scopes=[],
|
|
@@ -995,6 +1003,7 @@ class Jobs(BaseSDK):
|
|
|
995
1003
|
|
|
996
1004
|
http_res = self.do_request(
|
|
997
1005
|
hook_ctx=HookContext(
|
|
1006
|
+
config=self.sdk_configuration,
|
|
998
1007
|
base_url=base_url or "",
|
|
999
1008
|
operation_id="jobs_api_routes_fine_tuning_start_fine_tuning_job",
|
|
1000
1009
|
oauth2_scopes=[],
|
|
@@ -1090,6 +1099,7 @@ class Jobs(BaseSDK):
|
|
|
1090
1099
|
|
|
1091
1100
|
http_res = await self.do_request_async(
|
|
1092
1101
|
hook_ctx=HookContext(
|
|
1102
|
+
config=self.sdk_configuration,
|
|
1093
1103
|
base_url=base_url or "",
|
|
1094
1104
|
operation_id="jobs_api_routes_fine_tuning_start_fine_tuning_job",
|
|
1095
1105
|
oauth2_scopes=[],
|
mistralai/mistral_agents.py
CHANGED
|
@@ -102,6 +102,7 @@ class MistralAgents(BaseSDK):
|
|
|
102
102
|
|
|
103
103
|
http_res = self.do_request(
|
|
104
104
|
hook_ctx=HookContext(
|
|
105
|
+
config=self.sdk_configuration,
|
|
105
106
|
base_url=base_url or "",
|
|
106
107
|
operation_id="agents_api_v1_agents_create",
|
|
107
108
|
oauth2_scopes=[],
|
|
@@ -233,6 +234,7 @@ class MistralAgents(BaseSDK):
|
|
|
233
234
|
|
|
234
235
|
http_res = await self.do_request_async(
|
|
235
236
|
hook_ctx=HookContext(
|
|
237
|
+
config=self.sdk_configuration,
|
|
236
238
|
base_url=base_url or "",
|
|
237
239
|
operation_id="agents_api_v1_agents_create",
|
|
238
240
|
oauth2_scopes=[],
|
|
@@ -335,6 +337,7 @@ class MistralAgents(BaseSDK):
|
|
|
335
337
|
|
|
336
338
|
http_res = self.do_request(
|
|
337
339
|
hook_ctx=HookContext(
|
|
340
|
+
config=self.sdk_configuration,
|
|
338
341
|
base_url=base_url or "",
|
|
339
342
|
operation_id="agents_api_v1_agents_list",
|
|
340
343
|
oauth2_scopes=[],
|
|
@@ -437,6 +440,7 @@ class MistralAgents(BaseSDK):
|
|
|
437
440
|
|
|
438
441
|
http_res = await self.do_request_async(
|
|
439
442
|
hook_ctx=HookContext(
|
|
443
|
+
config=self.sdk_configuration,
|
|
440
444
|
base_url=base_url or "",
|
|
441
445
|
operation_id="agents_api_v1_agents_list",
|
|
442
446
|
oauth2_scopes=[],
|
|
@@ -536,6 +540,7 @@ class MistralAgents(BaseSDK):
|
|
|
536
540
|
|
|
537
541
|
http_res = self.do_request(
|
|
538
542
|
hook_ctx=HookContext(
|
|
543
|
+
config=self.sdk_configuration,
|
|
539
544
|
base_url=base_url or "",
|
|
540
545
|
operation_id="agents_api_v1_agents_get",
|
|
541
546
|
oauth2_scopes=[],
|
|
@@ -635,6 +640,7 @@ class MistralAgents(BaseSDK):
|
|
|
635
640
|
|
|
636
641
|
http_res = await self.do_request_async(
|
|
637
642
|
hook_ctx=HookContext(
|
|
643
|
+
config=self.sdk_configuration,
|
|
638
644
|
base_url=base_url or "",
|
|
639
645
|
operation_id="agents_api_v1_agents_get",
|
|
640
646
|
oauth2_scopes=[],
|
|
@@ -775,6 +781,7 @@ class MistralAgents(BaseSDK):
|
|
|
775
781
|
|
|
776
782
|
http_res = self.do_request(
|
|
777
783
|
hook_ctx=HookContext(
|
|
784
|
+
config=self.sdk_configuration,
|
|
778
785
|
base_url=base_url or "",
|
|
779
786
|
operation_id="agents_api_v1_agents_update",
|
|
780
787
|
oauth2_scopes=[],
|
|
@@ -915,6 +922,7 @@ class MistralAgents(BaseSDK):
|
|
|
915
922
|
|
|
916
923
|
http_res = await self.do_request_async(
|
|
917
924
|
hook_ctx=HookContext(
|
|
925
|
+
config=self.sdk_configuration,
|
|
918
926
|
base_url=base_url or "",
|
|
919
927
|
operation_id="agents_api_v1_agents_update",
|
|
920
928
|
oauth2_scopes=[],
|
|
@@ -1017,6 +1025,7 @@ class MistralAgents(BaseSDK):
|
|
|
1017
1025
|
|
|
1018
1026
|
http_res = self.do_request(
|
|
1019
1027
|
hook_ctx=HookContext(
|
|
1028
|
+
config=self.sdk_configuration,
|
|
1020
1029
|
base_url=base_url or "",
|
|
1021
1030
|
operation_id="agents_api_v1_agents_update_version",
|
|
1022
1031
|
oauth2_scopes=[],
|
|
@@ -1119,6 +1128,7 @@ class MistralAgents(BaseSDK):
|
|
|
1119
1128
|
|
|
1120
1129
|
http_res = await self.do_request_async(
|
|
1121
1130
|
hook_ctx=HookContext(
|
|
1131
|
+
config=self.sdk_configuration,
|
|
1122
1132
|
base_url=base_url or "",
|
|
1123
1133
|
operation_id="agents_api_v1_agents_update_version",
|
|
1124
1134
|
oauth2_scopes=[],
|