mistralai 1.9.11__py3-none-any.whl → 1.10.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.
Files changed (68) hide show
  1. mistralai/_hooks/registration.py +5 -0
  2. mistralai/_hooks/tracing.py +50 -0
  3. mistralai/_version.py +2 -2
  4. mistralai/accesses.py +8 -8
  5. mistralai/agents.py +29 -17
  6. mistralai/chat.py +41 -29
  7. mistralai/conversations.py +294 -62
  8. mistralai/documents.py +19 -3
  9. mistralai/embeddings.py +6 -6
  10. mistralai/extra/observability/__init__.py +15 -0
  11. mistralai/extra/observability/otel.py +393 -0
  12. mistralai/extra/run/tools.py +28 -16
  13. mistralai/files.py +6 -0
  14. mistralai/fim.py +17 -5
  15. mistralai/mistral_agents.py +229 -1
  16. mistralai/mistral_jobs.py +10 -10
  17. mistralai/models/__init__.py +69 -2
  18. mistralai/models/agent.py +15 -2
  19. mistralai/models/agentconversation.py +11 -3
  20. mistralai/models/agentcreationrequest.py +6 -2
  21. mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
  22. mistralai/models/agents_api_v1_agents_getop.py +40 -3
  23. mistralai/models/agents_api_v1_agents_listop.py +72 -2
  24. mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
  25. mistralai/models/agents_api_v1_conversations_listop.py +39 -2
  26. mistralai/models/agentscompletionrequest.py +21 -6
  27. mistralai/models/agentscompletionstreamrequest.py +21 -6
  28. mistralai/models/agentupdaterequest.py +18 -2
  29. mistralai/models/audiotranscriptionrequest.py +2 -0
  30. mistralai/models/batchjobin.py +10 -0
  31. mistralai/models/chatcompletionrequest.py +22 -5
  32. mistralai/models/chatcompletionstreamrequest.py +22 -5
  33. mistralai/models/conversationrequest.py +15 -4
  34. mistralai/models/conversationrestartrequest.py +50 -2
  35. mistralai/models/conversationrestartstreamrequest.py +50 -2
  36. mistralai/models/conversationstreamrequest.py +15 -4
  37. mistralai/models/documentout.py +26 -10
  38. mistralai/models/documentupdatein.py +24 -3
  39. mistralai/models/embeddingrequest.py +8 -8
  40. mistralai/models/files_api_routes_list_filesop.py +7 -0
  41. mistralai/models/fimcompletionrequest.py +8 -9
  42. mistralai/models/fimcompletionstreamrequest.py +8 -9
  43. mistralai/models/libraries_documents_list_v1op.py +15 -2
  44. mistralai/models/libraryout.py +10 -7
  45. mistralai/models/listfilesout.py +35 -4
  46. mistralai/models/modelcapabilities.py +13 -4
  47. mistralai/models/modelconversation.py +8 -2
  48. mistralai/models/ocrpageobject.py +26 -5
  49. mistralai/models/ocrrequest.py +17 -1
  50. mistralai/models/ocrtableobject.py +31 -0
  51. mistralai/models/prediction.py +4 -0
  52. mistralai/models/requestsource.py +7 -0
  53. mistralai/models/responseformat.py +4 -2
  54. mistralai/models/responseformats.py +0 -1
  55. mistralai/models/sharingdelete.py +36 -5
  56. mistralai/models/sharingin.py +36 -5
  57. mistralai/models/sharingout.py +3 -3
  58. mistralai/models/toolexecutiondeltaevent.py +13 -4
  59. mistralai/models/toolexecutiondoneevent.py +13 -4
  60. mistralai/models/toolexecutionentry.py +9 -4
  61. mistralai/models/toolexecutionstartedevent.py +13 -4
  62. mistralai/models_.py +2 -14
  63. mistralai/ocr.py +18 -0
  64. mistralai/transcriptions.py +4 -4
  65. {mistralai-1.9.11.dist-info → mistralai-1.10.0.dist-info}/METADATA +30 -12
  66. {mistralai-1.9.11.dist-info → mistralai-1.10.0.dist-info}/RECORD +68 -61
  67. {mistralai-1.9.11.dist-info → mistralai-1.10.0.dist-info}/WHEEL +0 -0
  68. {mistralai-1.9.11.dist-info → mistralai-1.10.0.dist-info}/licenses/LICENSE +0 -0
@@ -41,6 +41,10 @@ if TYPE_CHECKING:
41
41
  AgentHandoffStartedEventType,
42
42
  AgentHandoffStartedEventTypedDict,
43
43
  )
44
+ from .agents_api_v1_agents_deleteop import (
45
+ AgentsAPIV1AgentsDeleteRequest,
46
+ AgentsAPIV1AgentsDeleteRequestTypedDict,
47
+ )
44
48
  from .agents_api_v1_agents_getop import (
45
49
  AgentsAPIV1AgentsGetRequest,
46
50
  AgentsAPIV1AgentsGetRequestTypedDict,
@@ -65,6 +69,10 @@ if TYPE_CHECKING:
65
69
  AgentsAPIV1ConversationsAppendRequest,
66
70
  AgentsAPIV1ConversationsAppendRequestTypedDict,
67
71
  )
72
+ from .agents_api_v1_conversations_deleteop import (
73
+ AgentsAPIV1ConversationsDeleteRequest,
74
+ AgentsAPIV1ConversationsDeleteRequestTypedDict,
75
+ )
68
76
  from .agents_api_v1_conversations_getop import (
69
77
  AgentsAPIV1ConversationsGetRequest,
70
78
  AgentsAPIV1ConversationsGetRequestTypedDict,
@@ -374,7 +382,12 @@ if TYPE_CHECKING:
374
382
  )
375
383
  from .documentout import DocumentOut, DocumentOutTypedDict
376
384
  from .documenttextcontent import DocumentTextContent, DocumentTextContentTypedDict
377
- from .documentupdatein import DocumentUpdateIn, DocumentUpdateInTypedDict
385
+ from .documentupdatein import (
386
+ Attributes,
387
+ AttributesTypedDict,
388
+ DocumentUpdateIn,
389
+ DocumentUpdateInTypedDict,
390
+ )
378
391
  from .documenturlchunk import (
379
392
  DocumentURLChunk,
380
393
  DocumentURLChunkType,
@@ -720,8 +733,15 @@ if TYPE_CHECKING:
720
733
  from .ocrimageobject import OCRImageObject, OCRImageObjectTypedDict
721
734
  from .ocrpagedimensions import OCRPageDimensions, OCRPageDimensionsTypedDict
722
735
  from .ocrpageobject import OCRPageObject, OCRPageObjectTypedDict
723
- from .ocrrequest import Document, DocumentTypedDict, OCRRequest, OCRRequestTypedDict
736
+ from .ocrrequest import (
737
+ Document,
738
+ DocumentTypedDict,
739
+ OCRRequest,
740
+ OCRRequestTypedDict,
741
+ TableFormat,
742
+ )
724
743
  from .ocrresponse import OCRResponse, OCRResponseTypedDict
744
+ from .ocrtableobject import Format, OCRTableObject, OCRTableObjectTypedDict
725
745
  from .ocrusageinfo import OCRUsageInfo, OCRUsageInfoTypedDict
726
746
  from .outputcontentchunks import OutputContentChunks, OutputContentChunksTypedDict
727
747
  from .paginationinfo import PaginationInfo, PaginationInfoTypedDict
@@ -732,6 +752,7 @@ if TYPE_CHECKING:
732
752
  ReferenceChunkType,
733
753
  ReferenceChunkTypedDict,
734
754
  )
755
+ from .requestsource import RequestSource
735
756
  from .responsedoneevent import (
736
757
  ResponseDoneEvent,
737
758
  ResponseDoneEventType,
@@ -792,15 +813,21 @@ if TYPE_CHECKING:
792
813
  from .toolchoiceenum import ToolChoiceEnum
793
814
  from .toolexecutiondeltaevent import (
794
815
  ToolExecutionDeltaEvent,
816
+ ToolExecutionDeltaEventName,
817
+ ToolExecutionDeltaEventNameTypedDict,
795
818
  ToolExecutionDeltaEventType,
796
819
  ToolExecutionDeltaEventTypedDict,
797
820
  )
798
821
  from .toolexecutiondoneevent import (
799
822
  ToolExecutionDoneEvent,
823
+ ToolExecutionDoneEventName,
824
+ ToolExecutionDoneEventNameTypedDict,
800
825
  ToolExecutionDoneEventType,
801
826
  ToolExecutionDoneEventTypedDict,
802
827
  )
803
828
  from .toolexecutionentry import (
829
+ Name,
830
+ NameTypedDict,
804
831
  ToolExecutionEntry,
805
832
  ToolExecutionEntryObject,
806
833
  ToolExecutionEntryType,
@@ -808,6 +835,8 @@ if TYPE_CHECKING:
808
835
  )
809
836
  from .toolexecutionstartedevent import (
810
837
  ToolExecutionStartedEvent,
838
+ ToolExecutionStartedEventName,
839
+ ToolExecutionStartedEventNameTypedDict,
811
840
  ToolExecutionStartedEventType,
812
841
  ToolExecutionStartedEventTypedDict,
813
842
  )
@@ -928,6 +957,8 @@ __all__ = [
928
957
  "AgentUpdateRequestTools",
929
958
  "AgentUpdateRequestToolsTypedDict",
930
959
  "AgentUpdateRequestTypedDict",
960
+ "AgentsAPIV1AgentsDeleteRequest",
961
+ "AgentsAPIV1AgentsDeleteRequestTypedDict",
931
962
  "AgentsAPIV1AgentsGetRequest",
932
963
  "AgentsAPIV1AgentsGetRequestTypedDict",
933
964
  "AgentsAPIV1AgentsListRequest",
@@ -940,6 +971,8 @@ __all__ = [
940
971
  "AgentsAPIV1ConversationsAppendRequestTypedDict",
941
972
  "AgentsAPIV1ConversationsAppendStreamRequest",
942
973
  "AgentsAPIV1ConversationsAppendStreamRequestTypedDict",
974
+ "AgentsAPIV1ConversationsDeleteRequest",
975
+ "AgentsAPIV1ConversationsDeleteRequestTypedDict",
943
976
  "AgentsAPIV1ConversationsGetRequest",
944
977
  "AgentsAPIV1ConversationsGetRequestTypedDict",
945
978
  "AgentsAPIV1ConversationsGetResponseV1ConversationsGet",
@@ -980,6 +1013,8 @@ __all__ = [
980
1013
  "AssistantMessageContentTypedDict",
981
1014
  "AssistantMessageRole",
982
1015
  "AssistantMessageTypedDict",
1016
+ "Attributes",
1017
+ "AttributesTypedDict",
983
1018
  "AudioChunk",
984
1019
  "AudioChunkType",
985
1020
  "AudioChunkTypedDict",
@@ -1211,6 +1246,7 @@ __all__ = [
1211
1246
  "FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict",
1212
1247
  "FineTuneableModelType",
1213
1248
  "FinishReason",
1249
+ "Format",
1214
1250
  "Function",
1215
1251
  "FunctionCall",
1216
1252
  "FunctionCallEntry",
@@ -1412,6 +1448,8 @@ __all__ = [
1412
1448
  "ModerationObjectTypedDict",
1413
1449
  "ModerationResponse",
1414
1450
  "ModerationResponseTypedDict",
1451
+ "Name",
1452
+ "NameTypedDict",
1415
1453
  "NoResponseError",
1416
1454
  "OCRImageObject",
1417
1455
  "OCRImageObjectTypedDict",
@@ -1423,6 +1461,8 @@ __all__ = [
1423
1461
  "OCRRequestTypedDict",
1424
1462
  "OCRResponse",
1425
1463
  "OCRResponseTypedDict",
1464
+ "OCRTableObject",
1465
+ "OCRTableObjectTypedDict",
1426
1466
  "OCRUsageInfo",
1427
1467
  "OCRUsageInfoTypedDict",
1428
1468
  "Object",
@@ -1444,6 +1484,7 @@ __all__ = [
1444
1484
  "ReferenceChunkTypedDict",
1445
1485
  "Repositories",
1446
1486
  "RepositoriesTypedDict",
1487
+ "RequestSource",
1447
1488
  "Response1",
1448
1489
  "Response1TypedDict",
1449
1490
  "ResponseBody",
@@ -1490,6 +1531,7 @@ __all__ = [
1490
1531
  "SystemMessageContentChunksTypedDict",
1491
1532
  "SystemMessageContentTypedDict",
1492
1533
  "SystemMessageTypedDict",
1534
+ "TableFormat",
1493
1535
  "TextChunk",
1494
1536
  "TextChunkType",
1495
1537
  "TextChunkTypedDict",
@@ -1506,9 +1548,13 @@ __all__ = [
1506
1548
  "ToolChoiceEnum",
1507
1549
  "ToolChoiceTypedDict",
1508
1550
  "ToolExecutionDeltaEvent",
1551
+ "ToolExecutionDeltaEventName",
1552
+ "ToolExecutionDeltaEventNameTypedDict",
1509
1553
  "ToolExecutionDeltaEventType",
1510
1554
  "ToolExecutionDeltaEventTypedDict",
1511
1555
  "ToolExecutionDoneEvent",
1556
+ "ToolExecutionDoneEventName",
1557
+ "ToolExecutionDoneEventNameTypedDict",
1512
1558
  "ToolExecutionDoneEventType",
1513
1559
  "ToolExecutionDoneEventTypedDict",
1514
1560
  "ToolExecutionEntry",
@@ -1516,6 +1562,8 @@ __all__ = [
1516
1562
  "ToolExecutionEntryType",
1517
1563
  "ToolExecutionEntryTypedDict",
1518
1564
  "ToolExecutionStartedEvent",
1565
+ "ToolExecutionStartedEventName",
1566
+ "ToolExecutionStartedEventNameTypedDict",
1519
1567
  "ToolExecutionStartedEventType",
1520
1568
  "ToolExecutionStartedEventTypedDict",
1521
1569
  "ToolFileChunk",
@@ -1612,6 +1660,8 @@ _dynamic_imports: dict[str, str] = {
1612
1660
  "AgentHandoffStartedEvent": ".agenthandoffstartedevent",
1613
1661
  "AgentHandoffStartedEventType": ".agenthandoffstartedevent",
1614
1662
  "AgentHandoffStartedEventTypedDict": ".agenthandoffstartedevent",
1663
+ "AgentsAPIV1AgentsDeleteRequest": ".agents_api_v1_agents_deleteop",
1664
+ "AgentsAPIV1AgentsDeleteRequestTypedDict": ".agents_api_v1_agents_deleteop",
1615
1665
  "AgentsAPIV1AgentsGetRequest": ".agents_api_v1_agents_getop",
1616
1666
  "AgentsAPIV1AgentsGetRequestTypedDict": ".agents_api_v1_agents_getop",
1617
1667
  "AgentsAPIV1AgentsListRequest": ".agents_api_v1_agents_listop",
@@ -1624,6 +1674,8 @@ _dynamic_imports: dict[str, str] = {
1624
1674
  "AgentsAPIV1ConversationsAppendStreamRequestTypedDict": ".agents_api_v1_conversations_append_streamop",
1625
1675
  "AgentsAPIV1ConversationsAppendRequest": ".agents_api_v1_conversations_appendop",
1626
1676
  "AgentsAPIV1ConversationsAppendRequestTypedDict": ".agents_api_v1_conversations_appendop",
1677
+ "AgentsAPIV1ConversationsDeleteRequest": ".agents_api_v1_conversations_deleteop",
1678
+ "AgentsAPIV1ConversationsDeleteRequestTypedDict": ".agents_api_v1_conversations_deleteop",
1627
1679
  "AgentsAPIV1ConversationsGetRequest": ".agents_api_v1_conversations_getop",
1628
1680
  "AgentsAPIV1ConversationsGetRequestTypedDict": ".agents_api_v1_conversations_getop",
1629
1681
  "AgentsAPIV1ConversationsGetResponseV1ConversationsGet": ".agents_api_v1_conversations_getop",
@@ -1860,6 +1912,8 @@ _dynamic_imports: dict[str, str] = {
1860
1912
  "DocumentOutTypedDict": ".documentout",
1861
1913
  "DocumentTextContent": ".documenttextcontent",
1862
1914
  "DocumentTextContentTypedDict": ".documenttextcontent",
1915
+ "Attributes": ".documentupdatein",
1916
+ "AttributesTypedDict": ".documentupdatein",
1863
1917
  "DocumentUpdateIn": ".documentupdatein",
1864
1918
  "DocumentUpdateInTypedDict": ".documentupdatein",
1865
1919
  "DocumentURLChunk": ".documenturlchunk",
@@ -2126,8 +2180,12 @@ _dynamic_imports: dict[str, str] = {
2126
2180
  "DocumentTypedDict": ".ocrrequest",
2127
2181
  "OCRRequest": ".ocrrequest",
2128
2182
  "OCRRequestTypedDict": ".ocrrequest",
2183
+ "TableFormat": ".ocrrequest",
2129
2184
  "OCRResponse": ".ocrresponse",
2130
2185
  "OCRResponseTypedDict": ".ocrresponse",
2186
+ "Format": ".ocrtableobject",
2187
+ "OCRTableObject": ".ocrtableobject",
2188
+ "OCRTableObjectTypedDict": ".ocrtableobject",
2131
2189
  "OCRUsageInfo": ".ocrusageinfo",
2132
2190
  "OCRUsageInfoTypedDict": ".ocrusageinfo",
2133
2191
  "OutputContentChunks": ".outputcontentchunks",
@@ -2141,6 +2199,7 @@ _dynamic_imports: dict[str, str] = {
2141
2199
  "ReferenceChunk": ".referencechunk",
2142
2200
  "ReferenceChunkType": ".referencechunk",
2143
2201
  "ReferenceChunkTypedDict": ".referencechunk",
2202
+ "RequestSource": ".requestsource",
2144
2203
  "ResponseDoneEvent": ".responsedoneevent",
2145
2204
  "ResponseDoneEventType": ".responsedoneevent",
2146
2205
  "ResponseDoneEventTypedDict": ".responsedoneevent",
@@ -2197,16 +2256,24 @@ _dynamic_imports: dict[str, str] = {
2197
2256
  "ToolChoiceTypedDict": ".toolchoice",
2198
2257
  "ToolChoiceEnum": ".toolchoiceenum",
2199
2258
  "ToolExecutionDeltaEvent": ".toolexecutiondeltaevent",
2259
+ "ToolExecutionDeltaEventName": ".toolexecutiondeltaevent",
2260
+ "ToolExecutionDeltaEventNameTypedDict": ".toolexecutiondeltaevent",
2200
2261
  "ToolExecutionDeltaEventType": ".toolexecutiondeltaevent",
2201
2262
  "ToolExecutionDeltaEventTypedDict": ".toolexecutiondeltaevent",
2202
2263
  "ToolExecutionDoneEvent": ".toolexecutiondoneevent",
2264
+ "ToolExecutionDoneEventName": ".toolexecutiondoneevent",
2265
+ "ToolExecutionDoneEventNameTypedDict": ".toolexecutiondoneevent",
2203
2266
  "ToolExecutionDoneEventType": ".toolexecutiondoneevent",
2204
2267
  "ToolExecutionDoneEventTypedDict": ".toolexecutiondoneevent",
2268
+ "Name": ".toolexecutionentry",
2269
+ "NameTypedDict": ".toolexecutionentry",
2205
2270
  "ToolExecutionEntry": ".toolexecutionentry",
2206
2271
  "ToolExecutionEntryObject": ".toolexecutionentry",
2207
2272
  "ToolExecutionEntryType": ".toolexecutionentry",
2208
2273
  "ToolExecutionEntryTypedDict": ".toolexecutionentry",
2209
2274
  "ToolExecutionStartedEvent": ".toolexecutionstartedevent",
2275
+ "ToolExecutionStartedEventName": ".toolexecutionstartedevent",
2276
+ "ToolExecutionStartedEventNameTypedDict": ".toolexecutionstartedevent",
2210
2277
  "ToolExecutionStartedEventType": ".toolexecutionstartedevent",
2211
2278
  "ToolExecutionStartedEventTypedDict": ".toolexecutionstartedevent",
2212
2279
  "ToolFileChunk": ".toolfilechunk",
mistralai/models/agent.py CHANGED
@@ -12,7 +12,7 @@ from datetime import datetime
12
12
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
13
13
  from mistralai.utils import get_discriminator
14
14
  from pydantic import Discriminator, Tag, model_serializer
15
- from typing import List, Literal, Optional, Union
15
+ from typing import Any, Dict, List, Literal, Optional, Union
16
16
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
@@ -50,8 +50,11 @@ class AgentTypedDict(TypedDict):
50
50
  name: str
51
51
  id: str
52
52
  version: int
53
+ versions: List[int]
53
54
  created_at: datetime
54
55
  updated_at: datetime
56
+ deployment_chat: bool
57
+ source: str
55
58
  instructions: NotRequired[Nullable[str]]
56
59
  r"""Instruction prompt the model will follow during the conversation."""
57
60
  tools: NotRequired[List[AgentToolsTypedDict]]
@@ -60,6 +63,7 @@ class AgentTypedDict(TypedDict):
60
63
  r"""White-listed arguments from the completion API"""
61
64
  description: NotRequired[Nullable[str]]
62
65
  handoffs: NotRequired[Nullable[List[str]]]
66
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
63
67
  object: NotRequired[AgentObject]
64
68
 
65
69
 
@@ -72,10 +76,16 @@ class Agent(BaseModel):
72
76
 
73
77
  version: int
74
78
 
79
+ versions: List[int]
80
+
75
81
  created_at: datetime
76
82
 
77
83
  updated_at: datetime
78
84
 
85
+ deployment_chat: bool
86
+
87
+ source: str
88
+
79
89
  instructions: OptionalNullable[str] = UNSET
80
90
  r"""Instruction prompt the model will follow during the conversation."""
81
91
 
@@ -89,6 +99,8 @@ class Agent(BaseModel):
89
99
 
90
100
  handoffs: OptionalNullable[List[str]] = UNSET
91
101
 
102
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
103
+
92
104
  object: Optional[AgentObject] = "agent"
93
105
 
94
106
  @model_serializer(mode="wrap")
@@ -99,9 +111,10 @@ class Agent(BaseModel):
99
111
  "completion_args",
100
112
  "description",
101
113
  "handoffs",
114
+ "metadata",
102
115
  "object",
103
116
  ]
104
- nullable_fields = ["instructions", "description", "handoffs"]
117
+ nullable_fields = ["instructions", "description", "handoffs", "metadata"]
105
118
  null_default_fields = []
106
119
 
107
120
  serialized = handler(self)
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  from datetime import datetime
5
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
6
  from pydantic import model_serializer
7
- from typing import Literal, Optional
7
+ from typing import Any, Dict, Literal, Optional
8
8
  from typing_extensions import NotRequired, TypedDict
9
9
 
10
10
 
@@ -20,7 +20,10 @@ class AgentConversationTypedDict(TypedDict):
20
20
  r"""Name given to the conversation."""
21
21
  description: NotRequired[Nullable[str]]
22
22
  r"""Description of the what the conversation is about."""
23
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
24
+ r"""Custom metadata for the conversation."""
23
25
  object: NotRequired[AgentConversationObject]
26
+ agent_version: NotRequired[Nullable[int]]
24
27
 
25
28
 
26
29
  class AgentConversation(BaseModel):
@@ -38,12 +41,17 @@ class AgentConversation(BaseModel):
38
41
  description: OptionalNullable[str] = UNSET
39
42
  r"""Description of the what the conversation is about."""
40
43
 
44
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
45
+ r"""Custom metadata for the conversation."""
46
+
41
47
  object: Optional[AgentConversationObject] = "conversation"
42
48
 
49
+ agent_version: OptionalNullable[int] = UNSET
50
+
43
51
  @model_serializer(mode="wrap")
44
52
  def serialize_model(self, handler):
45
- optional_fields = ["name", "description", "object"]
46
- nullable_fields = ["name", "description"]
53
+ optional_fields = ["name", "description", "metadata", "object", "agent_version"]
54
+ nullable_fields = ["name", "description", "metadata", "agent_version"]
47
55
  null_default_fields = []
48
56
 
49
57
  serialized = handler(self)
@@ -11,7 +11,7 @@ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
11
11
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
12
12
  from mistralai.utils import get_discriminator
13
13
  from pydantic import Discriminator, Tag, model_serializer
14
- from typing import List, Optional, Union
14
+ from typing import Any, Dict, List, Optional, Union
15
15
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
16
16
 
17
17
 
@@ -52,6 +52,7 @@ class AgentCreationRequestTypedDict(TypedDict):
52
52
  r"""White-listed arguments from the completion API"""
53
53
  description: NotRequired[Nullable[str]]
54
54
  handoffs: NotRequired[Nullable[List[str]]]
55
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
55
56
 
56
57
 
57
58
  class AgentCreationRequest(BaseModel):
@@ -72,6 +73,8 @@ class AgentCreationRequest(BaseModel):
72
73
 
73
74
  handoffs: OptionalNullable[List[str]] = UNSET
74
75
 
76
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
77
+
75
78
  @model_serializer(mode="wrap")
76
79
  def serialize_model(self, handler):
77
80
  optional_fields = [
@@ -80,8 +83,9 @@ class AgentCreationRequest(BaseModel):
80
83
  "completion_args",
81
84
  "description",
82
85
  "handoffs",
86
+ "metadata",
83
87
  ]
84
- nullable_fields = ["instructions", "description", "handoffs"]
88
+ nullable_fields = ["instructions", "description", "handoffs", "metadata"]
85
89
  null_default_fields = []
86
90
 
87
91
  serialized = handler(self)
@@ -0,0 +1,16 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing_extensions import Annotated, TypedDict
7
+
8
+
9
+ class AgentsAPIV1AgentsDeleteRequestTypedDict(TypedDict):
10
+ agent_id: str
11
+
12
+
13
+ class AgentsAPIV1AgentsDeleteRequest(BaseModel):
14
+ agent_id: Annotated[
15
+ str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
16
+ ]
@@ -1,16 +1,53 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from mistralai.types import BaseModel
5
- from mistralai.utils import FieldMetadata, PathParamMetadata
6
- from typing_extensions import Annotated, TypedDict
4
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
6
+ from pydantic import model_serializer
7
+ from typing_extensions import Annotated, NotRequired, TypedDict
7
8
 
8
9
 
9
10
  class AgentsAPIV1AgentsGetRequestTypedDict(TypedDict):
10
11
  agent_id: str
12
+ agent_version: NotRequired[Nullable[int]]
11
13
 
12
14
 
13
15
  class AgentsAPIV1AgentsGetRequest(BaseModel):
14
16
  agent_id: Annotated[
15
17
  str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
16
18
  ]
19
+
20
+ agent_version: Annotated[
21
+ OptionalNullable[int],
22
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
23
+ ] = UNSET
24
+
25
+ @model_serializer(mode="wrap")
26
+ def serialize_model(self, handler):
27
+ optional_fields = ["agent_version"]
28
+ nullable_fields = ["agent_version"]
29
+ null_default_fields = []
30
+
31
+ serialized = handler(self)
32
+
33
+ m = {}
34
+
35
+ for n, f in type(self).model_fields.items():
36
+ k = f.alias or n
37
+ val = serialized.get(k)
38
+ serialized.pop(k, None)
39
+
40
+ optional_nullable = k in optional_fields and k in nullable_fields
41
+ is_set = (
42
+ self.__pydantic_fields_set__.intersection({n})
43
+ or k in null_default_fields
44
+ ) # pylint: disable=no-member
45
+
46
+ if val is not None and val != UNSET_SENTINEL:
47
+ m[k] = val
48
+ elif val != UNSET_SENTINEL and (
49
+ not k in optional_fields or (optional_nullable and is_set)
50
+ ):
51
+ m[k] = val
52
+
53
+ return m
@@ -1,15 +1,22 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from mistralai.types import BaseModel
4
+ from .requestsource import RequestSource
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
6
  from mistralai.utils import FieldMetadata, QueryParamMetadata
6
- from typing import Optional
7
+ from pydantic import model_serializer
8
+ from typing import Any, Dict, List, Optional
7
9
  from typing_extensions import Annotated, NotRequired, TypedDict
8
10
 
9
11
 
10
12
  class AgentsAPIV1AgentsListRequestTypedDict(TypedDict):
11
13
  page: NotRequired[int]
12
14
  page_size: NotRequired[int]
15
+ deployment_chat: NotRequired[Nullable[bool]]
16
+ sources: NotRequired[Nullable[List[RequestSource]]]
17
+ name: NotRequired[Nullable[str]]
18
+ id: NotRequired[Nullable[str]]
19
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
13
20
 
14
21
 
15
22
  class AgentsAPIV1AgentsListRequest(BaseModel):
@@ -22,3 +29,66 @@ class AgentsAPIV1AgentsListRequest(BaseModel):
22
29
  Optional[int],
23
30
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
24
31
  ] = 20
32
+
33
+ deployment_chat: Annotated[
34
+ OptionalNullable[bool],
35
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
36
+ ] = UNSET
37
+
38
+ sources: Annotated[
39
+ OptionalNullable[List[RequestSource]],
40
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
41
+ ] = UNSET
42
+
43
+ name: Annotated[
44
+ OptionalNullable[str],
45
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
46
+ ] = UNSET
47
+
48
+ id: Annotated[
49
+ OptionalNullable[str],
50
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
51
+ ] = UNSET
52
+
53
+ metadata: Annotated[
54
+ OptionalNullable[Dict[str, Any]],
55
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
56
+ ] = UNSET
57
+
58
+ @model_serializer(mode="wrap")
59
+ def serialize_model(self, handler):
60
+ optional_fields = [
61
+ "page",
62
+ "page_size",
63
+ "deployment_chat",
64
+ "sources",
65
+ "name",
66
+ "id",
67
+ "metadata",
68
+ ]
69
+ nullable_fields = ["deployment_chat", "sources", "name", "id", "metadata"]
70
+ null_default_fields = []
71
+
72
+ serialized = handler(self)
73
+
74
+ m = {}
75
+
76
+ for n, f in type(self).model_fields.items():
77
+ k = f.alias or n
78
+ val = serialized.get(k)
79
+ serialized.pop(k, None)
80
+
81
+ optional_nullable = k in optional_fields and k in nullable_fields
82
+ is_set = (
83
+ self.__pydantic_fields_set__.intersection({n})
84
+ or k in null_default_fields
85
+ ) # pylint: disable=no-member
86
+
87
+ if val is not None and val != UNSET_SENTINEL:
88
+ m[k] = val
89
+ elif val != UNSET_SENTINEL and (
90
+ not k in optional_fields or (optional_nullable and is_set)
91
+ ):
92
+ m[k] = val
93
+
94
+ return m
@@ -0,0 +1,18 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata
6
+ from typing_extensions import Annotated, TypedDict
7
+
8
+
9
+ class AgentsAPIV1ConversationsDeleteRequestTypedDict(TypedDict):
10
+ conversation_id: str
11
+ r"""ID of the conversation from which we are fetching metadata."""
12
+
13
+
14
+ class AgentsAPIV1ConversationsDeleteRequest(BaseModel):
15
+ conversation_id: Annotated[
16
+ str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
17
+ ]
18
+ r"""ID of the conversation from which we are fetching metadata."""
@@ -3,15 +3,17 @@
3
3
  from __future__ import annotations
4
4
  from .agentconversation import AgentConversation, AgentConversationTypedDict
5
5
  from .modelconversation import ModelConversation, ModelConversationTypedDict
6
- from mistralai.types import BaseModel
6
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
7
  from mistralai.utils import FieldMetadata, QueryParamMetadata
8
- from typing import Optional, Union
8
+ from pydantic import model_serializer
9
+ from typing import Any, Dict, Optional, Union
9
10
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
10
11
 
11
12
 
12
13
  class AgentsAPIV1ConversationsListRequestTypedDict(TypedDict):
13
14
  page: NotRequired[int]
14
15
  page_size: NotRequired[int]
16
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
15
17
 
16
18
 
17
19
  class AgentsAPIV1ConversationsListRequest(BaseModel):
@@ -25,6 +27,41 @@ class AgentsAPIV1ConversationsListRequest(BaseModel):
25
27
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
26
28
  ] = 100
27
29
 
30
+ metadata: Annotated[
31
+ OptionalNullable[Dict[str, Any]],
32
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
33
+ ] = UNSET
34
+
35
+ @model_serializer(mode="wrap")
36
+ def serialize_model(self, handler):
37
+ optional_fields = ["page", "page_size", "metadata"]
38
+ nullable_fields = ["metadata"]
39
+ null_default_fields = []
40
+
41
+ serialized = handler(self)
42
+
43
+ m = {}
44
+
45
+ for n, f in type(self).model_fields.items():
46
+ k = f.alias or n
47
+ val = serialized.get(k)
48
+ serialized.pop(k, None)
49
+
50
+ optional_nullable = k in optional_fields and k in nullable_fields
51
+ is_set = (
52
+ self.__pydantic_fields_set__.intersection({n})
53
+ or k in null_default_fields
54
+ ) # pylint: disable=no-member
55
+
56
+ if val is not None and val != UNSET_SENTINEL:
57
+ m[k] = val
58
+ elif val != UNSET_SENTINEL and (
59
+ not k in optional_fields or (optional_nullable and is_set)
60
+ ):
61
+ m[k] = val
62
+
63
+ return m
64
+
28
65
 
29
66
  ResponseBodyTypedDict = TypeAliasType(
30
67
  "ResponseBodyTypedDict",