mistralai 1.0.2__py3-none-any.whl → 1.1.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 (199) hide show
  1. mistralai/_hooks/sdkhooks.py +23 -4
  2. mistralai/_hooks/types.py +27 -9
  3. mistralai/agents.py +286 -150
  4. mistralai/basesdk.py +90 -5
  5. mistralai/chat.py +260 -144
  6. mistralai/embeddings.py +73 -53
  7. mistralai/files.py +252 -192
  8. mistralai/fim.py +174 -110
  9. mistralai/fine_tuning.py +3 -2
  10. mistralai/jobs.py +372 -263
  11. mistralai/models/__init__.py +499 -46
  12. mistralai/models/agentscompletionrequest.py +47 -11
  13. mistralai/models/agentscompletionstreamrequest.py +49 -11
  14. mistralai/models/archiveftmodelout.py +6 -2
  15. mistralai/models/assistantmessage.py +11 -4
  16. mistralai/models/{modelcard.py → basemodelcard.py} +37 -14
  17. mistralai/models/chatcompletionchoice.py +4 -2
  18. mistralai/models/chatcompletionrequest.py +57 -11
  19. mistralai/models/chatcompletionresponse.py +6 -2
  20. mistralai/models/chatcompletionstreamrequest.py +59 -11
  21. mistralai/models/checkpointout.py +3 -2
  22. mistralai/models/completionchunk.py +10 -3
  23. mistralai/models/completionevent.py +1 -2
  24. mistralai/models/completionresponsestreamchoice.py +13 -5
  25. mistralai/models/contentchunk.py +13 -10
  26. mistralai/models/delete_model_v1_models_model_id_deleteop.py +4 -3
  27. mistralai/models/deletefileout.py +3 -2
  28. mistralai/models/deletemodelout.py +3 -2
  29. mistralai/models/deltamessage.py +9 -4
  30. mistralai/models/detailedjobout.py +59 -7
  31. mistralai/models/embeddingrequest.py +9 -4
  32. mistralai/models/embeddingresponse.py +5 -2
  33. mistralai/models/embeddingresponsedata.py +3 -2
  34. mistralai/models/eventout.py +9 -4
  35. mistralai/models/files_api_routes_delete_fileop.py +4 -3
  36. mistralai/models/files_api_routes_retrieve_fileop.py +4 -3
  37. mistralai/models/files_api_routes_upload_fileop.py +27 -8
  38. mistralai/models/fileschema.py +26 -5
  39. mistralai/models/fimcompletionrequest.py +26 -5
  40. mistralai/models/fimcompletionresponse.py +6 -2
  41. mistralai/models/fimcompletionstreamrequest.py +26 -5
  42. mistralai/models/finetuneablemodel.py +7 -1
  43. mistralai/models/ftmodelcapabilitiesout.py +4 -2
  44. mistralai/models/ftmodelcard.py +103 -0
  45. mistralai/models/ftmodelout.py +32 -6
  46. mistralai/models/function.py +3 -2
  47. mistralai/models/functioncall.py +2 -2
  48. mistralai/models/functionname.py +17 -0
  49. mistralai/models/githubrepositoryin.py +15 -4
  50. mistralai/models/githubrepositoryout.py +15 -4
  51. mistralai/models/httpvalidationerror.py +2 -2
  52. mistralai/models/imageurl.py +48 -0
  53. mistralai/models/imageurlchunk.py +32 -0
  54. mistralai/models/jobin.py +22 -5
  55. mistralai/models/jobmetadataout.py +31 -6
  56. mistralai/models/jobout.py +55 -7
  57. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +4 -3
  58. mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +4 -3
  59. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
  60. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +4 -3
  61. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +83 -16
  62. mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +4 -3
  63. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +4 -3
  64. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +9 -4
  65. mistralai/models/jobsout.py +6 -2
  66. mistralai/models/legacyjobmetadataout.py +45 -6
  67. mistralai/models/listfilesout.py +2 -2
  68. mistralai/models/metricout.py +11 -6
  69. mistralai/models/modelcapabilities.py +7 -2
  70. mistralai/models/modellist.py +21 -7
  71. mistralai/models/responseformat.py +6 -7
  72. mistralai/models/responseformats.py +8 -0
  73. mistralai/models/retrieve_model_v1_models_model_id_getop.py +24 -5
  74. mistralai/models/retrievefileout.py +26 -5
  75. mistralai/models/security.py +12 -3
  76. mistralai/models/systemmessage.py +6 -5
  77. mistralai/models/textchunk.py +9 -4
  78. mistralai/models/tool.py +9 -8
  79. mistralai/models/toolcall.py +9 -7
  80. mistralai/models/toolchoice.py +29 -0
  81. mistralai/models/toolchoiceenum.py +7 -0
  82. mistralai/models/toolmessage.py +11 -4
  83. mistralai/models/tooltypes.py +8 -0
  84. mistralai/models/trainingfile.py +2 -2
  85. mistralai/models/trainingparameters.py +27 -6
  86. mistralai/models/trainingparametersin.py +29 -8
  87. mistralai/models/unarchiveftmodelout.py +6 -2
  88. mistralai/models/updateftmodelin.py +8 -4
  89. mistralai/models/uploadfileout.py +26 -5
  90. mistralai/models/usageinfo.py +3 -2
  91. mistralai/models/usermessage.py +6 -5
  92. mistralai/models/validationerror.py +3 -2
  93. mistralai/models/wandbintegration.py +14 -4
  94. mistralai/models/wandbintegrationout.py +13 -4
  95. mistralai/models_.py +392 -294
  96. mistralai/sdk.py +24 -19
  97. mistralai/sdkconfiguration.py +6 -8
  98. mistralai/utils/__init__.py +6 -1
  99. mistralai/utils/logger.py +4 -1
  100. mistralai/utils/retries.py +2 -1
  101. mistralai/utils/security.py +13 -6
  102. {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/METADATA +103 -74
  103. mistralai-1.1.0.dist-info/RECORD +254 -0
  104. mistralai_azure/_hooks/sdkhooks.py +23 -4
  105. mistralai_azure/_hooks/types.py +27 -9
  106. mistralai_azure/basesdk.py +91 -6
  107. mistralai_azure/chat.py +252 -144
  108. mistralai_azure/models/__init__.py +157 -15
  109. mistralai_azure/models/assistantmessage.py +18 -5
  110. mistralai_azure/models/chatcompletionchoice.py +7 -3
  111. mistralai_azure/models/chatcompletionrequest.py +65 -12
  112. mistralai_azure/models/chatcompletionresponse.py +6 -2
  113. mistralai_azure/models/chatcompletionstreamrequest.py +67 -12
  114. mistralai_azure/models/completionchunk.py +10 -3
  115. mistralai_azure/models/completionevent.py +1 -2
  116. mistralai_azure/models/completionresponsestreamchoice.py +10 -4
  117. mistralai_azure/models/contentchunk.py +4 -11
  118. mistralai_azure/models/deltamessage.py +16 -5
  119. mistralai_azure/models/function.py +3 -2
  120. mistralai_azure/models/functioncall.py +2 -2
  121. mistralai_azure/models/functionname.py +17 -0
  122. mistralai_azure/models/httpvalidationerror.py +2 -2
  123. mistralai_azure/models/responseformat.py +6 -7
  124. mistralai_azure/models/responseformats.py +8 -0
  125. mistralai_azure/models/security.py +12 -3
  126. mistralai_azure/models/systemmessage.py +6 -5
  127. mistralai_azure/models/textchunk.py +9 -4
  128. mistralai_azure/models/tool.py +9 -8
  129. mistralai_azure/models/toolcall.py +9 -7
  130. mistralai_azure/models/toolchoice.py +29 -0
  131. mistralai_azure/models/toolchoiceenum.py +7 -0
  132. mistralai_azure/models/toolmessage.py +18 -5
  133. mistralai_azure/models/tooltypes.py +8 -0
  134. mistralai_azure/models/usageinfo.py +3 -2
  135. mistralai_azure/models/usermessage.py +6 -5
  136. mistralai_azure/models/validationerror.py +3 -2
  137. mistralai_azure/sdkconfiguration.py +6 -8
  138. mistralai_azure/utils/__init__.py +8 -3
  139. mistralai_azure/utils/forms.py +10 -9
  140. mistralai_azure/utils/headers.py +8 -8
  141. mistralai_azure/utils/logger.py +6 -0
  142. mistralai_azure/utils/queryparams.py +16 -14
  143. mistralai_azure/utils/retries.py +2 -1
  144. mistralai_azure/utils/security.py +12 -6
  145. mistralai_azure/utils/serializers.py +17 -8
  146. mistralai_azure/utils/url.py +13 -8
  147. mistralai_azure/utils/values.py +6 -0
  148. mistralai_gcp/_hooks/sdkhooks.py +23 -4
  149. mistralai_gcp/_hooks/types.py +27 -9
  150. mistralai_gcp/basesdk.py +91 -6
  151. mistralai_gcp/chat.py +252 -144
  152. mistralai_gcp/fim.py +166 -110
  153. mistralai_gcp/models/__init__.py +179 -17
  154. mistralai_gcp/models/assistantmessage.py +18 -5
  155. mistralai_gcp/models/chatcompletionchoice.py +7 -3
  156. mistralai_gcp/models/chatcompletionrequest.py +62 -12
  157. mistralai_gcp/models/chatcompletionresponse.py +6 -2
  158. mistralai_gcp/models/chatcompletionstreamrequest.py +64 -12
  159. mistralai_gcp/models/completionchunk.py +10 -3
  160. mistralai_gcp/models/completionevent.py +1 -2
  161. mistralai_gcp/models/completionresponsestreamchoice.py +10 -4
  162. mistralai_gcp/models/contentchunk.py +4 -11
  163. mistralai_gcp/models/deltamessage.py +16 -5
  164. mistralai_gcp/models/fimcompletionrequest.py +33 -6
  165. mistralai_gcp/models/fimcompletionresponse.py +6 -2
  166. mistralai_gcp/models/fimcompletionstreamrequest.py +33 -6
  167. mistralai_gcp/models/function.py +3 -2
  168. mistralai_gcp/models/functioncall.py +2 -2
  169. mistralai_gcp/models/functionname.py +17 -0
  170. mistralai_gcp/models/httpvalidationerror.py +2 -2
  171. mistralai_gcp/models/responseformat.py +6 -7
  172. mistralai_gcp/models/responseformats.py +8 -0
  173. mistralai_gcp/models/security.py +12 -3
  174. mistralai_gcp/models/systemmessage.py +6 -5
  175. mistralai_gcp/models/textchunk.py +9 -4
  176. mistralai_gcp/models/tool.py +9 -8
  177. mistralai_gcp/models/toolcall.py +9 -7
  178. mistralai_gcp/models/toolchoice.py +29 -0
  179. mistralai_gcp/models/toolchoiceenum.py +7 -0
  180. mistralai_gcp/models/toolmessage.py +18 -5
  181. mistralai_gcp/models/tooltypes.py +8 -0
  182. mistralai_gcp/models/usageinfo.py +3 -2
  183. mistralai_gcp/models/usermessage.py +6 -5
  184. mistralai_gcp/models/validationerror.py +3 -2
  185. mistralai_gcp/sdk.py +14 -10
  186. mistralai_gcp/sdkconfiguration.py +6 -8
  187. mistralai_gcp/utils/__init__.py +8 -3
  188. mistralai_gcp/utils/forms.py +10 -9
  189. mistralai_gcp/utils/headers.py +8 -8
  190. mistralai_gcp/utils/logger.py +6 -0
  191. mistralai_gcp/utils/queryparams.py +16 -14
  192. mistralai_gcp/utils/retries.py +2 -1
  193. mistralai_gcp/utils/security.py +12 -6
  194. mistralai_gcp/utils/serializers.py +17 -8
  195. mistralai_gcp/utils/url.py +13 -8
  196. mistralai_gcp/utils/values.py +6 -0
  197. mistralai-1.0.2.dist-info/RECORD +0 -236
  198. {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/LICENSE +0 -0
  199. {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/WHEEL +0 -0
@@ -1,28 +1,170 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from .assistantmessage import AssistantMessage, AssistantMessageRole, AssistantMessageTypedDict
4
- from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceFinishReason, ChatCompletionChoiceTypedDict
5
- from .chatcompletionrequest import ChatCompletionRequest, ChatCompletionRequestMessages, ChatCompletionRequestMessagesTypedDict, ChatCompletionRequestStop, ChatCompletionRequestStopTypedDict, ChatCompletionRequestToolChoice, ChatCompletionRequestTypedDict
6
- from .chatcompletionresponse import ChatCompletionResponse, ChatCompletionResponseTypedDict
7
- from .chatcompletionstreamrequest import ChatCompletionStreamRequest, ChatCompletionStreamRequestTypedDict, Messages, MessagesTypedDict, Stop, StopTypedDict, ToolChoice
3
+ from .assistantmessage import (
4
+ AssistantMessage,
5
+ AssistantMessageRole,
6
+ AssistantMessageTypedDict,
7
+ )
8
+ from .chatcompletionchoice import (
9
+ ChatCompletionChoice,
10
+ ChatCompletionChoiceFinishReason,
11
+ ChatCompletionChoiceTypedDict,
12
+ )
13
+ from .chatcompletionrequest import (
14
+ ChatCompletionRequest,
15
+ ChatCompletionRequestMessages,
16
+ ChatCompletionRequestMessagesTypedDict,
17
+ ChatCompletionRequestStop,
18
+ ChatCompletionRequestStopTypedDict,
19
+ ChatCompletionRequestToolChoice,
20
+ ChatCompletionRequestToolChoiceTypedDict,
21
+ ChatCompletionRequestTypedDict,
22
+ )
23
+ from .chatcompletionresponse import (
24
+ ChatCompletionResponse,
25
+ ChatCompletionResponseTypedDict,
26
+ )
27
+ from .chatcompletionstreamrequest import (
28
+ ChatCompletionStreamRequest,
29
+ ChatCompletionStreamRequestToolChoice,
30
+ ChatCompletionStreamRequestToolChoiceTypedDict,
31
+ ChatCompletionStreamRequestTypedDict,
32
+ Messages,
33
+ MessagesTypedDict,
34
+ Stop,
35
+ StopTypedDict,
36
+ )
8
37
  from .completionchunk import CompletionChunk, CompletionChunkTypedDict
9
38
  from .completionevent import CompletionEvent, CompletionEventTypedDict
10
- from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceTypedDict, FinishReason
39
+ from .completionresponsestreamchoice import (
40
+ CompletionResponseStreamChoice,
41
+ CompletionResponseStreamChoiceTypedDict,
42
+ FinishReason,
43
+ )
11
44
  from .contentchunk import ContentChunk, ContentChunkTypedDict
12
45
  from .deltamessage import DeltaMessage, DeltaMessageTypedDict
13
46
  from .function import Function, FunctionTypedDict
14
- from .functioncall import Arguments, ArgumentsTypedDict, FunctionCall, FunctionCallTypedDict
47
+ from .functioncall import (
48
+ Arguments,
49
+ ArgumentsTypedDict,
50
+ FunctionCall,
51
+ FunctionCallTypedDict,
52
+ )
53
+ from .functionname import FunctionName, FunctionNameTypedDict
15
54
  from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
16
- from .responseformat import ResponseFormat, ResponseFormatTypedDict, ResponseFormats
55
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
56
+ from .responseformats import ResponseFormats
17
57
  from .sdkerror import SDKError
18
58
  from .security import Security, SecurityTypedDict
19
- from .systemmessage import Content, ContentTypedDict, Role, SystemMessage, SystemMessageTypedDict
20
- from .textchunk import TextChunk, TextChunkTypedDict
21
- from .tool import Tool, ToolToolTypes, ToolTypedDict
22
- from .toolcall import ToolCall, ToolCallTypedDict, ToolTypes
59
+ from .systemmessage import (
60
+ Content,
61
+ ContentTypedDict,
62
+ Role,
63
+ SystemMessage,
64
+ SystemMessageTypedDict,
65
+ )
66
+ from .textchunk import TextChunk, TextChunkTypedDict, Type
67
+ from .tool import Tool, ToolTypedDict
68
+ from .toolcall import ToolCall, ToolCallTypedDict
69
+ from .toolchoice import ToolChoice, ToolChoiceTypedDict
70
+ from .toolchoiceenum import ToolChoiceEnum
23
71
  from .toolmessage import ToolMessage, ToolMessageRole, ToolMessageTypedDict
72
+ from .tooltypes import ToolTypes
24
73
  from .usageinfo import UsageInfo, UsageInfoTypedDict
25
- from .usermessage import UserMessage, UserMessageContent, UserMessageContentTypedDict, UserMessageRole, UserMessageTypedDict
26
- from .validationerror import Loc, LocTypedDict, ValidationError, ValidationErrorTypedDict
74
+ from .usermessage import (
75
+ UserMessage,
76
+ UserMessageContent,
77
+ UserMessageContentTypedDict,
78
+ UserMessageRole,
79
+ UserMessageTypedDict,
80
+ )
81
+ from .validationerror import (
82
+ Loc,
83
+ LocTypedDict,
84
+ ValidationError,
85
+ ValidationErrorTypedDict,
86
+ )
27
87
 
28
- __all__ = ["Arguments", "ArgumentsTypedDict", "AssistantMessage", "AssistantMessageRole", "AssistantMessageTypedDict", "ChatCompletionChoice", "ChatCompletionChoiceFinishReason", "ChatCompletionChoiceTypedDict", "ChatCompletionRequest", "ChatCompletionRequestMessages", "ChatCompletionRequestMessagesTypedDict", "ChatCompletionRequestStop", "ChatCompletionRequestStopTypedDict", "ChatCompletionRequestToolChoice", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", "ChatCompletionStreamRequest", "ChatCompletionStreamRequestTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", "CompletionEventTypedDict", "CompletionResponseStreamChoice", "CompletionResponseStreamChoiceTypedDict", "Content", "ContentChunk", "ContentChunkTypedDict", "ContentTypedDict", "DeltaMessage", "DeltaMessageTypedDict", "FinishReason", "Function", "FunctionCall", "FunctionCallTypedDict", "FunctionTypedDict", "HTTPValidationError", "HTTPValidationErrorData", "Loc", "LocTypedDict", "Messages", "MessagesTypedDict", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", "Role", "SDKError", "Security", "SecurityTypedDict", "Stop", "StopTypedDict", "SystemMessage", "SystemMessageTypedDict", "TextChunk", "TextChunkTypedDict", "Tool", "ToolCall", "ToolCallTypedDict", "ToolChoice", "ToolMessage", "ToolMessageRole", "ToolMessageTypedDict", "ToolToolTypes", "ToolTypedDict", "ToolTypes", "UsageInfo", "UsageInfoTypedDict", "UserMessage", "UserMessageContent", "UserMessageContentTypedDict", "UserMessageRole", "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict"]
88
+ __all__ = [
89
+ "Arguments",
90
+ "ArgumentsTypedDict",
91
+ "AssistantMessage",
92
+ "AssistantMessageRole",
93
+ "AssistantMessageTypedDict",
94
+ "ChatCompletionChoice",
95
+ "ChatCompletionChoiceFinishReason",
96
+ "ChatCompletionChoiceTypedDict",
97
+ "ChatCompletionRequest",
98
+ "ChatCompletionRequestMessages",
99
+ "ChatCompletionRequestMessagesTypedDict",
100
+ "ChatCompletionRequestStop",
101
+ "ChatCompletionRequestStopTypedDict",
102
+ "ChatCompletionRequestToolChoice",
103
+ "ChatCompletionRequestToolChoiceTypedDict",
104
+ "ChatCompletionRequestTypedDict",
105
+ "ChatCompletionResponse",
106
+ "ChatCompletionResponseTypedDict",
107
+ "ChatCompletionStreamRequest",
108
+ "ChatCompletionStreamRequestToolChoice",
109
+ "ChatCompletionStreamRequestToolChoiceTypedDict",
110
+ "ChatCompletionStreamRequestTypedDict",
111
+ "CompletionChunk",
112
+ "CompletionChunkTypedDict",
113
+ "CompletionEvent",
114
+ "CompletionEventTypedDict",
115
+ "CompletionResponseStreamChoice",
116
+ "CompletionResponseStreamChoiceTypedDict",
117
+ "Content",
118
+ "ContentChunk",
119
+ "ContentChunkTypedDict",
120
+ "ContentTypedDict",
121
+ "DeltaMessage",
122
+ "DeltaMessageTypedDict",
123
+ "FinishReason",
124
+ "Function",
125
+ "FunctionCall",
126
+ "FunctionCallTypedDict",
127
+ "FunctionName",
128
+ "FunctionNameTypedDict",
129
+ "FunctionTypedDict",
130
+ "HTTPValidationError",
131
+ "HTTPValidationErrorData",
132
+ "Loc",
133
+ "LocTypedDict",
134
+ "Messages",
135
+ "MessagesTypedDict",
136
+ "ResponseFormat",
137
+ "ResponseFormatTypedDict",
138
+ "ResponseFormats",
139
+ "Role",
140
+ "SDKError",
141
+ "Security",
142
+ "SecurityTypedDict",
143
+ "Stop",
144
+ "StopTypedDict",
145
+ "SystemMessage",
146
+ "SystemMessageTypedDict",
147
+ "TextChunk",
148
+ "TextChunkTypedDict",
149
+ "Tool",
150
+ "ToolCall",
151
+ "ToolCallTypedDict",
152
+ "ToolChoice",
153
+ "ToolChoiceEnum",
154
+ "ToolChoiceTypedDict",
155
+ "ToolMessage",
156
+ "ToolMessageRole",
157
+ "ToolMessageTypedDict",
158
+ "ToolTypedDict",
159
+ "ToolTypes",
160
+ "Type",
161
+ "UsageInfo",
162
+ "UsageInfoTypedDict",
163
+ "UserMessage",
164
+ "UserMessageContent",
165
+ "UserMessageContentTypedDict",
166
+ "UserMessageRole",
167
+ "UserMessageTypedDict",
168
+ "ValidationError",
169
+ "ValidationErrorTypedDict",
170
+ ]
@@ -2,7 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .toolcall import ToolCall, ToolCallTypedDict
5
- from mistralai_azure.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
+ from mistralai_azure.types import (
6
+ BaseModel,
7
+ Nullable,
8
+ OptionalNullable,
9
+ UNSET,
10
+ UNSET_SENTINEL,
11
+ )
6
12
  from pydantic import model_serializer
7
13
  from typing import List, Literal, Optional, TypedDict
8
14
  from typing_extensions import NotRequired
@@ -10,21 +16,25 @@ from typing_extensions import NotRequired
10
16
 
11
17
  AssistantMessageRole = Literal["assistant"]
12
18
 
19
+
13
20
  class AssistantMessageTypedDict(TypedDict):
14
21
  content: NotRequired[Nullable[str]]
15
22
  tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
16
23
  prefix: NotRequired[bool]
17
24
  r"""Set this to `true` when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message."""
18
25
  role: NotRequired[AssistantMessageRole]
19
-
26
+
20
27
 
21
28
  class AssistantMessage(BaseModel):
22
29
  content: OptionalNullable[str] = UNSET
30
+
23
31
  tool_calls: OptionalNullable[List[ToolCall]] = UNSET
32
+
24
33
  prefix: Optional[bool] = False
25
34
  r"""Set this to `true` when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message."""
35
+
26
36
  role: Optional[AssistantMessageRole] = "assistant"
27
-
37
+
28
38
  @model_serializer(mode="wrap")
29
39
  def serialize_model(self, handler):
30
40
  optional_fields = ["content", "tool_calls", "prefix", "role"]
@@ -38,9 +48,13 @@ class AssistantMessage(BaseModel):
38
48
  for n, f in self.model_fields.items():
39
49
  k = f.alias or n
40
50
  val = serialized.get(k)
51
+ serialized.pop(k, None)
41
52
 
42
53
  optional_nullable = k in optional_fields and k in nullable_fields
43
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
54
+ is_set = (
55
+ self.__pydantic_fields_set__.intersection({n})
56
+ or k in null_default_fields
57
+ ) # pylint: disable=no-member
44
58
 
45
59
  if val is not None and val != UNSET_SENTINEL:
46
60
  m[k] = val
@@ -50,4 +64,3 @@ class AssistantMessage(BaseModel):
50
64
  m[k] = val
51
65
 
52
66
  return m
53
-
@@ -6,16 +6,20 @@ from mistralai_azure.types import BaseModel
6
6
  from typing import Literal, TypedDict
7
7
 
8
8
 
9
- ChatCompletionChoiceFinishReason = Literal["stop", "length", "model_length", "error", "tool_calls"]
9
+ ChatCompletionChoiceFinishReason = Literal[
10
+ "stop", "length", "model_length", "error", "tool_calls"
11
+ ]
12
+
10
13
 
11
14
  class ChatCompletionChoiceTypedDict(TypedDict):
12
15
  index: int
13
16
  message: AssistantMessageTypedDict
14
17
  finish_reason: ChatCompletionChoiceFinishReason
15
-
18
+
16
19
 
17
20
  class ChatCompletionChoice(BaseModel):
18
21
  index: int
22
+
19
23
  message: AssistantMessage
24
+
20
25
  finish_reason: ChatCompletionChoiceFinishReason
21
-
@@ -5,12 +5,20 @@ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
5
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
6
  from .systemmessage import SystemMessage, SystemMessageTypedDict
7
7
  from .tool import Tool, ToolTypedDict
8
+ from .toolchoice import ToolChoice, ToolChoiceTypedDict
9
+ from .toolchoiceenum import ToolChoiceEnum
8
10
  from .toolmessage import ToolMessage, ToolMessageTypedDict
9
11
  from .usermessage import UserMessage, UserMessageTypedDict
10
- from mistralai_azure.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
12
+ from mistralai_azure.types import (
13
+ BaseModel,
14
+ Nullable,
15
+ OptionalNullable,
16
+ UNSET,
17
+ UNSET_SENTINEL,
18
+ )
11
19
  from mistralai_azure.utils import get_discriminator
12
20
  from pydantic import Discriminator, Tag, model_serializer
13
- from typing import List, Literal, Optional, TypedDict, Union
21
+ from typing import List, Optional, TypedDict, Union
14
22
  from typing_extensions import Annotated, NotRequired
15
23
 
16
24
 
@@ -22,13 +30,30 @@ ChatCompletionRequestStop = Union[str, List[str]]
22
30
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
23
31
 
24
32
 
25
- ChatCompletionRequestMessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
33
+ ChatCompletionRequestMessagesTypedDict = Union[
34
+ SystemMessageTypedDict,
35
+ UserMessageTypedDict,
36
+ AssistantMessageTypedDict,
37
+ ToolMessageTypedDict,
38
+ ]
26
39
 
27
40
 
28
- ChatCompletionRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
41
+ ChatCompletionRequestMessages = Annotated[
42
+ Union[
43
+ Annotated[AssistantMessage, Tag("assistant")],
44
+ Annotated[SystemMessage, Tag("system")],
45
+ Annotated[ToolMessage, Tag("tool")],
46
+ Annotated[UserMessage, Tag("user")],
47
+ ],
48
+ Discriminator(lambda m: get_discriminator(m, "role", "role")),
49
+ ]
29
50
 
30
51
 
31
- ChatCompletionRequestToolChoice = Literal["auto", "none", "any"]
52
+ ChatCompletionRequestToolChoiceTypedDict = Union[ToolChoiceTypedDict, ToolChoiceEnum]
53
+
54
+
55
+ ChatCompletionRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
56
+
32
57
 
33
58
  class ChatCompletionRequestTypedDict(TypedDict):
34
59
  messages: List[ChatCompletionRequestMessagesTypedDict]
@@ -51,39 +76,64 @@ class ChatCompletionRequestTypedDict(TypedDict):
51
76
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
52
77
  response_format: NotRequired[ResponseFormatTypedDict]
53
78
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
54
- tool_choice: NotRequired[ChatCompletionRequestToolChoice]
79
+ tool_choice: NotRequired[ChatCompletionRequestToolChoiceTypedDict]
55
80
  safe_prompt: NotRequired[bool]
56
81
  r"""Whether to inject a safety prompt before all conversations."""
57
-
82
+
58
83
 
59
84
  class ChatCompletionRequest(BaseModel):
60
85
  messages: List[ChatCompletionRequestMessages]
61
86
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
87
+
62
88
  model: OptionalNullable[str] = "azureai"
63
89
  r"""The ID of the model to use for this request."""
90
+
64
91
  temperature: Optional[float] = 0.7
65
92
  r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both."""
93
+
66
94
  top_p: Optional[float] = 1
67
95
  r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
96
+
68
97
  max_tokens: OptionalNullable[int] = UNSET
69
98
  r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
99
+
70
100
  min_tokens: OptionalNullable[int] = UNSET
71
101
  r"""The minimum number of tokens to generate in the completion."""
102
+
72
103
  stream: Optional[bool] = False
73
104
  r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON."""
105
+
74
106
  stop: Optional[ChatCompletionRequestStop] = None
75
107
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
108
+
76
109
  random_seed: OptionalNullable[int] = UNSET
77
110
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
111
+
78
112
  response_format: Optional[ResponseFormat] = None
113
+
79
114
  tools: OptionalNullable[List[Tool]] = UNSET
80
- tool_choice: Optional[ChatCompletionRequestToolChoice] = "auto"
115
+
116
+ tool_choice: Optional[ChatCompletionRequestToolChoice] = None
117
+
81
118
  safe_prompt: Optional[bool] = False
82
119
  r"""Whether to inject a safety prompt before all conversations."""
83
-
120
+
84
121
  @model_serializer(mode="wrap")
85
122
  def serialize_model(self, handler):
86
- optional_fields = ["model", "temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
123
+ optional_fields = [
124
+ "model",
125
+ "temperature",
126
+ "top_p",
127
+ "max_tokens",
128
+ "min_tokens",
129
+ "stream",
130
+ "stop",
131
+ "random_seed",
132
+ "response_format",
133
+ "tools",
134
+ "tool_choice",
135
+ "safe_prompt",
136
+ ]
87
137
  nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
88
138
  null_default_fields = []
89
139
 
@@ -94,9 +144,13 @@ class ChatCompletionRequest(BaseModel):
94
144
  for n, f in self.model_fields.items():
95
145
  k = f.alias or n
96
146
  val = serialized.get(k)
147
+ serialized.pop(k, None)
97
148
 
98
149
  optional_nullable = k in optional_fields and k in nullable_fields
99
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
150
+ is_set = (
151
+ self.__pydantic_fields_set__.intersection({n})
152
+ or k in null_default_fields
153
+ ) # pylint: disable=no-member
100
154
 
101
155
  if val is not None and val != UNSET_SENTINEL:
102
156
  m[k] = val
@@ -106,4 +160,3 @@ class ChatCompletionRequest(BaseModel):
106
160
  m[k] = val
107
161
 
108
162
  return m
109
-
@@ -15,13 +15,17 @@ class ChatCompletionResponseTypedDict(TypedDict):
15
15
  usage: UsageInfoTypedDict
16
16
  created: NotRequired[int]
17
17
  choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
18
-
18
+
19
19
 
20
20
  class ChatCompletionResponse(BaseModel):
21
21
  id: str
22
+
22
23
  object: str
24
+
23
25
  model: str
26
+
24
27
  usage: UsageInfo
28
+
25
29
  created: Optional[int] = None
30
+
26
31
  choices: Optional[List[ChatCompletionChoice]] = None
27
-
@@ -5,12 +5,20 @@ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
5
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
6
  from .systemmessage import SystemMessage, SystemMessageTypedDict
7
7
  from .tool import Tool, ToolTypedDict
8
+ from .toolchoice import ToolChoice, ToolChoiceTypedDict
9
+ from .toolchoiceenum import ToolChoiceEnum
8
10
  from .toolmessage import ToolMessage, ToolMessageTypedDict
9
11
  from .usermessage import UserMessage, UserMessageTypedDict
10
- from mistralai_azure.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
12
+ from mistralai_azure.types import (
13
+ BaseModel,
14
+ Nullable,
15
+ OptionalNullable,
16
+ UNSET,
17
+ UNSET_SENTINEL,
18
+ )
11
19
  from mistralai_azure.utils import get_discriminator
12
20
  from pydantic import Discriminator, Tag, model_serializer
13
- from typing import List, Literal, Optional, TypedDict, Union
21
+ from typing import List, Optional, TypedDict, Union
14
22
  from typing_extensions import Annotated, NotRequired
15
23
 
16
24
 
@@ -22,13 +30,32 @@ Stop = Union[str, List[str]]
22
30
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
23
31
 
24
32
 
25
- MessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
33
+ MessagesTypedDict = Union[
34
+ SystemMessageTypedDict,
35
+ UserMessageTypedDict,
36
+ AssistantMessageTypedDict,
37
+ ToolMessageTypedDict,
38
+ ]
26
39
 
27
40
 
28
- Messages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
41
+ Messages = Annotated[
42
+ Union[
43
+ Annotated[AssistantMessage, Tag("assistant")],
44
+ Annotated[SystemMessage, Tag("system")],
45
+ Annotated[ToolMessage, Tag("tool")],
46
+ Annotated[UserMessage, Tag("user")],
47
+ ],
48
+ Discriminator(lambda m: get_discriminator(m, "role", "role")),
49
+ ]
29
50
 
30
51
 
31
- ToolChoice = Literal["auto", "none", "any"]
52
+ ChatCompletionStreamRequestToolChoiceTypedDict = Union[
53
+ ToolChoiceTypedDict, ToolChoiceEnum
54
+ ]
55
+
56
+
57
+ ChatCompletionStreamRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
58
+
32
59
 
33
60
  class ChatCompletionStreamRequestTypedDict(TypedDict):
34
61
  messages: List[MessagesTypedDict]
@@ -50,38 +77,63 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
50
77
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
51
78
  response_format: NotRequired[ResponseFormatTypedDict]
52
79
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
53
- tool_choice: NotRequired[ToolChoice]
80
+ tool_choice: NotRequired[ChatCompletionStreamRequestToolChoiceTypedDict]
54
81
  safe_prompt: NotRequired[bool]
55
82
  r"""Whether to inject a safety prompt before all conversations."""
56
-
83
+
57
84
 
58
85
  class ChatCompletionStreamRequest(BaseModel):
59
86
  messages: List[Messages]
60
87
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
88
+
61
89
  model: OptionalNullable[str] = "azureai"
62
90
  r"""The ID of the model to use for this request."""
91
+
63
92
  temperature: Optional[float] = 0.7
64
93
  r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both."""
94
+
65
95
  top_p: Optional[float] = 1
66
96
  r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
97
+
67
98
  max_tokens: OptionalNullable[int] = UNSET
68
99
  r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
100
+
69
101
  min_tokens: OptionalNullable[int] = UNSET
70
102
  r"""The minimum number of tokens to generate in the completion."""
103
+
71
104
  stream: Optional[bool] = True
105
+
72
106
  stop: Optional[Stop] = None
73
107
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
108
+
74
109
  random_seed: OptionalNullable[int] = UNSET
75
110
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
111
+
76
112
  response_format: Optional[ResponseFormat] = None
113
+
77
114
  tools: OptionalNullable[List[Tool]] = UNSET
78
- tool_choice: Optional[ToolChoice] = "auto"
115
+
116
+ tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = None
117
+
79
118
  safe_prompt: Optional[bool] = False
80
119
  r"""Whether to inject a safety prompt before all conversations."""
81
-
120
+
82
121
  @model_serializer(mode="wrap")
83
122
  def serialize_model(self, handler):
84
- optional_fields = ["model", "temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
123
+ optional_fields = [
124
+ "model",
125
+ "temperature",
126
+ "top_p",
127
+ "max_tokens",
128
+ "min_tokens",
129
+ "stream",
130
+ "stop",
131
+ "random_seed",
132
+ "response_format",
133
+ "tools",
134
+ "tool_choice",
135
+ "safe_prompt",
136
+ ]
85
137
  nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
86
138
  null_default_fields = []
87
139
 
@@ -92,9 +144,13 @@ class ChatCompletionStreamRequest(BaseModel):
92
144
  for n, f in self.model_fields.items():
93
145
  k = f.alias or n
94
146
  val = serialized.get(k)
147
+ serialized.pop(k, None)
95
148
 
96
149
  optional_nullable = k in optional_fields and k in nullable_fields
97
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
150
+ is_set = (
151
+ self.__pydantic_fields_set__.intersection({n})
152
+ or k in null_default_fields
153
+ ) # pylint: disable=no-member
98
154
 
99
155
  if val is not None and val != UNSET_SENTINEL:
100
156
  m[k] = val
@@ -104,4 +160,3 @@ class ChatCompletionStreamRequest(BaseModel):
104
160
  m[k] = val
105
161
 
106
162
  return m
107
-
@@ -1,7 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceTypedDict
4
+ from .completionresponsestreamchoice import (
5
+ CompletionResponseStreamChoice,
6
+ CompletionResponseStreamChoiceTypedDict,
7
+ )
5
8
  from .usageinfo import UsageInfo, UsageInfoTypedDict
6
9
  from mistralai_azure.types import BaseModel
7
10
  from typing import List, Optional, TypedDict
@@ -15,13 +18,17 @@ class CompletionChunkTypedDict(TypedDict):
15
18
  object: NotRequired[str]
16
19
  created: NotRequired[int]
17
20
  usage: NotRequired[UsageInfoTypedDict]
18
-
21
+
19
22
 
20
23
  class CompletionChunk(BaseModel):
21
24
  id: str
25
+
22
26
  model: str
27
+
23
28
  choices: List[CompletionResponseStreamChoice]
29
+
24
30
  object: Optional[str] = None
31
+
25
32
  created: Optional[int] = None
33
+
26
34
  usage: Optional[UsageInfo] = None
27
-
@@ -8,8 +8,7 @@ from typing import TypedDict
8
8
 
9
9
  class CompletionEventTypedDict(TypedDict):
10
10
  data: CompletionChunkTypedDict
11
-
11
+
12
12
 
13
13
  class CompletionEvent(BaseModel):
14
14
  data: CompletionChunk
15
-
@@ -9,17 +9,20 @@ from typing import Literal, TypedDict
9
9
 
10
10
  FinishReason = Literal["stop", "length", "error", "tool_calls"]
11
11
 
12
+
12
13
  class CompletionResponseStreamChoiceTypedDict(TypedDict):
13
14
  index: int
14
15
  delta: DeltaMessageTypedDict
15
16
  finish_reason: Nullable[FinishReason]
16
-
17
+
17
18
 
18
19
  class CompletionResponseStreamChoice(BaseModel):
19
20
  index: int
21
+
20
22
  delta: DeltaMessage
23
+
21
24
  finish_reason: Nullable[FinishReason]
22
-
25
+
23
26
  @model_serializer(mode="wrap")
24
27
  def serialize_model(self, handler):
25
28
  optional_fields = []
@@ -33,9 +36,13 @@ class CompletionResponseStreamChoice(BaseModel):
33
36
  for n, f in self.model_fields.items():
34
37
  k = f.alias or n
35
38
  val = serialized.get(k)
39
+ serialized.pop(k, None)
36
40
 
37
41
  optional_nullable = k in optional_fields and k in nullable_fields
38
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
42
+ is_set = (
43
+ self.__pydantic_fields_set__.intersection({n})
44
+ or k in null_default_fields
45
+ ) # pylint: disable=no-member
39
46
 
40
47
  if val is not None and val != UNSET_SENTINEL:
41
48
  m[k] = val
@@ -45,4 +52,3 @@ class CompletionResponseStreamChoice(BaseModel):
45
52
  m[k] = val
46
53
 
47
54
  return m
48
-