mistralai 1.9.11__py3-none-any.whl → 1.10.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 (151) hide show
  1. mistralai/_hooks/registration.py +5 -0
  2. mistralai/_hooks/tracing.py +75 -0
  3. mistralai/_version.py +2 -2
  4. mistralai/accesses.py +8 -8
  5. mistralai/agents.py +29 -17
  6. mistralai/chat.py +41 -29
  7. mistralai/classifiers.py +13 -1
  8. mistralai/conversations.py +294 -62
  9. mistralai/documents.py +19 -3
  10. mistralai/embeddings.py +13 -7
  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/__init__.py +15 -0
  17. mistralai/extra/observability/otel.py +372 -0
  18. mistralai/extra/run/context.py +33 -43
  19. mistralai/extra/run/result.py +29 -30
  20. mistralai/extra/run/tools.py +34 -23
  21. mistralai/extra/struct_chat.py +15 -8
  22. mistralai/extra/utils/response_format.py +5 -3
  23. mistralai/files.py +6 -0
  24. mistralai/fim.py +17 -5
  25. mistralai/mistral_agents.py +229 -1
  26. mistralai/mistral_jobs.py +39 -13
  27. mistralai/models/__init__.py +99 -3
  28. mistralai/models/agent.py +15 -2
  29. mistralai/models/agentconversation.py +11 -3
  30. mistralai/models/agentcreationrequest.py +6 -2
  31. mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
  32. mistralai/models/agents_api_v1_agents_getop.py +40 -3
  33. mistralai/models/agents_api_v1_agents_listop.py +72 -2
  34. mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
  35. mistralai/models/agents_api_v1_conversations_listop.py +39 -2
  36. mistralai/models/agentscompletionrequest.py +21 -6
  37. mistralai/models/agentscompletionstreamrequest.py +21 -6
  38. mistralai/models/agentupdaterequest.py +18 -2
  39. mistralai/models/audioencoding.py +13 -0
  40. mistralai/models/audioformat.py +19 -0
  41. mistralai/models/audiotranscriptionrequest.py +2 -0
  42. mistralai/models/batchjobin.py +26 -5
  43. mistralai/models/batchjobout.py +5 -0
  44. mistralai/models/batchrequest.py +48 -0
  45. mistralai/models/chatcompletionrequest.py +22 -5
  46. mistralai/models/chatcompletionstreamrequest.py +22 -5
  47. mistralai/models/classificationrequest.py +37 -3
  48. mistralai/models/conversationrequest.py +15 -4
  49. mistralai/models/conversationrestartrequest.py +50 -2
  50. mistralai/models/conversationrestartstreamrequest.py +50 -2
  51. mistralai/models/conversationstreamrequest.py +15 -4
  52. mistralai/models/documentout.py +26 -10
  53. mistralai/models/documentupdatein.py +24 -3
  54. mistralai/models/embeddingrequest.py +19 -11
  55. mistralai/models/files_api_routes_list_filesop.py +7 -0
  56. mistralai/models/fimcompletionrequest.py +8 -9
  57. mistralai/models/fimcompletionstreamrequest.py +8 -9
  58. mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
  59. mistralai/models/libraries_documents_list_v1op.py +15 -2
  60. mistralai/models/libraryout.py +10 -7
  61. mistralai/models/listfilesout.py +35 -4
  62. mistralai/models/modelcapabilities.py +13 -4
  63. mistralai/models/modelconversation.py +8 -2
  64. mistralai/models/ocrpageobject.py +26 -5
  65. mistralai/models/ocrrequest.py +17 -1
  66. mistralai/models/ocrtableobject.py +31 -0
  67. mistralai/models/prediction.py +4 -0
  68. mistralai/models/requestsource.py +7 -0
  69. mistralai/models/responseformat.py +4 -2
  70. mistralai/models/responseformats.py +0 -1
  71. mistralai/models/sharingdelete.py +36 -5
  72. mistralai/models/sharingin.py +36 -5
  73. mistralai/models/sharingout.py +3 -3
  74. mistralai/models/toolexecutiondeltaevent.py +13 -4
  75. mistralai/models/toolexecutiondoneevent.py +13 -4
  76. mistralai/models/toolexecutionentry.py +9 -4
  77. mistralai/models/toolexecutionstartedevent.py +13 -4
  78. mistralai/models/toolfilechunk.py +11 -4
  79. mistralai/models/toolreferencechunk.py +13 -4
  80. mistralai/models_.py +2 -14
  81. mistralai/ocr.py +18 -0
  82. mistralai/transcriptions.py +4 -4
  83. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/METADATA +162 -152
  84. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/RECORD +168 -144
  85. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/WHEEL +1 -1
  86. mistralai_azure/_version.py +3 -3
  87. mistralai_azure/basesdk.py +15 -5
  88. mistralai_azure/chat.py +59 -98
  89. mistralai_azure/models/__init__.py +50 -3
  90. mistralai_azure/models/chatcompletionrequest.py +16 -4
  91. mistralai_azure/models/chatcompletionstreamrequest.py +16 -4
  92. mistralai_azure/models/httpvalidationerror.py +11 -6
  93. mistralai_azure/models/mistralazureerror.py +26 -0
  94. mistralai_azure/models/no_response_error.py +13 -0
  95. mistralai_azure/models/prediction.py +4 -0
  96. mistralai_azure/models/responseformat.py +4 -2
  97. mistralai_azure/models/responseformats.py +0 -1
  98. mistralai_azure/models/responsevalidationerror.py +25 -0
  99. mistralai_azure/models/sdkerror.py +30 -14
  100. mistralai_azure/models/systemmessage.py +7 -3
  101. mistralai_azure/models/systemmessagecontentchunks.py +21 -0
  102. mistralai_azure/models/thinkchunk.py +35 -0
  103. mistralai_azure/ocr.py +15 -36
  104. mistralai_azure/utils/__init__.py +18 -5
  105. mistralai_azure/utils/eventstreaming.py +10 -0
  106. mistralai_azure/utils/serializers.py +3 -2
  107. mistralai_azure/utils/unmarshal_json_response.py +24 -0
  108. mistralai_gcp/_hooks/types.py +7 -0
  109. mistralai_gcp/_version.py +4 -4
  110. mistralai_gcp/basesdk.py +27 -25
  111. mistralai_gcp/chat.py +75 -98
  112. mistralai_gcp/fim.py +39 -74
  113. mistralai_gcp/httpclient.py +6 -16
  114. mistralai_gcp/models/__init__.py +321 -116
  115. mistralai_gcp/models/assistantmessage.py +1 -1
  116. mistralai_gcp/models/chatcompletionrequest.py +36 -7
  117. mistralai_gcp/models/chatcompletionresponse.py +6 -6
  118. mistralai_gcp/models/chatcompletionstreamrequest.py +36 -7
  119. mistralai_gcp/models/completionresponsestreamchoice.py +1 -1
  120. mistralai_gcp/models/deltamessage.py +1 -1
  121. mistralai_gcp/models/fimcompletionrequest.py +3 -9
  122. mistralai_gcp/models/fimcompletionresponse.py +6 -6
  123. mistralai_gcp/models/fimcompletionstreamrequest.py +3 -9
  124. mistralai_gcp/models/httpvalidationerror.py +11 -6
  125. mistralai_gcp/models/imageurl.py +1 -1
  126. mistralai_gcp/models/jsonschema.py +1 -1
  127. mistralai_gcp/models/mistralgcperror.py +26 -0
  128. mistralai_gcp/models/mistralpromptmode.py +8 -0
  129. mistralai_gcp/models/no_response_error.py +13 -0
  130. mistralai_gcp/models/prediction.py +4 -0
  131. mistralai_gcp/models/responseformat.py +5 -3
  132. mistralai_gcp/models/responseformats.py +0 -1
  133. mistralai_gcp/models/responsevalidationerror.py +25 -0
  134. mistralai_gcp/models/sdkerror.py +30 -14
  135. mistralai_gcp/models/systemmessage.py +7 -3
  136. mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
  137. mistralai_gcp/models/thinkchunk.py +35 -0
  138. mistralai_gcp/models/toolmessage.py +1 -1
  139. mistralai_gcp/models/usageinfo.py +71 -8
  140. mistralai_gcp/models/usermessage.py +1 -1
  141. mistralai_gcp/sdk.py +12 -10
  142. mistralai_gcp/sdkconfiguration.py +0 -7
  143. mistralai_gcp/types/basemodel.py +3 -3
  144. mistralai_gcp/utils/__init__.py +143 -45
  145. mistralai_gcp/utils/datetimes.py +23 -0
  146. mistralai_gcp/utils/enums.py +67 -27
  147. mistralai_gcp/utils/eventstreaming.py +10 -0
  148. mistralai_gcp/utils/forms.py +49 -28
  149. mistralai_gcp/utils/serializers.py +33 -3
  150. mistralai_gcp/utils/unmarshal_json_response.py +24 -0
  151. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/licenses/LICENSE +0 -0
@@ -15,7 +15,7 @@ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_
15
15
  from mistralai.utils import get_discriminator, validate_open_enum
16
16
  from pydantic import Discriminator, Tag, model_serializer
17
17
  from pydantic.functional_validators import PlainValidator
18
- from typing import List, Optional, Union
18
+ from typing import Any, Dict, List, Optional, Union
19
19
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
20
20
 
21
21
 
@@ -57,11 +57,13 @@ ChatCompletionStreamRequestToolChoiceTypedDict = TypeAliasType(
57
57
  "ChatCompletionStreamRequestToolChoiceTypedDict",
58
58
  Union[ToolChoiceTypedDict, ToolChoiceEnum],
59
59
  )
60
+ r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool."""
60
61
 
61
62
 
62
63
  ChatCompletionStreamRequestToolChoice = TypeAliasType(
63
64
  "ChatCompletionStreamRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
64
65
  )
66
+ r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool."""
65
67
 
66
68
 
67
69
  class ChatCompletionStreamRequestTypedDict(TypedDict):
@@ -80,17 +82,23 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
80
82
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
81
83
  random_seed: NotRequired[Nullable[int]]
82
84
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
85
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
83
86
  response_format: NotRequired[ResponseFormatTypedDict]
87
+ r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide."""
84
88
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
89
+ r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for."""
85
90
  tool_choice: NotRequired[ChatCompletionStreamRequestToolChoiceTypedDict]
91
+ r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool."""
86
92
  presence_penalty: NotRequired[float]
87
- r"""presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
93
+ r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
88
94
  frequency_penalty: NotRequired[float]
89
- r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
95
+ r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
90
96
  n: NotRequired[Nullable[int]]
91
97
  r"""Number of completions to return for each request, input tokens are only billed once."""
92
98
  prediction: NotRequired[PredictionTypedDict]
99
+ r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
93
100
  parallel_tool_calls: NotRequired[bool]
101
+ r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
94
102
  prompt_mode: NotRequired[Nullable[MistralPromptMode]]
95
103
  r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
96
104
  safe_prompt: NotRequired[bool]
@@ -121,24 +129,31 @@ class ChatCompletionStreamRequest(BaseModel):
121
129
  random_seed: OptionalNullable[int] = UNSET
122
130
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
123
131
 
132
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
133
+
124
134
  response_format: Optional[ResponseFormat] = None
135
+ r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide."""
125
136
 
126
137
  tools: OptionalNullable[List[Tool]] = UNSET
138
+ r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for."""
127
139
 
128
140
  tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = None
141
+ r"""Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `any` or `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool."""
129
142
 
130
143
  presence_penalty: Optional[float] = None
131
- r"""presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
144
+ r"""The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative."""
132
145
 
133
146
  frequency_penalty: Optional[float] = None
134
- r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
147
+ r"""The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
135
148
 
136
149
  n: OptionalNullable[int] = UNSET
137
150
  r"""Number of completions to return for each request, input tokens are only billed once."""
138
151
 
139
152
  prediction: Optional[Prediction] = None
153
+ r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
140
154
 
141
155
  parallel_tool_calls: Optional[bool] = None
156
+ r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
142
157
 
143
158
  prompt_mode: Annotated[
144
159
  OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
@@ -157,6 +172,7 @@ class ChatCompletionStreamRequest(BaseModel):
157
172
  "stream",
158
173
  "stop",
159
174
  "random_seed",
175
+ "metadata",
160
176
  "response_format",
161
177
  "tools",
162
178
  "tool_choice",
@@ -172,6 +188,7 @@ class ChatCompletionStreamRequest(BaseModel):
172
188
  "temperature",
173
189
  "max_tokens",
174
190
  "random_seed",
191
+ "metadata",
175
192
  "tools",
176
193
  "n",
177
194
  "prompt_mode",
@@ -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
@@ -12,7 +12,7 @@ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
12
12
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
13
13
  from mistralai.utils import get_discriminator
14
14
  from pydantic import Discriminator, Tag, model_serializer
15
- from typing import List, Literal, Optional, Union
15
+ from typing import Any, Dict, List, Literal, Optional, Union
16
16
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
@@ -50,11 +50,14 @@ class ConversationRequestTypedDict(TypedDict):
50
50
  store: NotRequired[Nullable[bool]]
51
51
  handoff_execution: NotRequired[Nullable[HandoffExecution]]
52
52
  instructions: NotRequired[Nullable[str]]
53
- tools: NotRequired[Nullable[List[ToolsTypedDict]]]
53
+ tools: NotRequired[List[ToolsTypedDict]]
54
+ r"""List of tools which are available to the model during the conversation."""
54
55
  completion_args: NotRequired[Nullable[CompletionArgsTypedDict]]
55
56
  name: NotRequired[Nullable[str]]
56
57
  description: NotRequired[Nullable[str]]
58
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
57
59
  agent_id: NotRequired[Nullable[str]]
60
+ agent_version: NotRequired[Nullable[int]]
58
61
  model: NotRequired[Nullable[str]]
59
62
 
60
63
 
@@ -69,7 +72,8 @@ class ConversationRequest(BaseModel):
69
72
 
70
73
  instructions: OptionalNullable[str] = UNSET
71
74
 
72
- tools: OptionalNullable[List[Tools]] = UNSET
75
+ tools: Optional[List[Tools]] = None
76
+ r"""List of tools which are available to the model during the conversation."""
73
77
 
74
78
  completion_args: OptionalNullable[CompletionArgs] = UNSET
75
79
 
@@ -77,8 +81,12 @@ class ConversationRequest(BaseModel):
77
81
 
78
82
  description: OptionalNullable[str] = UNSET
79
83
 
84
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
85
+
80
86
  agent_id: OptionalNullable[str] = UNSET
81
87
 
88
+ agent_version: OptionalNullable[int] = UNSET
89
+
82
90
  model: OptionalNullable[str] = UNSET
83
91
 
84
92
  @model_serializer(mode="wrap")
@@ -92,18 +100,21 @@ class ConversationRequest(BaseModel):
92
100
  "completion_args",
93
101
  "name",
94
102
  "description",
103
+ "metadata",
95
104
  "agent_id",
105
+ "agent_version",
96
106
  "model",
97
107
  ]
98
108
  nullable_fields = [
99
109
  "store",
100
110
  "handoff_execution",
101
111
  "instructions",
102
- "tools",
103
112
  "completion_args",
104
113
  "name",
105
114
  "description",
115
+ "metadata",
106
116
  "agent_id",
117
+ "agent_version",
107
118
  "model",
108
119
  ]
109
120
  null_default_fields = []
@@ -3,8 +3,9 @@
3
3
  from __future__ import annotations
4
4
  from .completionargs import CompletionArgs, CompletionArgsTypedDict
5
5
  from .conversationinputs import ConversationInputs, ConversationInputsTypedDict
6
- from mistralai.types import BaseModel
7
- from typing import Literal, Optional
6
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
+ from pydantic import model_serializer
8
+ from typing import Any, Dict, Literal, Optional
8
9
  from typing_extensions import NotRequired, TypedDict
9
10
 
10
11
 
@@ -22,6 +23,10 @@ class ConversationRestartRequestTypedDict(TypedDict):
22
23
  handoff_execution: NotRequired[ConversationRestartRequestHandoffExecution]
23
24
  completion_args: NotRequired[CompletionArgsTypedDict]
24
25
  r"""White-listed arguments from the completion API"""
26
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
27
+ r"""Custom metadata for the conversation."""
28
+ agent_version: NotRequired[Nullable[int]]
29
+ r"""Specific version of the agent to use when restarting. If not provided, uses the current version."""
25
30
 
26
31
 
27
32
  class ConversationRestartRequest(BaseModel):
@@ -40,3 +45,46 @@ class ConversationRestartRequest(BaseModel):
40
45
 
41
46
  completion_args: Optional[CompletionArgs] = None
42
47
  r"""White-listed arguments from the completion API"""
48
+
49
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
50
+ r"""Custom metadata for the conversation."""
51
+
52
+ agent_version: OptionalNullable[int] = UNSET
53
+ r"""Specific version of the agent to use when restarting. If not provided, uses the current version."""
54
+
55
+ @model_serializer(mode="wrap")
56
+ def serialize_model(self, handler):
57
+ optional_fields = [
58
+ "stream",
59
+ "store",
60
+ "handoff_execution",
61
+ "completion_args",
62
+ "metadata",
63
+ "agent_version",
64
+ ]
65
+ nullable_fields = ["metadata", "agent_version"]
66
+ null_default_fields = []
67
+
68
+ serialized = handler(self)
69
+
70
+ m = {}
71
+
72
+ for n, f in type(self).model_fields.items():
73
+ k = f.alias or n
74
+ val = serialized.get(k)
75
+ serialized.pop(k, None)
76
+
77
+ optional_nullable = k in optional_fields and k in nullable_fields
78
+ is_set = (
79
+ self.__pydantic_fields_set__.intersection({n})
80
+ or k in null_default_fields
81
+ ) # pylint: disable=no-member
82
+
83
+ if val is not None and val != UNSET_SENTINEL:
84
+ m[k] = val
85
+ elif val != UNSET_SENTINEL and (
86
+ not k in optional_fields or (optional_nullable and is_set)
87
+ ):
88
+ m[k] = val
89
+
90
+ return m
@@ -3,8 +3,9 @@
3
3
  from __future__ import annotations
4
4
  from .completionargs import CompletionArgs, CompletionArgsTypedDict
5
5
  from .conversationinputs import ConversationInputs, ConversationInputsTypedDict
6
- from mistralai.types import BaseModel
7
- from typing import Literal, Optional
6
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
+ from pydantic import model_serializer
8
+ from typing import Any, Dict, Literal, Optional
8
9
  from typing_extensions import NotRequired, TypedDict
9
10
 
10
11
 
@@ -22,6 +23,10 @@ class ConversationRestartStreamRequestTypedDict(TypedDict):
22
23
  handoff_execution: NotRequired[ConversationRestartStreamRequestHandoffExecution]
23
24
  completion_args: NotRequired[CompletionArgsTypedDict]
24
25
  r"""White-listed arguments from the completion API"""
26
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
27
+ r"""Custom metadata for the conversation."""
28
+ agent_version: NotRequired[Nullable[int]]
29
+ r"""Specific version of the agent to use when restarting. If not provided, uses the current version."""
25
30
 
26
31
 
27
32
  class ConversationRestartStreamRequest(BaseModel):
@@ -42,3 +47,46 @@ class ConversationRestartStreamRequest(BaseModel):
42
47
 
43
48
  completion_args: Optional[CompletionArgs] = None
44
49
  r"""White-listed arguments from the completion API"""
50
+
51
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
52
+ r"""Custom metadata for the conversation."""
53
+
54
+ agent_version: OptionalNullable[int] = UNSET
55
+ r"""Specific version of the agent to use when restarting. If not provided, uses the current version."""
56
+
57
+ @model_serializer(mode="wrap")
58
+ def serialize_model(self, handler):
59
+ optional_fields = [
60
+ "stream",
61
+ "store",
62
+ "handoff_execution",
63
+ "completion_args",
64
+ "metadata",
65
+ "agent_version",
66
+ ]
67
+ nullable_fields = ["metadata", "agent_version"]
68
+ null_default_fields = []
69
+
70
+ serialized = handler(self)
71
+
72
+ m = {}
73
+
74
+ for n, f in type(self).model_fields.items():
75
+ k = f.alias or n
76
+ val = serialized.get(k)
77
+ serialized.pop(k, None)
78
+
79
+ optional_nullable = k in optional_fields and k in nullable_fields
80
+ is_set = (
81
+ self.__pydantic_fields_set__.intersection({n})
82
+ or k in null_default_fields
83
+ ) # pylint: disable=no-member
84
+
85
+ if val is not None and val != UNSET_SENTINEL:
86
+ m[k] = val
87
+ elif val != UNSET_SENTINEL and (
88
+ not k in optional_fields or (optional_nullable and is_set)
89
+ ):
90
+ m[k] = val
91
+
92
+ return m
@@ -12,7 +12,7 @@ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
12
12
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
13
13
  from mistralai.utils import get_discriminator
14
14
  from pydantic import Discriminator, Tag, model_serializer
15
- from typing import List, Literal, Optional, Union
15
+ from typing import Any, Dict, List, Literal, Optional, Union
16
16
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
@@ -50,11 +50,14 @@ class ConversationStreamRequestTypedDict(TypedDict):
50
50
  store: NotRequired[Nullable[bool]]
51
51
  handoff_execution: NotRequired[Nullable[ConversationStreamRequestHandoffExecution]]
52
52
  instructions: NotRequired[Nullable[str]]
53
- tools: NotRequired[Nullable[List[ConversationStreamRequestToolsTypedDict]]]
53
+ tools: NotRequired[List[ConversationStreamRequestToolsTypedDict]]
54
+ r"""List of tools which are available to the model during the conversation."""
54
55
  completion_args: NotRequired[Nullable[CompletionArgsTypedDict]]
55
56
  name: NotRequired[Nullable[str]]
56
57
  description: NotRequired[Nullable[str]]
58
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
57
59
  agent_id: NotRequired[Nullable[str]]
60
+ agent_version: NotRequired[Nullable[int]]
58
61
  model: NotRequired[Nullable[str]]
59
62
 
60
63
 
@@ -71,7 +74,8 @@ class ConversationStreamRequest(BaseModel):
71
74
 
72
75
  instructions: OptionalNullable[str] = UNSET
73
76
 
74
- tools: OptionalNullable[List[ConversationStreamRequestTools]] = UNSET
77
+ tools: Optional[List[ConversationStreamRequestTools]] = None
78
+ r"""List of tools which are available to the model during the conversation."""
75
79
 
76
80
  completion_args: OptionalNullable[CompletionArgs] = UNSET
77
81
 
@@ -79,8 +83,12 @@ class ConversationStreamRequest(BaseModel):
79
83
 
80
84
  description: OptionalNullable[str] = UNSET
81
85
 
86
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
87
+
82
88
  agent_id: OptionalNullable[str] = UNSET
83
89
 
90
+ agent_version: OptionalNullable[int] = UNSET
91
+
84
92
  model: OptionalNullable[str] = UNSET
85
93
 
86
94
  @model_serializer(mode="wrap")
@@ -94,18 +102,21 @@ class ConversationStreamRequest(BaseModel):
94
102
  "completion_args",
95
103
  "name",
96
104
  "description",
105
+ "metadata",
97
106
  "agent_id",
107
+ "agent_version",
98
108
  "model",
99
109
  ]
100
110
  nullable_fields = [
101
111
  "store",
102
112
  "handoff_execution",
103
113
  "instructions",
104
- "tools",
105
114
  "completion_args",
106
115
  "name",
107
116
  "description",
117
+ "metadata",
108
118
  "agent_id",
119
+ "agent_version",
109
120
  "model",
110
121
  ]
111
122
  null_default_fields = []
@@ -4,20 +4,21 @@ from __future__ import annotations
4
4
  from datetime import datetime
5
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
6
  from pydantic import model_serializer
7
+ from typing import Any, Dict
7
8
  from typing_extensions import NotRequired, TypedDict
8
9
 
9
10
 
10
11
  class DocumentOutTypedDict(TypedDict):
11
12
  id: str
12
13
  library_id: str
13
- hash: str
14
- mime_type: str
15
- extension: str
16
- size: int
14
+ hash: Nullable[str]
15
+ mime_type: Nullable[str]
16
+ extension: Nullable[str]
17
+ size: Nullable[int]
17
18
  name: str
18
19
  created_at: datetime
19
20
  processing_status: str
20
- uploaded_by_id: str
21
+ uploaded_by_id: Nullable[str]
21
22
  uploaded_by_type: str
22
23
  tokens_processing_total: int
23
24
  summary: NotRequired[Nullable[str]]
@@ -25,6 +26,8 @@ class DocumentOutTypedDict(TypedDict):
25
26
  number_of_pages: NotRequired[Nullable[int]]
26
27
  tokens_processing_main_content: NotRequired[Nullable[int]]
27
28
  tokens_processing_summary: NotRequired[Nullable[int]]
29
+ url: NotRequired[Nullable[str]]
30
+ attributes: NotRequired[Nullable[Dict[str, Any]]]
28
31
 
29
32
 
30
33
  class DocumentOut(BaseModel):
@@ -32,13 +35,13 @@ class DocumentOut(BaseModel):
32
35
 
33
36
  library_id: str
34
37
 
35
- hash: str
38
+ hash: Nullable[str]
36
39
 
37
- mime_type: str
40
+ mime_type: Nullable[str]
38
41
 
39
- extension: str
42
+ extension: Nullable[str]
40
43
 
41
- size: int
44
+ size: Nullable[int]
42
45
 
43
46
  name: str
44
47
 
@@ -46,7 +49,7 @@ class DocumentOut(BaseModel):
46
49
 
47
50
  processing_status: str
48
51
 
49
- uploaded_by_id: str
52
+ uploaded_by_id: Nullable[str]
50
53
 
51
54
  uploaded_by_type: str
52
55
 
@@ -62,6 +65,10 @@ class DocumentOut(BaseModel):
62
65
 
63
66
  tokens_processing_summary: OptionalNullable[int] = UNSET
64
67
 
68
+ url: OptionalNullable[str] = UNSET
69
+
70
+ attributes: OptionalNullable[Dict[str, Any]] = UNSET
71
+
65
72
  @model_serializer(mode="wrap")
66
73
  def serialize_model(self, handler):
67
74
  optional_fields = [
@@ -70,13 +77,22 @@ class DocumentOut(BaseModel):
70
77
  "number_of_pages",
71
78
  "tokens_processing_main_content",
72
79
  "tokens_processing_summary",
80
+ "url",
81
+ "attributes",
73
82
  ]
74
83
  nullable_fields = [
84
+ "hash",
85
+ "mime_type",
86
+ "extension",
87
+ "size",
75
88
  "summary",
76
89
  "last_processed_at",
77
90
  "number_of_pages",
91
+ "uploaded_by_id",
78
92
  "tokens_processing_main_content",
79
93
  "tokens_processing_summary",
94
+ "url",
95
+ "attributes",
80
96
  ]
81
97
  null_default_fields = []
82
98
 
@@ -1,22 +1,43 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
+ from datetime import datetime
4
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
6
  from pydantic import model_serializer
6
- from typing_extensions import NotRequired, TypedDict
7
+ from typing import Dict, List, Union
8
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
9
+
10
+
11
+ AttributesTypedDict = TypeAliasType(
12
+ "AttributesTypedDict",
13
+ Union[
14
+ bool, str, int, float, datetime, List[str], List[int], List[float], List[bool]
15
+ ],
16
+ )
17
+
18
+
19
+ Attributes = TypeAliasType(
20
+ "Attributes",
21
+ Union[
22
+ bool, str, int, float, datetime, List[str], List[int], List[float], List[bool]
23
+ ],
24
+ )
7
25
 
8
26
 
9
27
  class DocumentUpdateInTypedDict(TypedDict):
10
28
  name: NotRequired[Nullable[str]]
29
+ attributes: NotRequired[Nullable[Dict[str, AttributesTypedDict]]]
11
30
 
12
31
 
13
32
  class DocumentUpdateIn(BaseModel):
14
33
  name: OptionalNullable[str] = UNSET
15
34
 
35
+ attributes: OptionalNullable[Dict[str, Attributes]] = UNSET
36
+
16
37
  @model_serializer(mode="wrap")
17
38
  def serialize_model(self, handler):
18
- optional_fields = ["name"]
19
- nullable_fields = ["name"]
39
+ optional_fields = ["name", "attributes"]
40
+ nullable_fields = ["name", "attributes"]
20
41
  null_default_fields = []
21
42
 
22
43
  serialized = handler(self)
@@ -6,40 +6,43 @@ from .encodingformat import EncodingFormat
6
6
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
7
  import pydantic
8
8
  from pydantic import model_serializer
9
- from typing import List, Optional, Union
9
+ from typing import Any, Dict, List, Optional, Union
10
10
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
11
11
 
12
12
 
13
13
  EmbeddingRequestInputsTypedDict = TypeAliasType(
14
14
  "EmbeddingRequestInputsTypedDict", Union[str, List[str]]
15
15
  )
16
- r"""Text to embed."""
16
+ r"""The text content to be embedded, can be a string or an array of strings for fast processing in bulk."""
17
17
 
18
18
 
19
19
  EmbeddingRequestInputs = TypeAliasType("EmbeddingRequestInputs", Union[str, List[str]])
20
- r"""Text to embed."""
20
+ r"""The text content to be embedded, can be a string or an array of strings for fast processing in bulk."""
21
21
 
22
22
 
23
23
  class EmbeddingRequestTypedDict(TypedDict):
24
24
  model: str
25
- r"""ID of the model to use."""
25
+ r"""The ID of the model to be used for embedding."""
26
26
  inputs: EmbeddingRequestInputsTypedDict
27
- r"""Text to embed."""
27
+ r"""The text content to be embedded, can be a string or an array of strings for fast processing in bulk."""
28
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
28
29
  output_dimension: NotRequired[Nullable[int]]
29
- r"""The dimension of the output embeddings."""
30
+ r"""The dimension of the output embeddings when feature available. If not provided, a default output dimension will be used."""
30
31
  output_dtype: NotRequired[EmbeddingDtype]
31
32
  encoding_format: NotRequired[EncodingFormat]
32
33
 
33
34
 
34
35
  class EmbeddingRequest(BaseModel):
35
36
  model: str
36
- r"""ID of the model to use."""
37
+ r"""The ID of the model to be used for embedding."""
37
38
 
38
39
  inputs: Annotated[EmbeddingRequestInputs, pydantic.Field(alias="input")]
39
- r"""Text to embed."""
40
+ r"""The text content to be embedded, can be a string or an array of strings for fast processing in bulk."""
41
+
42
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
40
43
 
41
44
  output_dimension: OptionalNullable[int] = UNSET
42
- r"""The dimension of the output embeddings."""
45
+ r"""The dimension of the output embeddings when feature available. If not provided, a default output dimension will be used."""
43
46
 
44
47
  output_dtype: Optional[EmbeddingDtype] = None
45
48
 
@@ -47,8 +50,13 @@ class EmbeddingRequest(BaseModel):
47
50
 
48
51
  @model_serializer(mode="wrap")
49
52
  def serialize_model(self, handler):
50
- optional_fields = ["output_dimension", "output_dtype", "encoding_format"]
51
- nullable_fields = ["output_dimension"]
53
+ optional_fields = [
54
+ "metadata",
55
+ "output_dimension",
56
+ "output_dtype",
57
+ "encoding_format",
58
+ ]
59
+ nullable_fields = ["metadata", "output_dimension"]
52
60
  null_default_fields = []
53
61
 
54
62
  serialized = handler(self)