mistralai 1.9.6__py3-none-any.whl → 1.9.8__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 (41) hide show
  1. mistralai/_version.py +2 -2
  2. mistralai/models/messageinputcontentchunks.py +3 -1
  3. {mistralai-1.9.6.dist-info → mistralai-1.9.8.dist-info}/METADATA +1 -1
  4. {mistralai-1.9.6.dist-info → mistralai-1.9.8.dist-info}/RECORD +41 -30
  5. mistralai_azure/_hooks/types.py +7 -0
  6. mistralai_azure/_version.py +3 -3
  7. mistralai_azure/basesdk.py +12 -20
  8. mistralai_azure/chat.py +16 -0
  9. mistralai_azure/httpclient.py +6 -16
  10. mistralai_azure/models/__init__.py +298 -103
  11. mistralai_azure/models/assistantmessage.py +1 -1
  12. mistralai_azure/models/chatcompletionrequest.py +20 -3
  13. mistralai_azure/models/chatcompletionresponse.py +6 -6
  14. mistralai_azure/models/chatcompletionstreamrequest.py +20 -3
  15. mistralai_azure/models/completionresponsestreamchoice.py +1 -1
  16. mistralai_azure/models/deltamessage.py +1 -1
  17. mistralai_azure/models/documenturlchunk.py +62 -0
  18. mistralai_azure/models/filechunk.py +23 -0
  19. mistralai_azure/models/imageurl.py +1 -1
  20. mistralai_azure/models/jsonschema.py +1 -1
  21. mistralai_azure/models/mistralpromptmode.py +8 -0
  22. mistralai_azure/models/ocrimageobject.py +89 -0
  23. mistralai_azure/models/ocrpagedimensions.py +25 -0
  24. mistralai_azure/models/ocrpageobject.py +64 -0
  25. mistralai_azure/models/ocrrequest.py +120 -0
  26. mistralai_azure/models/ocrresponse.py +68 -0
  27. mistralai_azure/models/ocrusageinfo.py +57 -0
  28. mistralai_azure/models/responseformat.py +1 -1
  29. mistralai_azure/models/toolmessage.py +1 -1
  30. mistralai_azure/models/usageinfo.py +71 -8
  31. mistralai_azure/models/usermessage.py +1 -1
  32. mistralai_azure/ocr.py +271 -0
  33. mistralai_azure/sdkconfiguration.py +0 -7
  34. mistralai_azure/types/basemodel.py +3 -3
  35. mistralai_azure/utils/__init__.py +130 -45
  36. mistralai_azure/utils/datetimes.py +23 -0
  37. mistralai_azure/utils/enums.py +67 -27
  38. mistralai_azure/utils/forms.py +49 -28
  39. mistralai_azure/utils/serializers.py +32 -3
  40. {mistralai-1.9.6.dist-info → mistralai-1.9.8.dist-info}/LICENSE +0 -0
  41. {mistralai-1.9.6.dist-info → mistralai-1.9.8.dist-info}/WHEEL +0 -0
@@ -1,109 +1,134 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from .assistantmessage import (
4
- AssistantMessage,
5
- AssistantMessageContent,
6
- AssistantMessageContentTypedDict,
7
- AssistantMessageRole,
8
- AssistantMessageTypedDict,
9
- )
10
- from .chatcompletionchoice import (
11
- ChatCompletionChoice,
12
- ChatCompletionChoiceFinishReason,
13
- ChatCompletionChoiceTypedDict,
14
- )
15
- from .chatcompletionrequest import (
16
- ChatCompletionRequest,
17
- ChatCompletionRequestMessages,
18
- ChatCompletionRequestMessagesTypedDict,
19
- ChatCompletionRequestStop,
20
- ChatCompletionRequestStopTypedDict,
21
- ChatCompletionRequestToolChoice,
22
- ChatCompletionRequestToolChoiceTypedDict,
23
- ChatCompletionRequestTypedDict,
24
- )
25
- from .chatcompletionresponse import (
26
- ChatCompletionResponse,
27
- ChatCompletionResponseTypedDict,
28
- )
29
- from .chatcompletionstreamrequest import (
30
- ChatCompletionStreamRequest,
31
- ChatCompletionStreamRequestToolChoice,
32
- ChatCompletionStreamRequestToolChoiceTypedDict,
33
- ChatCompletionStreamRequestTypedDict,
34
- Messages,
35
- MessagesTypedDict,
36
- Stop,
37
- StopTypedDict,
38
- )
39
- from .completionchunk import CompletionChunk, CompletionChunkTypedDict
40
- from .completionevent import CompletionEvent, CompletionEventTypedDict
41
- from .completionresponsestreamchoice import (
42
- CompletionResponseStreamChoice,
43
- CompletionResponseStreamChoiceTypedDict,
44
- FinishReason,
45
- )
46
- from .contentchunk import ContentChunk, ContentChunkTypedDict
47
- from .deltamessage import Content, ContentTypedDict, DeltaMessage, DeltaMessageTypedDict
48
- from .function import Function, FunctionTypedDict
49
- from .functioncall import (
50
- Arguments,
51
- ArgumentsTypedDict,
52
- FunctionCall,
53
- FunctionCallTypedDict,
54
- )
55
- from .functionname import FunctionName, FunctionNameTypedDict
56
- from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
57
- from .imageurl import ImageURL, ImageURLTypedDict
58
- from .imageurlchunk import (
59
- ImageURLChunk,
60
- ImageURLChunkImageURL,
61
- ImageURLChunkImageURLTypedDict,
62
- ImageURLChunkType,
63
- ImageURLChunkTypedDict,
64
- )
65
- from .jsonschema import JSONSchema, JSONSchemaTypedDict
66
- from .prediction import Prediction, PredictionTypedDict
67
- from .referencechunk import ReferenceChunk, ReferenceChunkType, ReferenceChunkTypedDict
68
- from .responseformat import ResponseFormat, ResponseFormatTypedDict
69
- from .responseformats import ResponseFormats
70
- from .sdkerror import SDKError
71
- from .security import Security, SecurityTypedDict
72
- from .systemmessage import (
73
- Role,
74
- SystemMessage,
75
- SystemMessageContent,
76
- SystemMessageContentTypedDict,
77
- SystemMessageTypedDict,
78
- )
79
- from .textchunk import TextChunk, TextChunkTypedDict, Type
80
- from .tool import Tool, ToolTypedDict
81
- from .toolcall import ToolCall, ToolCallTypedDict
82
- from .toolchoice import ToolChoice, ToolChoiceTypedDict
83
- from .toolchoiceenum import ToolChoiceEnum
84
- from .toolmessage import (
85
- ToolMessage,
86
- ToolMessageContent,
87
- ToolMessageContentTypedDict,
88
- ToolMessageRole,
89
- ToolMessageTypedDict,
90
- )
91
- from .tooltypes import ToolTypes
92
- from .usageinfo import UsageInfo, UsageInfoTypedDict
93
- from .usermessage import (
94
- UserMessage,
95
- UserMessageContent,
96
- UserMessageContentTypedDict,
97
- UserMessageRole,
98
- UserMessageTypedDict,
99
- )
100
- from .validationerror import (
101
- Loc,
102
- LocTypedDict,
103
- ValidationError,
104
- ValidationErrorTypedDict,
105
- )
3
+ from typing import TYPE_CHECKING
4
+ from importlib import import_module
106
5
 
6
+ if TYPE_CHECKING:
7
+ from .assistantmessage import (
8
+ AssistantMessage,
9
+ AssistantMessageContent,
10
+ AssistantMessageContentTypedDict,
11
+ AssistantMessageRole,
12
+ AssistantMessageTypedDict,
13
+ )
14
+ from .chatcompletionchoice import (
15
+ ChatCompletionChoice,
16
+ ChatCompletionChoiceFinishReason,
17
+ ChatCompletionChoiceTypedDict,
18
+ )
19
+ from .chatcompletionrequest import (
20
+ ChatCompletionRequest,
21
+ ChatCompletionRequestMessages,
22
+ ChatCompletionRequestMessagesTypedDict,
23
+ ChatCompletionRequestStop,
24
+ ChatCompletionRequestStopTypedDict,
25
+ ChatCompletionRequestToolChoice,
26
+ ChatCompletionRequestToolChoiceTypedDict,
27
+ ChatCompletionRequestTypedDict,
28
+ )
29
+ from .chatcompletionresponse import (
30
+ ChatCompletionResponse,
31
+ ChatCompletionResponseTypedDict,
32
+ )
33
+ from .chatcompletionstreamrequest import (
34
+ ChatCompletionStreamRequest,
35
+ ChatCompletionStreamRequestToolChoice,
36
+ ChatCompletionStreamRequestToolChoiceTypedDict,
37
+ ChatCompletionStreamRequestTypedDict,
38
+ Messages,
39
+ MessagesTypedDict,
40
+ Stop,
41
+ StopTypedDict,
42
+ )
43
+ from .completionchunk import CompletionChunk, CompletionChunkTypedDict
44
+ from .completionevent import CompletionEvent, CompletionEventTypedDict
45
+ from .completionresponsestreamchoice import (
46
+ CompletionResponseStreamChoice,
47
+ CompletionResponseStreamChoiceTypedDict,
48
+ FinishReason,
49
+ )
50
+ from .contentchunk import ContentChunk, ContentChunkTypedDict
51
+ from .deltamessage import (
52
+ Content,
53
+ ContentTypedDict,
54
+ DeltaMessage,
55
+ DeltaMessageTypedDict,
56
+ )
57
+ from .documenturlchunk import (
58
+ DocumentURLChunk,
59
+ DocumentURLChunkType,
60
+ DocumentURLChunkTypedDict,
61
+ )
62
+ from .filechunk import FileChunk, FileChunkTypedDict
63
+ from .function import Function, FunctionTypedDict
64
+ from .functioncall import (
65
+ Arguments,
66
+ ArgumentsTypedDict,
67
+ FunctionCall,
68
+ FunctionCallTypedDict,
69
+ )
70
+ from .functionname import FunctionName, FunctionNameTypedDict
71
+ from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
72
+ from .imageurl import ImageURL, ImageURLTypedDict
73
+ from .imageurlchunk import (
74
+ ImageURLChunk,
75
+ ImageURLChunkImageURL,
76
+ ImageURLChunkImageURLTypedDict,
77
+ ImageURLChunkType,
78
+ ImageURLChunkTypedDict,
79
+ )
80
+ from .jsonschema import JSONSchema, JSONSchemaTypedDict
81
+ from .mistralpromptmode import MistralPromptMode
82
+ from .ocrimageobject import OCRImageObject, OCRImageObjectTypedDict
83
+ from .ocrpagedimensions import OCRPageDimensions, OCRPageDimensionsTypedDict
84
+ from .ocrpageobject import OCRPageObject, OCRPageObjectTypedDict
85
+ from .ocrrequest import Document, DocumentTypedDict, OCRRequest, OCRRequestTypedDict
86
+ from .ocrresponse import OCRResponse, OCRResponseTypedDict
87
+ from .ocrusageinfo import OCRUsageInfo, OCRUsageInfoTypedDict
88
+ from .prediction import Prediction, PredictionTypedDict
89
+ from .referencechunk import (
90
+ ReferenceChunk,
91
+ ReferenceChunkType,
92
+ ReferenceChunkTypedDict,
93
+ )
94
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
95
+ from .responseformats import ResponseFormats
96
+ from .sdkerror import SDKError
97
+ from .security import Security, SecurityTypedDict
98
+ from .systemmessage import (
99
+ Role,
100
+ SystemMessage,
101
+ SystemMessageContent,
102
+ SystemMessageContentTypedDict,
103
+ SystemMessageTypedDict,
104
+ )
105
+ from .textchunk import TextChunk, TextChunkTypedDict, Type
106
+ from .tool import Tool, ToolTypedDict
107
+ from .toolcall import ToolCall, ToolCallTypedDict
108
+ from .toolchoice import ToolChoice, ToolChoiceTypedDict
109
+ from .toolchoiceenum import ToolChoiceEnum
110
+ from .toolmessage import (
111
+ ToolMessage,
112
+ ToolMessageContent,
113
+ ToolMessageContentTypedDict,
114
+ ToolMessageRole,
115
+ ToolMessageTypedDict,
116
+ )
117
+ from .tooltypes import ToolTypes
118
+ from .usageinfo import UsageInfo, UsageInfoTypedDict
119
+ from .usermessage import (
120
+ UserMessage,
121
+ UserMessageContent,
122
+ UserMessageContentTypedDict,
123
+ UserMessageRole,
124
+ UserMessageTypedDict,
125
+ )
126
+ from .validationerror import (
127
+ Loc,
128
+ LocTypedDict,
129
+ ValidationError,
130
+ ValidationErrorTypedDict,
131
+ )
107
132
 
108
133
  __all__ = [
109
134
  "Arguments",
@@ -142,6 +167,13 @@ __all__ = [
142
167
  "ContentTypedDict",
143
168
  "DeltaMessage",
144
169
  "DeltaMessageTypedDict",
170
+ "Document",
171
+ "DocumentTypedDict",
172
+ "DocumentURLChunk",
173
+ "DocumentURLChunkType",
174
+ "DocumentURLChunkTypedDict",
175
+ "FileChunk",
176
+ "FileChunkTypedDict",
145
177
  "FinishReason",
146
178
  "Function",
147
179
  "FunctionCall",
@@ -164,6 +196,19 @@ __all__ = [
164
196
  "LocTypedDict",
165
197
  "Messages",
166
198
  "MessagesTypedDict",
199
+ "MistralPromptMode",
200
+ "OCRImageObject",
201
+ "OCRImageObjectTypedDict",
202
+ "OCRPageDimensions",
203
+ "OCRPageDimensionsTypedDict",
204
+ "OCRPageObject",
205
+ "OCRPageObjectTypedDict",
206
+ "OCRRequest",
207
+ "OCRRequestTypedDict",
208
+ "OCRResponse",
209
+ "OCRResponseTypedDict",
210
+ "OCRUsageInfo",
211
+ "OCRUsageInfoTypedDict",
167
212
  "Prediction",
168
213
  "PredictionTypedDict",
169
214
  "ReferenceChunk",
@@ -208,3 +253,153 @@ __all__ = [
208
253
  "ValidationError",
209
254
  "ValidationErrorTypedDict",
210
255
  ]
256
+
257
+ _dynamic_imports: dict[str, str] = {
258
+ "AssistantMessage": ".assistantmessage",
259
+ "AssistantMessageContent": ".assistantmessage",
260
+ "AssistantMessageContentTypedDict": ".assistantmessage",
261
+ "AssistantMessageRole": ".assistantmessage",
262
+ "AssistantMessageTypedDict": ".assistantmessage",
263
+ "ChatCompletionChoice": ".chatcompletionchoice",
264
+ "ChatCompletionChoiceFinishReason": ".chatcompletionchoice",
265
+ "ChatCompletionChoiceTypedDict": ".chatcompletionchoice",
266
+ "ChatCompletionRequest": ".chatcompletionrequest",
267
+ "ChatCompletionRequestMessages": ".chatcompletionrequest",
268
+ "ChatCompletionRequestMessagesTypedDict": ".chatcompletionrequest",
269
+ "ChatCompletionRequestStop": ".chatcompletionrequest",
270
+ "ChatCompletionRequestStopTypedDict": ".chatcompletionrequest",
271
+ "ChatCompletionRequestToolChoice": ".chatcompletionrequest",
272
+ "ChatCompletionRequestToolChoiceTypedDict": ".chatcompletionrequest",
273
+ "ChatCompletionRequestTypedDict": ".chatcompletionrequest",
274
+ "ChatCompletionResponse": ".chatcompletionresponse",
275
+ "ChatCompletionResponseTypedDict": ".chatcompletionresponse",
276
+ "ChatCompletionStreamRequest": ".chatcompletionstreamrequest",
277
+ "ChatCompletionStreamRequestToolChoice": ".chatcompletionstreamrequest",
278
+ "ChatCompletionStreamRequestToolChoiceTypedDict": ".chatcompletionstreamrequest",
279
+ "ChatCompletionStreamRequestTypedDict": ".chatcompletionstreamrequest",
280
+ "Messages": ".chatcompletionstreamrequest",
281
+ "MessagesTypedDict": ".chatcompletionstreamrequest",
282
+ "Stop": ".chatcompletionstreamrequest",
283
+ "StopTypedDict": ".chatcompletionstreamrequest",
284
+ "CompletionChunk": ".completionchunk",
285
+ "CompletionChunkTypedDict": ".completionchunk",
286
+ "CompletionEvent": ".completionevent",
287
+ "CompletionEventTypedDict": ".completionevent",
288
+ "CompletionResponseStreamChoice": ".completionresponsestreamchoice",
289
+ "CompletionResponseStreamChoiceTypedDict": ".completionresponsestreamchoice",
290
+ "FinishReason": ".completionresponsestreamchoice",
291
+ "ContentChunk": ".contentchunk",
292
+ "ContentChunkTypedDict": ".contentchunk",
293
+ "Content": ".deltamessage",
294
+ "ContentTypedDict": ".deltamessage",
295
+ "DeltaMessage": ".deltamessage",
296
+ "DeltaMessageTypedDict": ".deltamessage",
297
+ "DocumentURLChunk": ".documenturlchunk",
298
+ "DocumentURLChunkType": ".documenturlchunk",
299
+ "DocumentURLChunkTypedDict": ".documenturlchunk",
300
+ "FileChunk": ".filechunk",
301
+ "FileChunkTypedDict": ".filechunk",
302
+ "Function": ".function",
303
+ "FunctionTypedDict": ".function",
304
+ "Arguments": ".functioncall",
305
+ "ArgumentsTypedDict": ".functioncall",
306
+ "FunctionCall": ".functioncall",
307
+ "FunctionCallTypedDict": ".functioncall",
308
+ "FunctionName": ".functionname",
309
+ "FunctionNameTypedDict": ".functionname",
310
+ "HTTPValidationError": ".httpvalidationerror",
311
+ "HTTPValidationErrorData": ".httpvalidationerror",
312
+ "ImageURL": ".imageurl",
313
+ "ImageURLTypedDict": ".imageurl",
314
+ "ImageURLChunk": ".imageurlchunk",
315
+ "ImageURLChunkImageURL": ".imageurlchunk",
316
+ "ImageURLChunkImageURLTypedDict": ".imageurlchunk",
317
+ "ImageURLChunkType": ".imageurlchunk",
318
+ "ImageURLChunkTypedDict": ".imageurlchunk",
319
+ "JSONSchema": ".jsonschema",
320
+ "JSONSchemaTypedDict": ".jsonschema",
321
+ "MistralPromptMode": ".mistralpromptmode",
322
+ "OCRImageObject": ".ocrimageobject",
323
+ "OCRImageObjectTypedDict": ".ocrimageobject",
324
+ "OCRPageDimensions": ".ocrpagedimensions",
325
+ "OCRPageDimensionsTypedDict": ".ocrpagedimensions",
326
+ "OCRPageObject": ".ocrpageobject",
327
+ "OCRPageObjectTypedDict": ".ocrpageobject",
328
+ "Document": ".ocrrequest",
329
+ "DocumentTypedDict": ".ocrrequest",
330
+ "OCRRequest": ".ocrrequest",
331
+ "OCRRequestTypedDict": ".ocrrequest",
332
+ "OCRResponse": ".ocrresponse",
333
+ "OCRResponseTypedDict": ".ocrresponse",
334
+ "OCRUsageInfo": ".ocrusageinfo",
335
+ "OCRUsageInfoTypedDict": ".ocrusageinfo",
336
+ "Prediction": ".prediction",
337
+ "PredictionTypedDict": ".prediction",
338
+ "ReferenceChunk": ".referencechunk",
339
+ "ReferenceChunkType": ".referencechunk",
340
+ "ReferenceChunkTypedDict": ".referencechunk",
341
+ "ResponseFormat": ".responseformat",
342
+ "ResponseFormatTypedDict": ".responseformat",
343
+ "ResponseFormats": ".responseformats",
344
+ "SDKError": ".sdkerror",
345
+ "Security": ".security",
346
+ "SecurityTypedDict": ".security",
347
+ "Role": ".systemmessage",
348
+ "SystemMessage": ".systemmessage",
349
+ "SystemMessageContent": ".systemmessage",
350
+ "SystemMessageContentTypedDict": ".systemmessage",
351
+ "SystemMessageTypedDict": ".systemmessage",
352
+ "TextChunk": ".textchunk",
353
+ "TextChunkTypedDict": ".textchunk",
354
+ "Type": ".textchunk",
355
+ "Tool": ".tool",
356
+ "ToolTypedDict": ".tool",
357
+ "ToolCall": ".toolcall",
358
+ "ToolCallTypedDict": ".toolcall",
359
+ "ToolChoice": ".toolchoice",
360
+ "ToolChoiceTypedDict": ".toolchoice",
361
+ "ToolChoiceEnum": ".toolchoiceenum",
362
+ "ToolMessage": ".toolmessage",
363
+ "ToolMessageContent": ".toolmessage",
364
+ "ToolMessageContentTypedDict": ".toolmessage",
365
+ "ToolMessageRole": ".toolmessage",
366
+ "ToolMessageTypedDict": ".toolmessage",
367
+ "ToolTypes": ".tooltypes",
368
+ "UsageInfo": ".usageinfo",
369
+ "UsageInfoTypedDict": ".usageinfo",
370
+ "UserMessage": ".usermessage",
371
+ "UserMessageContent": ".usermessage",
372
+ "UserMessageContentTypedDict": ".usermessage",
373
+ "UserMessageRole": ".usermessage",
374
+ "UserMessageTypedDict": ".usermessage",
375
+ "Loc": ".validationerror",
376
+ "LocTypedDict": ".validationerror",
377
+ "ValidationError": ".validationerror",
378
+ "ValidationErrorTypedDict": ".validationerror",
379
+ }
380
+
381
+
382
+ def __getattr__(attr_name: str) -> object:
383
+ module_name = _dynamic_imports.get(attr_name)
384
+ if module_name is None:
385
+ raise AttributeError(
386
+ f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
387
+ )
388
+
389
+ try:
390
+ module = import_module(module_name, __package__)
391
+ result = getattr(module, attr_name)
392
+ return result
393
+ except ImportError as e:
394
+ raise ImportError(
395
+ f"Failed to import {attr_name} from {module_name}: {e}"
396
+ ) from e
397
+ except AttributeError as e:
398
+ raise AttributeError(
399
+ f"Failed to get {attr_name} from {module_name}: {e}"
400
+ ) from e
401
+
402
+
403
+ def __dir__():
404
+ lazy_attrs = list(_dynamic_imports.keys())
405
+ return sorted(lazy_attrs)
@@ -56,7 +56,7 @@ class AssistantMessage(BaseModel):
56
56
 
57
57
  m = {}
58
58
 
59
- for n, f in self.model_fields.items():
59
+ for n, f in type(self).model_fields.items():
60
60
  k = f.alias or n
61
61
  val = serialized.get(k)
62
62
  serialized.pop(k, None)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .mistralpromptmode import MistralPromptMode
5
6
  from .prediction import Prediction, PredictionTypedDict
6
7
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
7
8
  from .systemmessage import SystemMessage, SystemMessageTypedDict
@@ -17,8 +18,9 @@ from mistralai_azure.types import (
17
18
  UNSET,
18
19
  UNSET_SENTINEL,
19
20
  )
20
- from mistralai_azure.utils import get_discriminator
21
+ from mistralai_azure.utils import get_discriminator, validate_open_enum
21
22
  from pydantic import Discriminator, Tag, model_serializer
23
+ from pydantic.functional_validators import PlainValidator
22
24
  from typing import List, Optional, Union
23
25
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
24
26
 
@@ -96,6 +98,8 @@ class ChatCompletionRequestTypedDict(TypedDict):
96
98
  r"""Number of completions to return for each request, input tokens are only billed once."""
97
99
  prediction: NotRequired[PredictionTypedDict]
98
100
  parallel_tool_calls: NotRequired[bool]
101
+ prompt_mode: NotRequired[Nullable[MistralPromptMode]]
102
+ r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
99
103
  safe_prompt: NotRequired[bool]
100
104
  r"""Whether to inject a safety prompt before all conversations."""
101
105
 
@@ -144,6 +148,11 @@ class ChatCompletionRequest(BaseModel):
144
148
 
145
149
  parallel_tool_calls: Optional[bool] = None
146
150
 
151
+ prompt_mode: Annotated[
152
+ OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
153
+ ] = UNSET
154
+ r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
155
+
147
156
  safe_prompt: Optional[bool] = None
148
157
  r"""Whether to inject a safety prompt before all conversations."""
149
158
 
@@ -165,16 +174,24 @@ class ChatCompletionRequest(BaseModel):
165
174
  "n",
166
175
  "prediction",
167
176
  "parallel_tool_calls",
177
+ "prompt_mode",
168
178
  "safe_prompt",
169
179
  ]
170
- nullable_fields = ["temperature", "max_tokens", "random_seed", "tools", "n"]
180
+ nullable_fields = [
181
+ "temperature",
182
+ "max_tokens",
183
+ "random_seed",
184
+ "tools",
185
+ "n",
186
+ "prompt_mode",
187
+ ]
171
188
  null_default_fields = []
172
189
 
173
190
  serialized = handler(self)
174
191
 
175
192
  m = {}
176
193
 
177
- for n, f in self.model_fields.items():
194
+ for n, f in type(self).model_fields.items():
178
195
  k = f.alias or n
179
196
  val = serialized.get(k)
180
197
  serialized.pop(k, None)
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
  from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
5
5
  from .usageinfo import UsageInfo, UsageInfoTypedDict
6
6
  from mistralai_azure.types import BaseModel
7
- from typing import List, Optional
8
- from typing_extensions import NotRequired, TypedDict
7
+ from typing import List
8
+ from typing_extensions import TypedDict
9
9
 
10
10
 
11
11
  class ChatCompletionResponseTypedDict(TypedDict):
@@ -13,8 +13,8 @@ class ChatCompletionResponseTypedDict(TypedDict):
13
13
  object: str
14
14
  model: str
15
15
  usage: UsageInfoTypedDict
16
- created: NotRequired[int]
17
- choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
16
+ created: int
17
+ choices: List[ChatCompletionChoiceTypedDict]
18
18
 
19
19
 
20
20
  class ChatCompletionResponse(BaseModel):
@@ -26,6 +26,6 @@ class ChatCompletionResponse(BaseModel):
26
26
 
27
27
  usage: UsageInfo
28
28
 
29
- created: Optional[int] = None
29
+ created: int
30
30
 
31
- choices: Optional[List[ChatCompletionChoice]] = None
31
+ choices: List[ChatCompletionChoice]
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .mistralpromptmode import MistralPromptMode
5
6
  from .prediction import Prediction, PredictionTypedDict
6
7
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
7
8
  from .systemmessage import SystemMessage, SystemMessageTypedDict
@@ -17,8 +18,9 @@ from mistralai_azure.types import (
17
18
  UNSET,
18
19
  UNSET_SENTINEL,
19
20
  )
20
- from mistralai_azure.utils import get_discriminator
21
+ from mistralai_azure.utils import get_discriminator, validate_open_enum
21
22
  from pydantic import Discriminator, Tag, model_serializer
23
+ from pydantic.functional_validators import PlainValidator
22
24
  from typing import List, Optional, Union
23
25
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
24
26
 
@@ -91,6 +93,8 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
91
93
  r"""Number of completions to return for each request, input tokens are only billed once."""
92
94
  prediction: NotRequired[PredictionTypedDict]
93
95
  parallel_tool_calls: NotRequired[bool]
96
+ prompt_mode: NotRequired[Nullable[MistralPromptMode]]
97
+ r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
94
98
  safe_prompt: NotRequired[bool]
95
99
  r"""Whether to inject a safety prompt before all conversations."""
96
100
 
@@ -138,6 +142,11 @@ class ChatCompletionStreamRequest(BaseModel):
138
142
 
139
143
  parallel_tool_calls: Optional[bool] = None
140
144
 
145
+ prompt_mode: Annotated[
146
+ OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
147
+ ] = UNSET
148
+ r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
149
+
141
150
  safe_prompt: Optional[bool] = None
142
151
  r"""Whether to inject a safety prompt before all conversations."""
143
152
 
@@ -159,16 +168,24 @@ class ChatCompletionStreamRequest(BaseModel):
159
168
  "n",
160
169
  "prediction",
161
170
  "parallel_tool_calls",
171
+ "prompt_mode",
162
172
  "safe_prompt",
163
173
  ]
164
- nullable_fields = ["temperature", "max_tokens", "random_seed", "tools", "n"]
174
+ nullable_fields = [
175
+ "temperature",
176
+ "max_tokens",
177
+ "random_seed",
178
+ "tools",
179
+ "n",
180
+ "prompt_mode",
181
+ ]
165
182
  null_default_fields = []
166
183
 
167
184
  serialized = handler(self)
168
185
 
169
186
  m = {}
170
187
 
171
- for n, f in self.model_fields.items():
188
+ for n, f in type(self).model_fields.items():
172
189
  k = f.alias or n
173
190
  val = serialized.get(k)
174
191
  serialized.pop(k, None)
@@ -38,7 +38,7 @@ class CompletionResponseStreamChoice(BaseModel):
38
38
 
39
39
  m = {}
40
40
 
41
- for n, f in self.model_fields.items():
41
+ for n, f in type(self).model_fields.items():
42
42
  k = f.alias or n
43
43
  val = serialized.get(k)
44
44
  serialized.pop(k, None)
@@ -46,7 +46,7 @@ class DeltaMessage(BaseModel):
46
46
 
47
47
  m = {}
48
48
 
49
- for n, f in self.model_fields.items():
49
+ for n, f in type(self).model_fields.items():
50
50
  k = f.alias or n
51
51
  val = serialized.get(k)
52
52
  serialized.pop(k, None)
@@ -0,0 +1,62 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai_azure.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
11
+ from pydantic import model_serializer
12
+ from typing import Literal, Optional
13
+ from typing_extensions import NotRequired, TypedDict
14
+
15
+
16
+ DocumentURLChunkType = Literal["document_url"]
17
+
18
+
19
+ class DocumentURLChunkTypedDict(TypedDict):
20
+ document_url: str
21
+ document_name: NotRequired[Nullable[str]]
22
+ r"""The filename of the document"""
23
+ type: NotRequired[DocumentURLChunkType]
24
+
25
+
26
+ class DocumentURLChunk(BaseModel):
27
+ document_url: str
28
+
29
+ document_name: OptionalNullable[str] = UNSET
30
+ r"""The filename of the document"""
31
+
32
+ type: Optional[DocumentURLChunkType] = "document_url"
33
+
34
+ @model_serializer(mode="wrap")
35
+ def serialize_model(self, handler):
36
+ optional_fields = ["document_name", "type"]
37
+ nullable_fields = ["document_name"]
38
+ null_default_fields = []
39
+
40
+ serialized = handler(self)
41
+
42
+ m = {}
43
+
44
+ for n, f in type(self).model_fields.items():
45
+ k = f.alias or n
46
+ val = serialized.get(k)
47
+ serialized.pop(k, None)
48
+
49
+ optional_nullable = k in optional_fields and k in nullable_fields
50
+ is_set = (
51
+ self.__pydantic_fields_set__.intersection({n})
52
+ or k in null_default_fields
53
+ ) # pylint: disable=no-member
54
+
55
+ if val is not None and val != UNSET_SENTINEL:
56
+ m[k] = val
57
+ elif val != UNSET_SENTINEL and (
58
+ not k in optional_fields or (optional_nullable and is_set)
59
+ ):
60
+ m[k] = val
61
+
62
+ return m