mistralai 1.9.10__py3-none-any.whl → 1.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. mistralai/_hooks/registration.py +5 -0
  2. mistralai/_hooks/tracing.py +50 -0
  3. mistralai/_version.py +3 -3
  4. mistralai/accesses.py +51 -116
  5. mistralai/agents.py +58 -85
  6. mistralai/audio.py +8 -3
  7. mistralai/basesdk.py +15 -5
  8. mistralai/batch.py +6 -3
  9. mistralai/beta.py +10 -5
  10. mistralai/chat.py +70 -97
  11. mistralai/classifiers.py +57 -144
  12. mistralai/conversations.py +435 -412
  13. mistralai/documents.py +156 -359
  14. mistralai/embeddings.py +21 -42
  15. mistralai/extra/observability/__init__.py +15 -0
  16. mistralai/extra/observability/otel.py +393 -0
  17. mistralai/extra/run/tools.py +28 -16
  18. mistralai/files.py +53 -176
  19. mistralai/fim.py +46 -73
  20. mistralai/fine_tuning.py +6 -3
  21. mistralai/jobs.py +49 -158
  22. mistralai/libraries.py +71 -178
  23. mistralai/mistral_agents.py +298 -179
  24. mistralai/mistral_jobs.py +51 -138
  25. mistralai/models/__init__.py +94 -5
  26. mistralai/models/agent.py +15 -2
  27. mistralai/models/agentconversation.py +11 -3
  28. mistralai/models/agentcreationrequest.py +6 -2
  29. mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
  30. mistralai/models/agents_api_v1_agents_getop.py +40 -3
  31. mistralai/models/agents_api_v1_agents_listop.py +72 -2
  32. mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
  33. mistralai/models/agents_api_v1_conversations_listop.py +39 -2
  34. mistralai/models/agentscompletionrequest.py +21 -6
  35. mistralai/models/agentscompletionstreamrequest.py +21 -6
  36. mistralai/models/agentupdaterequest.py +18 -2
  37. mistralai/models/audiotranscriptionrequest.py +2 -0
  38. mistralai/models/batchjobin.py +10 -0
  39. mistralai/models/chatcompletionrequest.py +22 -5
  40. mistralai/models/chatcompletionstreamrequest.py +22 -5
  41. mistralai/models/conversationrequest.py +15 -4
  42. mistralai/models/conversationrestartrequest.py +50 -2
  43. mistralai/models/conversationrestartstreamrequest.py +50 -2
  44. mistralai/models/conversationstreamrequest.py +15 -4
  45. mistralai/models/documentout.py +26 -10
  46. mistralai/models/documentupdatein.py +24 -3
  47. mistralai/models/embeddingrequest.py +8 -8
  48. mistralai/models/files_api_routes_list_filesop.py +7 -0
  49. mistralai/models/fimcompletionrequest.py +8 -9
  50. mistralai/models/fimcompletionstreamrequest.py +8 -9
  51. mistralai/models/httpvalidationerror.py +11 -6
  52. mistralai/models/libraries_documents_list_v1op.py +15 -2
  53. mistralai/models/libraryout.py +10 -7
  54. mistralai/models/listfilesout.py +35 -4
  55. mistralai/models/mistralerror.py +26 -0
  56. mistralai/models/modelcapabilities.py +13 -4
  57. mistralai/models/modelconversation.py +8 -2
  58. mistralai/models/no_response_error.py +13 -0
  59. mistralai/models/ocrpageobject.py +26 -5
  60. mistralai/models/ocrrequest.py +17 -1
  61. mistralai/models/ocrtableobject.py +31 -0
  62. mistralai/models/prediction.py +4 -0
  63. mistralai/models/requestsource.py +7 -0
  64. mistralai/models/responseformat.py +4 -2
  65. mistralai/models/responseformats.py +0 -1
  66. mistralai/models/responsevalidationerror.py +25 -0
  67. mistralai/models/sdkerror.py +30 -14
  68. mistralai/models/sharingdelete.py +36 -5
  69. mistralai/models/sharingin.py +36 -5
  70. mistralai/models/sharingout.py +3 -3
  71. mistralai/models/toolexecutiondeltaevent.py +13 -4
  72. mistralai/models/toolexecutiondoneevent.py +13 -4
  73. mistralai/models/toolexecutionentry.py +9 -4
  74. mistralai/models/toolexecutionstartedevent.py +13 -4
  75. mistralai/models_.py +67 -212
  76. mistralai/ocr.py +33 -36
  77. mistralai/sdk.py +15 -2
  78. mistralai/transcriptions.py +21 -60
  79. mistralai/utils/__init__.py +18 -5
  80. mistralai/utils/eventstreaming.py +10 -0
  81. mistralai/utils/serializers.py +3 -2
  82. mistralai/utils/unmarshal_json_response.py +24 -0
  83. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/METADATA +89 -40
  84. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/RECORD +86 -75
  85. {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/WHEEL +1 -1
  86. {mistralai-1.9.10.dist-info → mistralai-1.10.0.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
 
@@ -53,11 +53,13 @@ ChatCompletionRequestToolChoiceTypedDict = TypeAliasType(
53
53
  "ChatCompletionRequestToolChoiceTypedDict",
54
54
  Union[ToolChoiceTypedDict, ToolChoiceEnum],
55
55
  )
56
+ 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."""
56
57
 
57
58
 
58
59
  ChatCompletionRequestToolChoice = TypeAliasType(
59
60
  "ChatCompletionRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
60
61
  )
62
+ 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."""
61
63
 
62
64
 
63
65
  class ChatCompletionRequestTypedDict(TypedDict):
@@ -77,17 +79,23 @@ class ChatCompletionRequestTypedDict(TypedDict):
77
79
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
78
80
  random_seed: NotRequired[Nullable[int]]
79
81
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
82
+ metadata: NotRequired[Nullable[Dict[str, Any]]]
80
83
  response_format: NotRequired[ResponseFormatTypedDict]
84
+ 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."""
81
85
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
86
+ r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for."""
82
87
  tool_choice: NotRequired[ChatCompletionRequestToolChoiceTypedDict]
88
+ 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."""
83
89
  presence_penalty: NotRequired[float]
84
- 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."""
90
+ 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."""
85
91
  frequency_penalty: NotRequired[float]
86
- 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."""
92
+ 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."""
87
93
  n: NotRequired[Nullable[int]]
88
94
  r"""Number of completions to return for each request, input tokens are only billed once."""
89
95
  prediction: NotRequired[PredictionTypedDict]
96
+ r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
90
97
  parallel_tool_calls: NotRequired[bool]
98
+ r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
91
99
  prompt_mode: NotRequired[Nullable[MistralPromptMode]]
92
100
  r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
93
101
  safe_prompt: NotRequired[bool]
@@ -119,24 +127,31 @@ class ChatCompletionRequest(BaseModel):
119
127
  random_seed: OptionalNullable[int] = UNSET
120
128
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
121
129
 
130
+ metadata: OptionalNullable[Dict[str, Any]] = UNSET
131
+
122
132
  response_format: Optional[ResponseFormat] = None
133
+ 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."""
123
134
 
124
135
  tools: OptionalNullable[List[Tool]] = UNSET
136
+ r"""A list of tools the model may call. Use this to provide a list of functions the model may generate JSON inputs for."""
125
137
 
126
138
  tool_choice: Optional[ChatCompletionRequestToolChoice] = None
139
+ 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."""
127
140
 
128
141
  presence_penalty: Optional[float] = None
129
- 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."""
142
+ 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."""
130
143
 
131
144
  frequency_penalty: Optional[float] = None
132
- 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."""
145
+ 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."""
133
146
 
134
147
  n: OptionalNullable[int] = UNSET
135
148
  r"""Number of completions to return for each request, input tokens are only billed once."""
136
149
 
137
150
  prediction: Optional[Prediction] = None
151
+ r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
138
152
 
139
153
  parallel_tool_calls: Optional[bool] = None
154
+ r"""Whether to enable parallel function calling during tool use, when enabled the model can call multiple tools in parallel."""
140
155
 
141
156
  prompt_mode: Annotated[
142
157
  OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
@@ -155,6 +170,7 @@ class ChatCompletionRequest(BaseModel):
155
170
  "stream",
156
171
  "stop",
157
172
  "random_seed",
173
+ "metadata",
158
174
  "response_format",
159
175
  "tools",
160
176
  "tool_choice",
@@ -170,6 +186,7 @@ class ChatCompletionRequest(BaseModel):
170
186
  "temperature",
171
187
  "max_tokens",
172
188
  "random_seed",
189
+ "metadata",
173
190
  "tools",
174
191
  "n",
175
192
  "prompt_mode",
@@ -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",
@@ -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)