mistralai 1.8.2__py3-none-any.whl → 1.9.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.
- mistralai/_hooks/types.py +7 -0
- mistralai/_version.py +3 -3
- mistralai/agents.py +8 -4
- mistralai/basesdk.py +12 -20
- mistralai/chat.py +8 -4
- mistralai/classifiers.py +8 -0
- mistralai/conversations.py +34 -14
- mistralai/embeddings.py +2 -0
- mistralai/extra/run/context.py +2 -4
- mistralai/files.py +12 -0
- mistralai/fim.py +4 -0
- mistralai/httpclient.py +6 -16
- mistralai/jobs.py +10 -0
- mistralai/mistral_agents.py +10 -0
- mistralai/mistral_jobs.py +8 -0
- mistralai/models/__init__.py +1356 -723
- mistralai/models/agent.py +1 -1
- mistralai/models/agentconversation.py +1 -1
- mistralai/models/agentcreationrequest.py +1 -1
- mistralai/models/agenthandoffentry.py +1 -1
- mistralai/models/agents_api_v1_conversations_getop.py +2 -0
- mistralai/models/agents_api_v1_conversations_historyop.py +2 -0
- mistralai/models/agents_api_v1_conversations_messagesop.py +2 -0
- mistralai/models/agents_api_v1_conversations_restart_streamop.py +2 -0
- mistralai/models/agents_api_v1_conversations_restartop.py +2 -0
- mistralai/models/agentscompletionrequest.py +3 -1
- mistralai/models/agentscompletionstreamrequest.py +3 -1
- mistralai/models/agentupdaterequest.py +1 -1
- mistralai/models/assistantmessage.py +1 -1
- mistralai/models/basemodelcard.py +8 -6
- mistralai/models/batchjobin.py +1 -1
- mistralai/models/batchjobout.py +1 -1
- mistralai/models/chatcompletionrequest.py +3 -1
- mistralai/models/chatcompletionstreamrequest.py +3 -1
- mistralai/models/classifierdetailedjobout.py +1 -1
- mistralai/models/classifierftmodelout.py +1 -1
- mistralai/models/classifierjobout.py +1 -1
- mistralai/models/classifiertargetin.py +1 -1
- mistralai/models/classifiertrainingparameters.py +1 -1
- mistralai/models/classifiertrainingparametersin.py +1 -1
- mistralai/models/completionargs.py +1 -1
- mistralai/models/completiondetailedjobout.py +1 -1
- mistralai/models/completionftmodelout.py +1 -1
- mistralai/models/completionjobout.py +1 -1
- mistralai/models/completionresponsestreamchoice.py +1 -1
- mistralai/models/completiontrainingparameters.py +1 -1
- mistralai/models/completiontrainingparametersin.py +1 -1
- mistralai/models/contentchunk.py +3 -0
- mistralai/models/conversationrequest.py +1 -1
- mistralai/models/conversationstreamrequest.py +1 -1
- mistralai/models/conversationusageinfo.py +1 -1
- mistralai/models/deltamessage.py +1 -1
- mistralai/models/documenturlchunk.py +1 -1
- mistralai/models/embeddingrequest.py +1 -1
- mistralai/models/eventout.py +1 -1
- mistralai/models/filechunk.py +23 -0
- mistralai/models/files_api_routes_list_filesop.py +1 -1
- mistralai/models/fileschema.py +1 -1
- mistralai/models/fimcompletionrequest.py +1 -1
- mistralai/models/fimcompletionstreamrequest.py +1 -1
- mistralai/models/ftmodelcard.py +9 -6
- mistralai/models/functioncallentry.py +1 -1
- mistralai/models/functionresultentry.py +1 -1
- mistralai/models/githubrepositoryin.py +1 -1
- mistralai/models/githubrepositoryout.py +1 -1
- mistralai/models/imageurl.py +1 -1
- mistralai/models/inputentries.py +21 -2
- mistralai/models/jobin.py +1 -1
- mistralai/models/jobmetadataout.py +1 -1
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +1 -1
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +1 -1
- mistralai/models/jsonschema.py +1 -1
- mistralai/models/legacyjobmetadataout.py +1 -1
- mistralai/models/messageinputentry.py +4 -4
- mistralai/models/messageoutputentry.py +1 -1
- mistralai/models/messageoutputevent.py +1 -1
- mistralai/models/metricout.py +1 -1
- mistralai/models/modelcapabilities.py +3 -0
- mistralai/models/modelconversation.py +1 -1
- mistralai/models/ocrimageobject.py +1 -1
- mistralai/models/ocrpageobject.py +1 -1
- mistralai/models/ocrrequest.py +5 -3
- mistralai/models/ocrresponse.py +1 -1
- mistralai/models/ocrusageinfo.py +1 -1
- mistralai/models/responseformat.py +1 -1
- mistralai/models/retrievefileout.py +1 -1
- mistralai/models/toolexecutionentry.py +1 -1
- mistralai/models/toolfilechunk.py +1 -1
- mistralai/models/toolmessage.py +1 -1
- mistralai/models/toolreferencechunk.py +1 -1
- mistralai/models/updateftmodelin.py +1 -1
- mistralai/models/uploadfileout.py +1 -1
- mistralai/models/usermessage.py +1 -1
- mistralai/models/wandbintegration.py +1 -1
- mistralai/models/wandbintegrationout.py +1 -1
- mistralai/models_.py +14 -2
- mistralai/ocr.py +2 -0
- mistralai/sdk.py +68 -40
- mistralai/sdkconfiguration.py +0 -7
- mistralai/types/basemodel.py +3 -3
- mistralai/utils/__init__.py +131 -45
- mistralai/utils/datetimes.py +23 -0
- mistralai/utils/enums.py +67 -27
- mistralai/utils/forms.py +49 -28
- mistralai/utils/serializers.py +32 -3
- {mistralai-1.8.2.dist-info → mistralai-1.9.1.dist-info}/METADATA +13 -6
- {mistralai-1.8.2.dist-info → mistralai-1.9.1.dist-info}/RECORD +109 -107
- {mistralai-1.8.2.dist-info → mistralai-1.9.1.dist-info}/LICENSE +0 -0
- {mistralai-1.8.2.dist-info → mistralai-1.9.1.dist-info}/WHEEL +0 -0
mistralai/models/agent.py
CHANGED
|
@@ -11,12 +11,14 @@ from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
|
11
11
|
|
|
12
12
|
class AgentsAPIV1ConversationsGetRequestTypedDict(TypedDict):
|
|
13
13
|
conversation_id: str
|
|
14
|
+
r"""ID of the conversation from which we are fetching metadata."""
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class AgentsAPIV1ConversationsGetRequest(BaseModel):
|
|
17
18
|
conversation_id: Annotated[
|
|
18
19
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
19
20
|
]
|
|
21
|
+
r"""ID of the conversation from which we are fetching metadata."""
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
AgentsAPIV1ConversationsGetResponseV1ConversationsGetTypedDict = TypeAliasType(
|
|
@@ -8,9 +8,11 @@ from typing_extensions import Annotated, TypedDict
|
|
|
8
8
|
|
|
9
9
|
class AgentsAPIV1ConversationsHistoryRequestTypedDict(TypedDict):
|
|
10
10
|
conversation_id: str
|
|
11
|
+
r"""ID of the conversation from which we are fetching entries."""
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class AgentsAPIV1ConversationsHistoryRequest(BaseModel):
|
|
14
15
|
conversation_id: Annotated[
|
|
15
16
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
17
|
]
|
|
18
|
+
r"""ID of the conversation from which we are fetching entries."""
|
|
@@ -8,9 +8,11 @@ from typing_extensions import Annotated, TypedDict
|
|
|
8
8
|
|
|
9
9
|
class AgentsAPIV1ConversationsMessagesRequestTypedDict(TypedDict):
|
|
10
10
|
conversation_id: str
|
|
11
|
+
r"""ID of the conversation from which we are fetching messages."""
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class AgentsAPIV1ConversationsMessagesRequest(BaseModel):
|
|
14
15
|
conversation_id: Annotated[
|
|
15
16
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
16
17
|
]
|
|
18
|
+
r"""ID of the conversation from which we are fetching messages."""
|
|
@@ -12,6 +12,7 @@ from typing_extensions import Annotated, TypedDict
|
|
|
12
12
|
|
|
13
13
|
class AgentsAPIV1ConversationsRestartStreamRequestTypedDict(TypedDict):
|
|
14
14
|
conversation_id: str
|
|
15
|
+
r"""ID of the original conversation which is being restarted."""
|
|
15
16
|
conversation_restart_stream_request: ConversationRestartStreamRequestTypedDict
|
|
16
17
|
|
|
17
18
|
|
|
@@ -19,6 +20,7 @@ class AgentsAPIV1ConversationsRestartStreamRequest(BaseModel):
|
|
|
19
20
|
conversation_id: Annotated[
|
|
20
21
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
21
22
|
]
|
|
23
|
+
r"""ID of the original conversation which is being restarted."""
|
|
22
24
|
|
|
23
25
|
conversation_restart_stream_request: Annotated[
|
|
24
26
|
ConversationRestartStreamRequest,
|
|
@@ -12,6 +12,7 @@ from typing_extensions import Annotated, TypedDict
|
|
|
12
12
|
|
|
13
13
|
class AgentsAPIV1ConversationsRestartRequestTypedDict(TypedDict):
|
|
14
14
|
conversation_id: str
|
|
15
|
+
r"""ID of the original conversation which is being restarted."""
|
|
15
16
|
conversation_restart_request: ConversationRestartRequestTypedDict
|
|
16
17
|
|
|
17
18
|
|
|
@@ -19,6 +20,7 @@ class AgentsAPIV1ConversationsRestartRequest(BaseModel):
|
|
|
19
20
|
conversation_id: Annotated[
|
|
20
21
|
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
21
22
|
]
|
|
23
|
+
r"""ID of the original conversation which is being restarted."""
|
|
22
24
|
|
|
23
25
|
conversation_restart_request: Annotated[
|
|
24
26
|
ConversationRestartRequest,
|
|
@@ -89,6 +89,7 @@ class AgentsCompletionRequestTypedDict(TypedDict):
|
|
|
89
89
|
prediction: NotRequired[PredictionTypedDict]
|
|
90
90
|
parallel_tool_calls: NotRequired[bool]
|
|
91
91
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
92
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
class AgentsCompletionRequest(BaseModel):
|
|
@@ -132,6 +133,7 @@ class AgentsCompletionRequest(BaseModel):
|
|
|
132
133
|
prompt_mode: Annotated[
|
|
133
134
|
OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
|
|
134
135
|
] = UNSET
|
|
136
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
135
137
|
|
|
136
138
|
@model_serializer(mode="wrap")
|
|
137
139
|
def serialize_model(self, handler):
|
|
@@ -157,7 +159,7 @@ class AgentsCompletionRequest(BaseModel):
|
|
|
157
159
|
|
|
158
160
|
m = {}
|
|
159
161
|
|
|
160
|
-
for n, f in self.model_fields.items():
|
|
162
|
+
for n, f in type(self).model_fields.items():
|
|
161
163
|
k = f.alias or n
|
|
162
164
|
val = serialized.get(k)
|
|
163
165
|
serialized.pop(k, None)
|
|
@@ -88,6 +88,7 @@ class AgentsCompletionStreamRequestTypedDict(TypedDict):
|
|
|
88
88
|
prediction: NotRequired[PredictionTypedDict]
|
|
89
89
|
parallel_tool_calls: NotRequired[bool]
|
|
90
90
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
91
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
class AgentsCompletionStreamRequest(BaseModel):
|
|
@@ -130,6 +131,7 @@ class AgentsCompletionStreamRequest(BaseModel):
|
|
|
130
131
|
prompt_mode: Annotated[
|
|
131
132
|
OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
|
|
132
133
|
] = UNSET
|
|
134
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
133
135
|
|
|
134
136
|
@model_serializer(mode="wrap")
|
|
135
137
|
def serialize_model(self, handler):
|
|
@@ -155,7 +157,7 @@ class AgentsCompletionStreamRequest(BaseModel):
|
|
|
155
157
|
|
|
156
158
|
m = {}
|
|
157
159
|
|
|
158
|
-
for n, f in self.model_fields.items():
|
|
160
|
+
for n, f in type(self).model_fields.items():
|
|
159
161
|
k = f.alias or n
|
|
160
162
|
val = serialized.get(k)
|
|
161
163
|
serialized.pop(k, None)
|
|
@@ -12,9 +12,6 @@ from typing import List, Literal, Optional
|
|
|
12
12
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
Type = Literal["base"]
|
|
16
|
-
|
|
17
|
-
|
|
18
15
|
class BaseModelCardTypedDict(TypedDict):
|
|
19
16
|
id: str
|
|
20
17
|
capabilities: ModelCapabilitiesTypedDict
|
|
@@ -26,8 +23,9 @@ class BaseModelCardTypedDict(TypedDict):
|
|
|
26
23
|
max_context_length: NotRequired[int]
|
|
27
24
|
aliases: NotRequired[List[str]]
|
|
28
25
|
deprecation: NotRequired[Nullable[datetime]]
|
|
26
|
+
deprecation_replacement_model: NotRequired[Nullable[str]]
|
|
29
27
|
default_model_temperature: NotRequired[Nullable[float]]
|
|
30
|
-
type:
|
|
28
|
+
type: Literal["base"]
|
|
31
29
|
|
|
32
30
|
|
|
33
31
|
class BaseModelCard(BaseModel):
|
|
@@ -51,10 +49,12 @@ class BaseModelCard(BaseModel):
|
|
|
51
49
|
|
|
52
50
|
deprecation: OptionalNullable[datetime] = UNSET
|
|
53
51
|
|
|
52
|
+
deprecation_replacement_model: OptionalNullable[str] = UNSET
|
|
53
|
+
|
|
54
54
|
default_model_temperature: OptionalNullable[float] = UNSET
|
|
55
55
|
|
|
56
56
|
TYPE: Annotated[
|
|
57
|
-
Annotated[Optional[
|
|
57
|
+
Annotated[Optional[Literal["base"]], AfterValidator(validate_const("base"))],
|
|
58
58
|
pydantic.Field(alias="type"),
|
|
59
59
|
] = "base"
|
|
60
60
|
|
|
@@ -69,6 +69,7 @@ class BaseModelCard(BaseModel):
|
|
|
69
69
|
"max_context_length",
|
|
70
70
|
"aliases",
|
|
71
71
|
"deprecation",
|
|
72
|
+
"deprecation_replacement_model",
|
|
72
73
|
"default_model_temperature",
|
|
73
74
|
"type",
|
|
74
75
|
]
|
|
@@ -76,6 +77,7 @@ class BaseModelCard(BaseModel):
|
|
|
76
77
|
"name",
|
|
77
78
|
"description",
|
|
78
79
|
"deprecation",
|
|
80
|
+
"deprecation_replacement_model",
|
|
79
81
|
"default_model_temperature",
|
|
80
82
|
]
|
|
81
83
|
null_default_fields = []
|
|
@@ -84,7 +86,7 @@ class BaseModelCard(BaseModel):
|
|
|
84
86
|
|
|
85
87
|
m = {}
|
|
86
88
|
|
|
87
|
-
for n, f in self.model_fields.items():
|
|
89
|
+
for n, f in type(self).model_fields.items():
|
|
88
90
|
k = f.alias or n
|
|
89
91
|
val = serialized.get(k)
|
|
90
92
|
serialized.pop(k, None)
|
mistralai/models/batchjobin.py
CHANGED
mistralai/models/batchjobout.py
CHANGED
|
@@ -89,6 +89,7 @@ class ChatCompletionRequestTypedDict(TypedDict):
|
|
|
89
89
|
prediction: NotRequired[PredictionTypedDict]
|
|
90
90
|
parallel_tool_calls: NotRequired[bool]
|
|
91
91
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
92
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
92
93
|
safe_prompt: NotRequired[bool]
|
|
93
94
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
94
95
|
|
|
@@ -140,6 +141,7 @@ class ChatCompletionRequest(BaseModel):
|
|
|
140
141
|
prompt_mode: Annotated[
|
|
141
142
|
OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
|
|
142
143
|
] = UNSET
|
|
144
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
143
145
|
|
|
144
146
|
safe_prompt: Optional[bool] = None
|
|
145
147
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
@@ -178,7 +180,7 @@ class ChatCompletionRequest(BaseModel):
|
|
|
178
180
|
|
|
179
181
|
m = {}
|
|
180
182
|
|
|
181
|
-
for n, f in self.model_fields.items():
|
|
183
|
+
for n, f in type(self).model_fields.items():
|
|
182
184
|
k = f.alias or n
|
|
183
185
|
val = serialized.get(k)
|
|
184
186
|
serialized.pop(k, None)
|
|
@@ -92,6 +92,7 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
|
|
|
92
92
|
prediction: NotRequired[PredictionTypedDict]
|
|
93
93
|
parallel_tool_calls: NotRequired[bool]
|
|
94
94
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
95
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
95
96
|
safe_prompt: NotRequired[bool]
|
|
96
97
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
97
98
|
|
|
@@ -142,6 +143,7 @@ class ChatCompletionStreamRequest(BaseModel):
|
|
|
142
143
|
prompt_mode: Annotated[
|
|
143
144
|
OptionalNullable[MistralPromptMode], PlainValidator(validate_open_enum(False))
|
|
144
145
|
] = UNSET
|
|
146
|
+
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
145
147
|
|
|
146
148
|
safe_prompt: Optional[bool] = None
|
|
147
149
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
@@ -180,7 +182,7 @@ class ChatCompletionStreamRequest(BaseModel):
|
|
|
180
182
|
|
|
181
183
|
m = {}
|
|
182
184
|
|
|
183
|
-
for n, f in self.model_fields.items():
|
|
185
|
+
for n, f in type(self).model_fields.items():
|
|
184
186
|
k = f.alias or n
|
|
185
187
|
val = serialized.get(k)
|
|
186
188
|
serialized.pop(k, None)
|
mistralai/models/contentchunk.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
|
|
5
|
+
from .filechunk import FileChunk, FileChunkTypedDict
|
|
5
6
|
from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
|
|
6
7
|
from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
|
|
7
8
|
from .textchunk import TextChunk, TextChunkTypedDict
|
|
@@ -17,6 +18,7 @@ ContentChunkTypedDict = TypeAliasType(
|
|
|
17
18
|
TextChunkTypedDict,
|
|
18
19
|
ImageURLChunkTypedDict,
|
|
19
20
|
ReferenceChunkTypedDict,
|
|
21
|
+
FileChunkTypedDict,
|
|
20
22
|
DocumentURLChunkTypedDict,
|
|
21
23
|
],
|
|
22
24
|
)
|
|
@@ -28,6 +30,7 @@ ContentChunk = Annotated[
|
|
|
28
30
|
Annotated[DocumentURLChunk, Tag("document_url")],
|
|
29
31
|
Annotated[TextChunk, Tag("text")],
|
|
30
32
|
Annotated[ReferenceChunk, Tag("reference")],
|
|
33
|
+
Annotated[FileChunk, Tag("file")],
|
|
31
34
|
],
|
|
32
35
|
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
33
36
|
]
|
mistralai/models/deltamessage.py
CHANGED
mistralai/models/eventout.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.utils import validate_const
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic.functional_validators import AfterValidator
|
|
8
|
+
from typing import Literal, Optional
|
|
9
|
+
from typing_extensions import Annotated, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FileChunkTypedDict(TypedDict):
|
|
13
|
+
file_id: str
|
|
14
|
+
type: Literal["file"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class FileChunk(BaseModel):
|
|
18
|
+
file_id: str
|
|
19
|
+
|
|
20
|
+
TYPE: Annotated[
|
|
21
|
+
Annotated[Optional[Literal["file"]], AfterValidator(validate_const("file"))],
|
|
22
|
+
pydantic.Field(alias="type"),
|
|
23
|
+
] = "file"
|
mistralai/models/fileschema.py
CHANGED