mistralai 1.10.0__py3-none-any.whl → 1.11.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.
Files changed (270) hide show
  1. mistralai/_hooks/tracing.py +28 -3
  2. mistralai/_version.py +3 -3
  3. mistralai/accesses.py +22 -12
  4. mistralai/agents.py +88 -44
  5. mistralai/basesdk.py +6 -0
  6. mistralai/chat.py +96 -40
  7. mistralai/classifiers.py +48 -23
  8. mistralai/conversations.py +186 -64
  9. mistralai/documents.py +72 -26
  10. mistralai/embeddings.py +24 -9
  11. mistralai/extra/README.md +1 -1
  12. mistralai/extra/mcp/auth.py +10 -11
  13. mistralai/extra/mcp/base.py +17 -16
  14. mistralai/extra/mcp/sse.py +13 -15
  15. mistralai/extra/mcp/stdio.py +5 -6
  16. mistralai/extra/observability/otel.py +47 -68
  17. mistralai/extra/run/context.py +33 -43
  18. mistralai/extra/run/result.py +29 -30
  19. mistralai/extra/run/tools.py +8 -9
  20. mistralai/extra/struct_chat.py +15 -8
  21. mistralai/extra/utils/response_format.py +5 -3
  22. mistralai/files.py +58 -24
  23. mistralai/fim.py +20 -12
  24. mistralai/httpclient.py +0 -1
  25. mistralai/jobs.py +65 -26
  26. mistralai/libraries.py +20 -10
  27. mistralai/mistral_agents.py +438 -30
  28. mistralai/mistral_jobs.py +62 -17
  29. mistralai/models/__init__.py +46 -1
  30. mistralai/models/agent.py +1 -1
  31. mistralai/models/agentconversation.py +1 -1
  32. mistralai/models/agenthandoffdoneevent.py +1 -1
  33. mistralai/models/agenthandoffentry.py +3 -2
  34. mistralai/models/agenthandoffstartedevent.py +1 -1
  35. mistralai/models/agents_api_v1_agents_get_versionop.py +21 -0
  36. mistralai/models/agents_api_v1_agents_list_versionsop.py +33 -0
  37. mistralai/models/agents_api_v1_agents_listop.py +5 -1
  38. mistralai/models/agents_api_v1_conversations_listop.py +1 -1
  39. mistralai/models/agentscompletionrequest.py +2 -5
  40. mistralai/models/agentscompletionstreamrequest.py +2 -5
  41. mistralai/models/archiveftmodelout.py +1 -1
  42. mistralai/models/assistantmessage.py +1 -1
  43. mistralai/models/audiochunk.py +1 -1
  44. mistralai/models/audioencoding.py +18 -0
  45. mistralai/models/audioformat.py +17 -0
  46. mistralai/models/basemodelcard.py +1 -1
  47. mistralai/models/batchjobin.py +18 -9
  48. mistralai/models/batchjobout.py +6 -1
  49. mistralai/models/batchjobsout.py +1 -1
  50. mistralai/models/batchrequest.py +48 -0
  51. mistralai/models/chatcompletionchoice.py +10 -5
  52. mistralai/models/chatcompletionrequest.py +2 -5
  53. mistralai/models/chatcompletionstreamrequest.py +2 -5
  54. mistralai/models/classificationrequest.py +37 -3
  55. mistralai/models/classifierdetailedjobout.py +4 -2
  56. mistralai/models/classifierftmodelout.py +3 -2
  57. mistralai/models/classifierjobout.py +4 -2
  58. mistralai/models/codeinterpretertool.py +1 -1
  59. mistralai/models/completiondetailedjobout.py +5 -2
  60. mistralai/models/completionftmodelout.py +3 -2
  61. mistralai/models/completionjobout.py +5 -2
  62. mistralai/models/completionresponsestreamchoice.py +9 -8
  63. mistralai/models/conversationappendrequest.py +4 -1
  64. mistralai/models/conversationappendstreamrequest.py +4 -1
  65. mistralai/models/conversationhistory.py +2 -1
  66. mistralai/models/conversationmessages.py +1 -1
  67. mistralai/models/conversationrequest.py +5 -1
  68. mistralai/models/conversationresponse.py +2 -1
  69. mistralai/models/conversationrestartrequest.py +4 -1
  70. mistralai/models/conversationrestartstreamrequest.py +4 -1
  71. mistralai/models/conversationstreamrequest.py +5 -1
  72. mistralai/models/documentlibrarytool.py +1 -1
  73. mistralai/models/documenturlchunk.py +1 -1
  74. mistralai/models/embeddingdtype.py +7 -1
  75. mistralai/models/embeddingrequest.py +11 -3
  76. mistralai/models/encodingformat.py +4 -1
  77. mistralai/models/entitytype.py +8 -1
  78. mistralai/models/filepurpose.py +8 -1
  79. mistralai/models/files_api_routes_list_filesop.py +4 -11
  80. mistralai/models/files_api_routes_upload_fileop.py +2 -6
  81. mistralai/models/fileschema.py +3 -5
  82. mistralai/models/finetuneablemodeltype.py +4 -1
  83. mistralai/models/ftclassifierlossfunction.py +4 -1
  84. mistralai/models/ftmodelcard.py +1 -1
  85. mistralai/models/functioncallentry.py +3 -2
  86. mistralai/models/functioncallevent.py +1 -1
  87. mistralai/models/functionresultentry.py +3 -2
  88. mistralai/models/functiontool.py +1 -1
  89. mistralai/models/githubrepositoryin.py +1 -1
  90. mistralai/models/githubrepositoryout.py +1 -1
  91. mistralai/models/httpvalidationerror.py +4 -2
  92. mistralai/models/imagegenerationtool.py +1 -1
  93. mistralai/models/imageurlchunk.py +1 -1
  94. mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
  95. mistralai/models/jobsout.py +1 -1
  96. mistralai/models/legacyjobmetadataout.py +1 -1
  97. mistralai/models/messageinputentry.py +9 -3
  98. mistralai/models/messageoutputentry.py +6 -3
  99. mistralai/models/messageoutputevent.py +4 -2
  100. mistralai/models/mistralerror.py +11 -7
  101. mistralai/models/mistralpromptmode.py +1 -1
  102. mistralai/models/modelconversation.py +1 -1
  103. mistralai/models/no_response_error.py +5 -1
  104. mistralai/models/ocrrequest.py +11 -1
  105. mistralai/models/ocrtableobject.py +4 -1
  106. mistralai/models/referencechunk.py +1 -1
  107. mistralai/models/requestsource.py +5 -1
  108. mistralai/models/responsedoneevent.py +1 -1
  109. mistralai/models/responseerrorevent.py +1 -1
  110. mistralai/models/responseformats.py +5 -1
  111. mistralai/models/responsestartedevent.py +1 -1
  112. mistralai/models/responsevalidationerror.py +2 -0
  113. mistralai/models/retrievefileout.py +3 -5
  114. mistralai/models/sampletype.py +7 -1
  115. mistralai/models/sdkerror.py +2 -0
  116. mistralai/models/shareenum.py +7 -1
  117. mistralai/models/sharingdelete.py +2 -4
  118. mistralai/models/sharingin.py +3 -5
  119. mistralai/models/source.py +8 -1
  120. mistralai/models/systemmessage.py +1 -1
  121. mistralai/models/textchunk.py +1 -1
  122. mistralai/models/thinkchunk.py +1 -1
  123. mistralai/models/timestampgranularity.py +1 -1
  124. mistralai/models/tool.py +2 -6
  125. mistralai/models/toolcall.py +2 -6
  126. mistralai/models/toolchoice.py +2 -6
  127. mistralai/models/toolchoiceenum.py +6 -1
  128. mistralai/models/toolexecutiondeltaevent.py +2 -1
  129. mistralai/models/toolexecutiondoneevent.py +2 -1
  130. mistralai/models/toolexecutionentry.py +4 -2
  131. mistralai/models/toolexecutionstartedevent.py +2 -1
  132. mistralai/models/toolfilechunk.py +13 -5
  133. mistralai/models/toolmessage.py +1 -1
  134. mistralai/models/toolreferencechunk.py +15 -5
  135. mistralai/models/tooltypes.py +1 -1
  136. mistralai/models/transcriptionsegmentchunk.py +1 -1
  137. mistralai/models/transcriptionstreamdone.py +1 -1
  138. mistralai/models/transcriptionstreamlanguage.py +1 -1
  139. mistralai/models/transcriptionstreamsegmentdelta.py +1 -1
  140. mistralai/models/transcriptionstreamtextdelta.py +1 -1
  141. mistralai/models/unarchiveftmodelout.py +1 -1
  142. mistralai/models/uploadfileout.py +3 -5
  143. mistralai/models/usermessage.py +1 -1
  144. mistralai/models/wandbintegration.py +1 -1
  145. mistralai/models/wandbintegrationout.py +1 -1
  146. mistralai/models/websearchpremiumtool.py +1 -1
  147. mistralai/models/websearchtool.py +1 -1
  148. mistralai/models_.py +24 -12
  149. mistralai/ocr.py +38 -10
  150. mistralai/sdk.py +2 -2
  151. mistralai/transcriptions.py +28 -12
  152. mistralai/types/basemodel.py +41 -3
  153. mistralai/utils/__init__.py +0 -3
  154. mistralai/utils/annotations.py +32 -8
  155. mistralai/utils/enums.py +60 -0
  156. mistralai/utils/forms.py +21 -10
  157. mistralai/utils/queryparams.py +14 -2
  158. mistralai/utils/requestbodies.py +3 -3
  159. mistralai/utils/retries.py +69 -5
  160. mistralai/utils/serializers.py +0 -20
  161. mistralai/utils/unmarshal_json_response.py +15 -1
  162. {mistralai-1.10.0.dist-info → mistralai-1.11.1.dist-info}/METADATA +144 -159
  163. mistralai-1.11.1.dist-info/RECORD +495 -0
  164. {mistralai-1.10.0.dist-info → mistralai-1.11.1.dist-info}/WHEEL +1 -1
  165. mistralai_azure/_version.py +3 -3
  166. mistralai_azure/basesdk.py +21 -5
  167. mistralai_azure/chat.py +82 -109
  168. mistralai_azure/httpclient.py +0 -1
  169. mistralai_azure/models/__init__.py +66 -4
  170. mistralai_azure/models/assistantmessage.py +1 -1
  171. mistralai_azure/models/chatcompletionchoice.py +10 -7
  172. mistralai_azure/models/chatcompletionrequest.py +24 -10
  173. mistralai_azure/models/chatcompletionstreamrequest.py +24 -10
  174. mistralai_azure/models/completionresponsestreamchoice.py +11 -7
  175. mistralai_azure/models/documenturlchunk.py +1 -1
  176. mistralai_azure/models/httpvalidationerror.py +15 -8
  177. mistralai_azure/models/imageurlchunk.py +1 -1
  178. mistralai_azure/models/mistralazureerror.py +30 -0
  179. mistralai_azure/models/mistralpromptmode.py +1 -1
  180. mistralai_azure/models/no_response_error.py +17 -0
  181. mistralai_azure/models/ocrpageobject.py +32 -5
  182. mistralai_azure/models/ocrrequest.py +20 -1
  183. mistralai_azure/models/ocrtableobject.py +34 -0
  184. mistralai_azure/models/prediction.py +4 -0
  185. mistralai_azure/models/referencechunk.py +1 -1
  186. mistralai_azure/models/responseformat.py +4 -2
  187. mistralai_azure/models/responseformats.py +5 -2
  188. mistralai_azure/models/responsevalidationerror.py +27 -0
  189. mistralai_azure/models/sdkerror.py +32 -14
  190. mistralai_azure/models/systemmessage.py +8 -4
  191. mistralai_azure/models/systemmessagecontentchunks.py +21 -0
  192. mistralai_azure/models/textchunk.py +1 -1
  193. mistralai_azure/models/thinkchunk.py +35 -0
  194. mistralai_azure/models/tool.py +2 -6
  195. mistralai_azure/models/toolcall.py +2 -6
  196. mistralai_azure/models/toolchoice.py +2 -6
  197. mistralai_azure/models/toolchoiceenum.py +6 -1
  198. mistralai_azure/models/toolmessage.py +1 -1
  199. mistralai_azure/models/tooltypes.py +1 -1
  200. mistralai_azure/models/usermessage.py +1 -1
  201. mistralai_azure/ocr.py +39 -40
  202. mistralai_azure/types/basemodel.py +41 -3
  203. mistralai_azure/utils/__init__.py +18 -8
  204. mistralai_azure/utils/annotations.py +32 -8
  205. mistralai_azure/utils/enums.py +60 -0
  206. mistralai_azure/utils/eventstreaming.py +10 -0
  207. mistralai_azure/utils/forms.py +21 -10
  208. mistralai_azure/utils/queryparams.py +14 -2
  209. mistralai_azure/utils/requestbodies.py +3 -3
  210. mistralai_azure/utils/retries.py +69 -5
  211. mistralai_azure/utils/serializers.py +3 -22
  212. mistralai_azure/utils/unmarshal_json_response.py +38 -0
  213. mistralai_gcp/_hooks/types.py +7 -0
  214. mistralai_gcp/_version.py +4 -4
  215. mistralai_gcp/basesdk.py +33 -25
  216. mistralai_gcp/chat.py +98 -109
  217. mistralai_gcp/fim.py +62 -85
  218. mistralai_gcp/httpclient.py +6 -17
  219. mistralai_gcp/models/__init__.py +321 -116
  220. mistralai_gcp/models/assistantmessage.py +2 -2
  221. mistralai_gcp/models/chatcompletionchoice.py +10 -7
  222. mistralai_gcp/models/chatcompletionrequest.py +38 -7
  223. mistralai_gcp/models/chatcompletionresponse.py +6 -6
  224. mistralai_gcp/models/chatcompletionstreamrequest.py +38 -7
  225. mistralai_gcp/models/completionresponsestreamchoice.py +12 -8
  226. mistralai_gcp/models/deltamessage.py +1 -1
  227. mistralai_gcp/models/fimcompletionrequest.py +9 -10
  228. mistralai_gcp/models/fimcompletionresponse.py +6 -6
  229. mistralai_gcp/models/fimcompletionstreamrequest.py +9 -10
  230. mistralai_gcp/models/httpvalidationerror.py +15 -8
  231. mistralai_gcp/models/imageurl.py +1 -1
  232. mistralai_gcp/models/imageurlchunk.py +1 -1
  233. mistralai_gcp/models/jsonschema.py +1 -1
  234. mistralai_gcp/models/mistralgcperror.py +30 -0
  235. mistralai_gcp/models/mistralpromptmode.py +8 -0
  236. mistralai_gcp/models/no_response_error.py +17 -0
  237. mistralai_gcp/models/prediction.py +4 -0
  238. mistralai_gcp/models/referencechunk.py +1 -1
  239. mistralai_gcp/models/responseformat.py +5 -3
  240. mistralai_gcp/models/responseformats.py +5 -2
  241. mistralai_gcp/models/responsevalidationerror.py +27 -0
  242. mistralai_gcp/models/sdkerror.py +32 -14
  243. mistralai_gcp/models/systemmessage.py +8 -4
  244. mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
  245. mistralai_gcp/models/textchunk.py +1 -1
  246. mistralai_gcp/models/thinkchunk.py +35 -0
  247. mistralai_gcp/models/tool.py +2 -6
  248. mistralai_gcp/models/toolcall.py +2 -6
  249. mistralai_gcp/models/toolchoice.py +2 -6
  250. mistralai_gcp/models/toolchoiceenum.py +6 -1
  251. mistralai_gcp/models/toolmessage.py +2 -2
  252. mistralai_gcp/models/tooltypes.py +1 -1
  253. mistralai_gcp/models/usageinfo.py +71 -8
  254. mistralai_gcp/models/usermessage.py +2 -2
  255. mistralai_gcp/sdk.py +12 -10
  256. mistralai_gcp/sdkconfiguration.py +0 -7
  257. mistralai_gcp/types/basemodel.py +41 -3
  258. mistralai_gcp/utils/__init__.py +141 -46
  259. mistralai_gcp/utils/annotations.py +32 -8
  260. mistralai_gcp/utils/datetimes.py +23 -0
  261. mistralai_gcp/utils/enums.py +125 -25
  262. mistralai_gcp/utils/eventstreaming.py +10 -0
  263. mistralai_gcp/utils/forms.py +62 -30
  264. mistralai_gcp/utils/queryparams.py +14 -2
  265. mistralai_gcp/utils/requestbodies.py +3 -3
  266. mistralai_gcp/utils/retries.py +69 -5
  267. mistralai_gcp/utils/serializers.py +33 -23
  268. mistralai_gcp/utils/unmarshal_json_response.py +38 -0
  269. mistralai-1.10.0.dist-info/RECORD +0 -475
  270. {mistralai-1.10.0.dist-info → mistralai-1.11.1.dist-info}/licenses/LICENSE +0 -0
@@ -6,7 +6,7 @@ from typing import Literal, Optional
6
6
  from typing_extensions import NotRequired, TypedDict
7
7
 
8
8
 
9
- AudioChunkType = Literal["input_audio"]
9
+ AudioChunkType = Literal["input_audio",]
10
10
 
11
11
 
12
12
  class AudioChunkTypedDict(TypedDict):
@@ -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 UnrecognizedStr
5
+ from typing import Literal, Union
6
+
7
+
8
+ AudioEncoding = Union[
9
+ Literal[
10
+ "pcm_s16le",
11
+ "pcm_s32le",
12
+ "pcm_f16le",
13
+ "pcm_f32le",
14
+ "pcm_mulaw",
15
+ "pcm_alaw",
16
+ ],
17
+ UnrecognizedStr,
18
+ ]
@@ -0,0 +1,17 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .audioencoding import AudioEncoding
5
+ from mistralai.types import BaseModel
6
+ from typing_extensions import TypedDict
7
+
8
+
9
+ class AudioFormatTypedDict(TypedDict):
10
+ encoding: AudioEncoding
11
+ sample_rate: int
12
+
13
+
14
+ class AudioFormat(BaseModel):
15
+ encoding: AudioEncoding
16
+
17
+ sample_rate: int
@@ -12,7 +12,7 @@ from typing import List, Literal, Optional
12
12
  from typing_extensions import Annotated, NotRequired, TypedDict
13
13
 
14
14
 
15
- BaseModelCardType = Literal["base"]
15
+ BaseModelCardType = Literal["base",]
16
16
 
17
17
 
18
18
  class BaseModelCardTypedDict(TypedDict):
@@ -2,18 +2,18 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .apiendpoint import APIEndpoint
5
+ from .batchrequest import BatchRequest, BatchRequestTypedDict
5
6
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
- from mistralai.utils import validate_open_enum
7
7
  from pydantic import model_serializer
8
- from pydantic.functional_validators import PlainValidator
9
8
  from typing import Dict, List, Optional
10
- from typing_extensions import Annotated, NotRequired, TypedDict
9
+ from typing_extensions import NotRequired, TypedDict
11
10
 
12
11
 
13
12
  class BatchJobInTypedDict(TypedDict):
14
- input_files: List[str]
15
- r"""The list of input files to be used for batch inference, these files should be `jsonl` files, containing the input data corresponding to the bory request for the batch inference in a \"body\" field. An example of such file is the following: ```json {\"custom_id\": \"0\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French cheese?\"}]}} {\"custom_id\": \"1\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French wine?\"}]}} ```"""
16
13
  endpoint: APIEndpoint
14
+ input_files: NotRequired[Nullable[List[str]]]
15
+ r"""The list of input files to be used for batch inference, these files should be `jsonl` files, containing the input data corresponding to the bory request for the batch inference in a \"body\" field. An example of such file is the following: ```json {\"custom_id\": \"0\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French cheese?\"}]}} {\"custom_id\": \"1\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French wine?\"}]}} ```"""
16
+ requests: NotRequired[Nullable[List[BatchRequestTypedDict]]]
17
17
  model: NotRequired[Nullable[str]]
18
18
  r"""The model to be used for batch inference."""
19
19
  agent_id: NotRequired[Nullable[str]]
@@ -25,10 +25,12 @@ class BatchJobInTypedDict(TypedDict):
25
25
 
26
26
 
27
27
  class BatchJobIn(BaseModel):
28
- input_files: List[str]
28
+ endpoint: APIEndpoint
29
+
30
+ input_files: OptionalNullable[List[str]] = UNSET
29
31
  r"""The list of input files to be used for batch inference, these files should be `jsonl` files, containing the input data corresponding to the bory request for the batch inference in a \"body\" field. An example of such file is the following: ```json {\"custom_id\": \"0\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French cheese?\"}]}} {\"custom_id\": \"1\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French wine?\"}]}} ```"""
30
32
 
31
- endpoint: Annotated[APIEndpoint, PlainValidator(validate_open_enum(False))]
33
+ requests: OptionalNullable[List[BatchRequest]] = UNSET
32
34
 
33
35
  model: OptionalNullable[str] = UNSET
34
36
  r"""The model to be used for batch inference."""
@@ -44,8 +46,15 @@ class BatchJobIn(BaseModel):
44
46
 
45
47
  @model_serializer(mode="wrap")
46
48
  def serialize_model(self, handler):
47
- optional_fields = ["model", "agent_id", "metadata", "timeout_hours"]
48
- nullable_fields = ["model", "agent_id", "metadata"]
49
+ optional_fields = [
50
+ "input_files",
51
+ "requests",
52
+ "model",
53
+ "agent_id",
54
+ "metadata",
55
+ "timeout_hours",
56
+ ]
57
+ nullable_fields = ["input_files", "requests", "model", "agent_id", "metadata"]
49
58
  null_default_fields = []
50
59
 
51
60
  serialized = handler(self)
@@ -9,7 +9,7 @@ from typing import Any, Dict, List, Literal, Optional
9
9
  from typing_extensions import NotRequired, TypedDict
10
10
 
11
11
 
12
- BatchJobOutObject = Literal["batch"]
12
+ BatchJobOutObject = Literal["batch",]
13
13
 
14
14
 
15
15
  class BatchJobOutTypedDict(TypedDict):
@@ -29,6 +29,7 @@ class BatchJobOutTypedDict(TypedDict):
29
29
  agent_id: NotRequired[Nullable[str]]
30
30
  output_file: NotRequired[Nullable[str]]
31
31
  error_file: NotRequired[Nullable[str]]
32
+ outputs: NotRequired[Nullable[List[Dict[str, Any]]]]
32
33
  started_at: NotRequired[Nullable[int]]
33
34
  completed_at: NotRequired[Nullable[int]]
34
35
 
@@ -66,6 +67,8 @@ class BatchJobOut(BaseModel):
66
67
 
67
68
  error_file: OptionalNullable[str] = UNSET
68
69
 
70
+ outputs: OptionalNullable[List[Dict[str, Any]]] = UNSET
71
+
69
72
  started_at: OptionalNullable[int] = UNSET
70
73
 
71
74
  completed_at: OptionalNullable[int] = UNSET
@@ -79,6 +82,7 @@ class BatchJobOut(BaseModel):
79
82
  "agent_id",
80
83
  "output_file",
81
84
  "error_file",
85
+ "outputs",
82
86
  "started_at",
83
87
  "completed_at",
84
88
  ]
@@ -88,6 +92,7 @@ class BatchJobOut(BaseModel):
88
92
  "agent_id",
89
93
  "output_file",
90
94
  "error_file",
95
+ "outputs",
91
96
  "started_at",
92
97
  "completed_at",
93
98
  ]
@@ -7,7 +7,7 @@ from typing import List, Literal, Optional
7
7
  from typing_extensions import NotRequired, TypedDict
8
8
 
9
9
 
10
- BatchJobsOutObject = Literal["list"]
10
+ BatchJobsOutObject = Literal["list",]
11
11
 
12
12
 
13
13
  class BatchJobsOutTypedDict(TypedDict):
@@ -0,0 +1,48 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ from pydantic import model_serializer
6
+ from typing import Any, Dict
7
+ from typing_extensions import NotRequired, TypedDict
8
+
9
+
10
+ class BatchRequestTypedDict(TypedDict):
11
+ body: Dict[str, Any]
12
+ custom_id: NotRequired[Nullable[str]]
13
+
14
+
15
+ class BatchRequest(BaseModel):
16
+ body: Dict[str, Any]
17
+
18
+ custom_id: OptionalNullable[str] = UNSET
19
+
20
+ @model_serializer(mode="wrap")
21
+ def serialize_model(self, handler):
22
+ optional_fields = ["custom_id"]
23
+ nullable_fields = ["custom_id"]
24
+ null_default_fields = []
25
+
26
+ serialized = handler(self)
27
+
28
+ m = {}
29
+
30
+ for n, f in type(self).model_fields.items():
31
+ k = f.alias or n
32
+ val = serialized.get(k)
33
+ serialized.pop(k, None)
34
+
35
+ optional_nullable = k in optional_fields and k in nullable_fields
36
+ is_set = (
37
+ self.__pydantic_fields_set__.intersection({n})
38
+ or k in null_default_fields
39
+ ) # pylint: disable=no-member
40
+
41
+ if val is not None and val != UNSET_SENTINEL:
42
+ m[k] = val
43
+ elif val != UNSET_SENTINEL and (
44
+ not k in optional_fields or (optional_nullable and is_set)
45
+ ):
46
+ m[k] = val
47
+
48
+ return m
@@ -3,14 +3,19 @@
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
5
  from mistralai.types import BaseModel, UnrecognizedStr
6
- from mistralai.utils import validate_open_enum
7
- from pydantic.functional_validators import PlainValidator
8
6
  from typing import Literal, Union
9
- from typing_extensions import Annotated, TypedDict
7
+ from typing_extensions import TypedDict
10
8
 
11
9
 
12
10
  FinishReason = Union[
13
- Literal["stop", "length", "model_length", "error", "tool_calls"], UnrecognizedStr
11
+ Literal[
12
+ "stop",
13
+ "length",
14
+ "model_length",
15
+ "error",
16
+ "tool_calls",
17
+ ],
18
+ UnrecognizedStr,
14
19
  ]
15
20
 
16
21
 
@@ -25,4 +30,4 @@ class ChatCompletionChoice(BaseModel):
25
30
 
26
31
  message: AssistantMessage
27
32
 
28
- finish_reason: Annotated[FinishReason, PlainValidator(validate_open_enum(False))]
33
+ finish_reason: FinishReason
@@ -12,9 +12,8 @@ from .toolchoiceenum import ToolChoiceEnum
12
12
  from .toolmessage import ToolMessage, ToolMessageTypedDict
13
13
  from .usermessage import UserMessage, UserMessageTypedDict
14
14
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
15
- from mistralai.utils import get_discriminator, validate_open_enum
15
+ from mistralai.utils import get_discriminator
16
16
  from pydantic import Discriminator, Tag, model_serializer
17
- from pydantic.functional_validators import PlainValidator
18
17
  from typing import Any, Dict, List, Optional, Union
19
18
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
19
 
@@ -153,9 +152,7 @@ class ChatCompletionRequest(BaseModel):
153
152
  parallel_tool_calls: Optional[bool] = None
154
153
  r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
155
154
 
156
- prompt_mode: Annotated[
157
- OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
158
- ] = UNSET
155
+ prompt_mode: OptionalNullable[MistralPromptMode] = UNSET
159
156
  r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
160
157
 
161
158
  safe_prompt: Optional[bool] = None
@@ -12,9 +12,8 @@ from .toolchoiceenum import ToolChoiceEnum
12
12
  from .toolmessage import ToolMessage, ToolMessageTypedDict
13
13
  from .usermessage import UserMessage, UserMessageTypedDict
14
14
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
15
- from mistralai.utils import get_discriminator, validate_open_enum
15
+ from mistralai.utils import get_discriminator
16
16
  from pydantic import Discriminator, Tag, model_serializer
17
- from pydantic.functional_validators import PlainValidator
18
17
  from typing import Any, Dict, List, Optional, Union
19
18
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
19
 
@@ -155,9 +154,7 @@ class ChatCompletionStreamRequest(BaseModel):
155
154
  parallel_tool_calls: Optional[bool] = None
156
155
  r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
157
156
 
158
- prompt_mode: Annotated[
159
- OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
160
- ] = UNSET
157
+ prompt_mode: OptionalNullable[MistralPromptMode] = UNSET
161
158
  r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
162
159
 
163
160
  safe_prompt: Optional[bool] = None
@@ -1,10 +1,11 @@
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 mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
5
  import pydantic
6
- from typing import List, Union
7
- from typing_extensions import Annotated, TypeAliasType, TypedDict
6
+ from pydantic import model_serializer
7
+ from typing import Any, Dict, List, Union
8
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
8
9
 
9
10
 
10
11
  ClassificationRequestInputsTypedDict = TypeAliasType(
@@ -24,6 +25,7 @@ class ClassificationRequestTypedDict(TypedDict):
24
25
  r"""ID of the model to use."""
25
26
  inputs: ClassificationRequestInputsTypedDict
26
27
  r"""Text to classify."""
28
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
27
29
 
28
30
 
29
31
  class ClassificationRequest(BaseModel):
@@ -32,3 +34,35 @@ class ClassificationRequest(BaseModel):
32
34
 
33
35
  inputs: Annotated[ClassificationRequestInputs, pydantic.Field(alias="input")]
34
36
  r"""Text to classify."""
37
+
38
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
39
+
40
+ @model_serializer(mode="wrap")
41
+ def serialize_model(self, handler):
42
+ optional_fields = ["metadata"]
43
+ nullable_fields = ["metadata"]
44
+ null_default_fields = []
45
+
46
+ serialized = handler(self)
47
+
48
+ m = {}
49
+
50
+ for n, f in type(self).model_fields.items():
51
+ k = f.alias or n
52
+ val = serialized.get(k)
53
+ serialized.pop(k, None)
54
+
55
+ optional_nullable = k in optional_fields and k in nullable_fields
56
+ is_set = (
57
+ self.__pydantic_fields_set__.intersection({n})
58
+ or k in null_default_fields
59
+ ) # pylint: disable=no-member
60
+
61
+ if val is not None and val != UNSET_SENTINEL:
62
+ m[k] = val
63
+ elif val != UNSET_SENTINEL and (
64
+ not k in optional_fields or (optional_nullable and is_set)
65
+ ):
66
+ m[k] = val
67
+
68
+ return m
@@ -29,7 +29,9 @@ ClassifierDetailedJobOutStatus = Literal[
29
29
  "CANCELLATION_REQUESTED",
30
30
  ]
31
31
 
32
- ClassifierDetailedJobOutObject = Literal["job"]
32
+
33
+ ClassifierDetailedJobOutObject = Literal["job",]
34
+
33
35
 
34
36
  ClassifierDetailedJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
35
37
 
@@ -37,7 +39,7 @@ ClassifierDetailedJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
37
39
  ClassifierDetailedJobOutIntegrations = WandbIntegrationOut
38
40
 
39
41
 
40
- ClassifierDetailedJobOutJobType = Literal["classifier"]
42
+ ClassifierDetailedJobOutJobType = Literal["classifier",]
41
43
 
42
44
 
43
45
  class ClassifierDetailedJobOutTypedDict(TypedDict):
@@ -12,9 +12,10 @@ from typing import List, Literal, Optional
12
12
  from typing_extensions import NotRequired, TypedDict
13
13
 
14
14
 
15
- ClassifierFTModelOutObject = Literal["model"]
15
+ ClassifierFTModelOutObject = Literal["model",]
16
16
 
17
- ClassifierFTModelOutModelType = Literal["classifier"]
17
+
18
+ ClassifierFTModelOutModelType = Literal["classifier",]
18
19
 
19
20
 
20
21
  class ClassifierFTModelOutTypedDict(TypedDict):
@@ -27,16 +27,18 @@ ClassifierJobOutStatus = Literal[
27
27
  ]
28
28
  r"""The current status of the fine-tuning job."""
29
29
 
30
- ClassifierJobOutObject = Literal["job"]
30
+
31
+ ClassifierJobOutObject = Literal["job",]
31
32
  r"""The object type of the fine-tuning job."""
32
33
 
34
+
33
35
  ClassifierJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
34
36
 
35
37
 
36
38
  ClassifierJobOutIntegrations = WandbIntegrationOut
37
39
 
38
40
 
39
- ClassifierJobOutJobType = Literal["classifier"]
41
+ ClassifierJobOutJobType = Literal["classifier",]
40
42
  r"""The type of job (`FT` for fine-tuning)."""
41
43
 
42
44
 
@@ -6,7 +6,7 @@ from typing import Literal, Optional
6
6
  from typing_extensions import NotRequired, TypedDict
7
7
 
8
8
 
9
- CodeInterpreterToolType = Literal["code_interpreter"]
9
+ CodeInterpreterToolType = Literal["code_interpreter",]
10
10
 
11
11
 
12
12
  class CodeInterpreterToolTypedDict(TypedDict):
@@ -29,7 +29,9 @@ CompletionDetailedJobOutStatus = Literal[
29
29
  "CANCELLATION_REQUESTED",
30
30
  ]
31
31
 
32
- CompletionDetailedJobOutObject = Literal["job"]
32
+
33
+ CompletionDetailedJobOutObject = Literal["job",]
34
+
33
35
 
34
36
  CompletionDetailedJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
35
37
 
@@ -37,7 +39,8 @@ CompletionDetailedJobOutIntegrationsTypedDict = WandbIntegrationOutTypedDict
37
39
  CompletionDetailedJobOutIntegrations = WandbIntegrationOut
38
40
 
39
41
 
40
- CompletionDetailedJobOutJobType = Literal["completion"]
42
+ CompletionDetailedJobOutJobType = Literal["completion",]
43
+
41
44
 
42
45
  CompletionDetailedJobOutRepositoriesTypedDict = GithubRepositoryOutTypedDict
43
46
 
@@ -11,9 +11,10 @@ from typing import List, Literal, Optional
11
11
  from typing_extensions import NotRequired, TypedDict
12
12
 
13
13
 
14
- CompletionFTModelOutObject = Literal["model"]
14
+ CompletionFTModelOutObject = Literal["model",]
15
15
 
16
- ModelType = Literal["completion"]
16
+
17
+ ModelType = Literal["completion",]
17
18
 
18
19
 
19
20
  class CompletionFTModelOutTypedDict(TypedDict):
@@ -28,18 +28,21 @@ Status = Literal[
28
28
  ]
29
29
  r"""The current status of the fine-tuning job."""
30
30
 
31
- CompletionJobOutObject = Literal["job"]
31
+
32
+ CompletionJobOutObject = Literal["job",]
32
33
  r"""The object type of the fine-tuning job."""
33
34
 
35
+
34
36
  IntegrationsTypedDict = WandbIntegrationOutTypedDict
35
37
 
36
38
 
37
39
  Integrations = WandbIntegrationOut
38
40
 
39
41
 
40
- JobType = Literal["completion"]
42
+ JobType = Literal["completion",]
41
43
  r"""The type of job (`FT` for fine-tuning)."""
42
44
 
45
+
43
46
  RepositoriesTypedDict = GithubRepositoryOutTypedDict
44
47
 
45
48
 
@@ -3,15 +3,19 @@
3
3
  from __future__ import annotations
4
4
  from .deltamessage import DeltaMessage, DeltaMessageTypedDict
5
5
  from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
6
- from mistralai.utils import validate_open_enum
7
6
  from pydantic import model_serializer
8
- from pydantic.functional_validators import PlainValidator
9
7
  from typing import Literal, Union
10
- from typing_extensions import Annotated, TypedDict
8
+ from typing_extensions import TypedDict
11
9
 
12
10
 
13
11
  CompletionResponseStreamChoiceFinishReason = Union[
14
- Literal["stop", "length", "error", "tool_calls"], UnrecognizedStr
12
+ Literal[
13
+ "stop",
14
+ "length",
15
+ "error",
16
+ "tool_calls",
17
+ ],
18
+ UnrecognizedStr,
15
19
  ]
16
20
 
17
21
 
@@ -26,10 +30,7 @@ class CompletionResponseStreamChoice(BaseModel):
26
30
 
27
31
  delta: DeltaMessage
28
32
 
29
- finish_reason: Annotated[
30
- Nullable[CompletionResponseStreamChoiceFinishReason],
31
- PlainValidator(validate_open_enum(False)),
32
- ]
33
+ finish_reason: Nullable[CompletionResponseStreamChoiceFinishReason]
33
34
 
34
35
  @model_serializer(mode="wrap")
35
36
  def serialize_model(self, handler):
@@ -8,7 +8,10 @@ from typing import Literal, Optional
8
8
  from typing_extensions import NotRequired, TypedDict
9
9
 
10
10
 
11
- ConversationAppendRequestHandoffExecution = Literal["client", "server"]
11
+ ConversationAppendRequestHandoffExecution = Literal[
12
+ "client",
13
+ "server",
14
+ ]
12
15
 
13
16
 
14
17
  class ConversationAppendRequestTypedDict(TypedDict):
@@ -8,7 +8,10 @@ from typing import Literal, Optional
8
8
  from typing_extensions import NotRequired, TypedDict
9
9
 
10
10
 
11
- ConversationAppendStreamRequestHandoffExecution = Literal["client", "server"]
11
+ ConversationAppendStreamRequestHandoffExecution = Literal[
12
+ "client",
13
+ "server",
14
+ ]
12
15
 
13
16
 
14
17
  class ConversationAppendStreamRequestTypedDict(TypedDict):
@@ -12,7 +12,8 @@ from typing import List, Literal, Optional, Union
12
12
  from typing_extensions import NotRequired, TypeAliasType, TypedDict
13
13
 
14
14
 
15
- ConversationHistoryObject = Literal["conversation.history"]
15
+ ConversationHistoryObject = Literal["conversation.history",]
16
+
16
17
 
17
18
  EntriesTypedDict = TypeAliasType(
18
19
  "EntriesTypedDict",
@@ -7,7 +7,7 @@ from typing import List, Literal, Optional
7
7
  from typing_extensions import NotRequired, TypedDict
8
8
 
9
9
 
10
- ConversationMessagesObject = Literal["conversation.messages"]
10
+ ConversationMessagesObject = Literal["conversation.messages",]
11
11
 
12
12
 
13
13
  class ConversationMessagesTypedDict(TypedDict):
@@ -16,7 +16,11 @@ from typing import Any, Dict, List, Literal, Optional, Union
16
16
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
19
- HandoffExecution = Literal["client", "server"]
19
+ HandoffExecution = Literal[
20
+ "client",
21
+ "server",
22
+ ]
23
+
20
24
 
21
25
  ToolsTypedDict = TypeAliasType(
22
26
  "ToolsTypedDict",
@@ -11,7 +11,8 @@ from typing import List, Literal, Optional, Union
11
11
  from typing_extensions import NotRequired, TypeAliasType, TypedDict
12
12
 
13
13
 
14
- ConversationResponseObject = Literal["conversation.response"]
14
+ ConversationResponseObject = Literal["conversation.response",]
15
+
15
16
 
16
17
  OutputsTypedDict = TypeAliasType(
17
18
  "OutputsTypedDict",
@@ -9,7 +9,10 @@ from typing import Any, Dict, Literal, Optional
9
9
  from typing_extensions import NotRequired, TypedDict
10
10
 
11
11
 
12
- ConversationRestartRequestHandoffExecution = Literal["client", "server"]
12
+ ConversationRestartRequestHandoffExecution = Literal[
13
+ "client",
14
+ "server",
15
+ ]
13
16
 
14
17
 
15
18
  class ConversationRestartRequestTypedDict(TypedDict):
@@ -9,7 +9,10 @@ from typing import Any, Dict, Literal, Optional
9
9
  from typing_extensions import NotRequired, TypedDict
10
10
 
11
11
 
12
- ConversationRestartStreamRequestHandoffExecution = Literal["client", "server"]
12
+ ConversationRestartStreamRequestHandoffExecution = Literal[
13
+ "client",
14
+ "server",
15
+ ]
13
16
 
14
17
 
15
18
  class ConversationRestartStreamRequestTypedDict(TypedDict):
@@ -16,7 +16,11 @@ from typing import Any, Dict, List, Literal, Optional, Union
16
16
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
19
- ConversationStreamRequestHandoffExecution = Literal["client", "server"]
19
+ ConversationStreamRequestHandoffExecution = Literal[
20
+ "client",
21
+ "server",
22
+ ]
23
+
20
24
 
21
25
  ConversationStreamRequestToolsTypedDict = TypeAliasType(
22
26
  "ConversationStreamRequestToolsTypedDict",
@@ -6,7 +6,7 @@ from typing import List, Literal, Optional
6
6
  from typing_extensions import NotRequired, TypedDict
7
7
 
8
8
 
9
- DocumentLibraryToolType = Literal["document_library"]
9
+ DocumentLibraryToolType = Literal["document_library",]
10
10
 
11
11
 
12
12
  class DocumentLibraryToolTypedDict(TypedDict):
@@ -7,7 +7,7 @@ from typing import Literal, Optional
7
7
  from typing_extensions import NotRequired, TypedDict
8
8
 
9
9
 
10
- DocumentURLChunkType = Literal["document_url"]
10
+ DocumentURLChunkType = Literal["document_url",]
11
11
 
12
12
 
13
13
  class DocumentURLChunkTypedDict(TypedDict):
@@ -4,4 +4,10 @@ from __future__ import annotations
4
4
  from typing import Literal
5
5
 
6
6
 
7
- EmbeddingDtype = Literal["float", "int8", "uint8", "binary", "ubinary"]
7
+ EmbeddingDtype = Literal[
8
+ "float",
9
+ "int8",
10
+ "uint8",
11
+ "binary",
12
+ "ubinary",
13
+ ]