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.
- mistralai/_hooks/registration.py +5 -0
- mistralai/_hooks/tracing.py +75 -0
- mistralai/_version.py +2 -2
- mistralai/accesses.py +8 -8
- mistralai/agents.py +29 -17
- mistralai/chat.py +41 -29
- mistralai/classifiers.py +13 -1
- mistralai/conversations.py +294 -62
- mistralai/documents.py +19 -3
- mistralai/embeddings.py +13 -7
- mistralai/extra/README.md +1 -1
- mistralai/extra/mcp/auth.py +10 -11
- mistralai/extra/mcp/base.py +17 -16
- mistralai/extra/mcp/sse.py +13 -15
- mistralai/extra/mcp/stdio.py +5 -6
- mistralai/extra/observability/__init__.py +15 -0
- mistralai/extra/observability/otel.py +372 -0
- mistralai/extra/run/context.py +33 -43
- mistralai/extra/run/result.py +29 -30
- mistralai/extra/run/tools.py +34 -23
- mistralai/extra/struct_chat.py +15 -8
- mistralai/extra/utils/response_format.py +5 -3
- mistralai/files.py +6 -0
- mistralai/fim.py +17 -5
- mistralai/mistral_agents.py +229 -1
- mistralai/mistral_jobs.py +39 -13
- mistralai/models/__init__.py +99 -3
- mistralai/models/agent.py +15 -2
- mistralai/models/agentconversation.py +11 -3
- mistralai/models/agentcreationrequest.py +6 -2
- mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
- mistralai/models/agents_api_v1_agents_getop.py +40 -3
- mistralai/models/agents_api_v1_agents_listop.py +72 -2
- mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
- mistralai/models/agents_api_v1_conversations_listop.py +39 -2
- mistralai/models/agentscompletionrequest.py +21 -6
- mistralai/models/agentscompletionstreamrequest.py +21 -6
- mistralai/models/agentupdaterequest.py +18 -2
- mistralai/models/audioencoding.py +13 -0
- mistralai/models/audioformat.py +19 -0
- mistralai/models/audiotranscriptionrequest.py +2 -0
- mistralai/models/batchjobin.py +26 -5
- mistralai/models/batchjobout.py +5 -0
- mistralai/models/batchrequest.py +48 -0
- mistralai/models/chatcompletionrequest.py +22 -5
- mistralai/models/chatcompletionstreamrequest.py +22 -5
- mistralai/models/classificationrequest.py +37 -3
- mistralai/models/conversationrequest.py +15 -4
- mistralai/models/conversationrestartrequest.py +50 -2
- mistralai/models/conversationrestartstreamrequest.py +50 -2
- mistralai/models/conversationstreamrequest.py +15 -4
- mistralai/models/documentout.py +26 -10
- mistralai/models/documentupdatein.py +24 -3
- mistralai/models/embeddingrequest.py +19 -11
- mistralai/models/files_api_routes_list_filesop.py +7 -0
- mistralai/models/fimcompletionrequest.py +8 -9
- mistralai/models/fimcompletionstreamrequest.py +8 -9
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
- mistralai/models/libraries_documents_list_v1op.py +15 -2
- mistralai/models/libraryout.py +10 -7
- mistralai/models/listfilesout.py +35 -4
- mistralai/models/modelcapabilities.py +13 -4
- mistralai/models/modelconversation.py +8 -2
- mistralai/models/ocrpageobject.py +26 -5
- mistralai/models/ocrrequest.py +17 -1
- mistralai/models/ocrtableobject.py +31 -0
- mistralai/models/prediction.py +4 -0
- mistralai/models/requestsource.py +7 -0
- mistralai/models/responseformat.py +4 -2
- mistralai/models/responseformats.py +0 -1
- mistralai/models/sharingdelete.py +36 -5
- mistralai/models/sharingin.py +36 -5
- mistralai/models/sharingout.py +3 -3
- mistralai/models/toolexecutiondeltaevent.py +13 -4
- mistralai/models/toolexecutiondoneevent.py +13 -4
- mistralai/models/toolexecutionentry.py +9 -4
- mistralai/models/toolexecutionstartedevent.py +13 -4
- mistralai/models/toolfilechunk.py +11 -4
- mistralai/models/toolreferencechunk.py +13 -4
- mistralai/models_.py +2 -14
- mistralai/ocr.py +18 -0
- mistralai/transcriptions.py +4 -4
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/METADATA +162 -152
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/RECORD +168 -144
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/WHEEL +1 -1
- mistralai_azure/_version.py +3 -3
- mistralai_azure/basesdk.py +15 -5
- mistralai_azure/chat.py +59 -98
- mistralai_azure/models/__init__.py +50 -3
- mistralai_azure/models/chatcompletionrequest.py +16 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +16 -4
- mistralai_azure/models/httpvalidationerror.py +11 -6
- mistralai_azure/models/mistralazureerror.py +26 -0
- mistralai_azure/models/no_response_error.py +13 -0
- mistralai_azure/models/prediction.py +4 -0
- mistralai_azure/models/responseformat.py +4 -2
- mistralai_azure/models/responseformats.py +0 -1
- mistralai_azure/models/responsevalidationerror.py +25 -0
- mistralai_azure/models/sdkerror.py +30 -14
- mistralai_azure/models/systemmessage.py +7 -3
- mistralai_azure/models/systemmessagecontentchunks.py +21 -0
- mistralai_azure/models/thinkchunk.py +35 -0
- mistralai_azure/ocr.py +15 -36
- mistralai_azure/utils/__init__.py +18 -5
- mistralai_azure/utils/eventstreaming.py +10 -0
- mistralai_azure/utils/serializers.py +3 -2
- mistralai_azure/utils/unmarshal_json_response.py +24 -0
- mistralai_gcp/_hooks/types.py +7 -0
- mistralai_gcp/_version.py +4 -4
- mistralai_gcp/basesdk.py +27 -25
- mistralai_gcp/chat.py +75 -98
- mistralai_gcp/fim.py +39 -74
- mistralai_gcp/httpclient.py +6 -16
- mistralai_gcp/models/__init__.py +321 -116
- mistralai_gcp/models/assistantmessage.py +1 -1
- mistralai_gcp/models/chatcompletionrequest.py +36 -7
- mistralai_gcp/models/chatcompletionresponse.py +6 -6
- mistralai_gcp/models/chatcompletionstreamrequest.py +36 -7
- mistralai_gcp/models/completionresponsestreamchoice.py +1 -1
- mistralai_gcp/models/deltamessage.py +1 -1
- mistralai_gcp/models/fimcompletionrequest.py +3 -9
- mistralai_gcp/models/fimcompletionresponse.py +6 -6
- mistralai_gcp/models/fimcompletionstreamrequest.py +3 -9
- mistralai_gcp/models/httpvalidationerror.py +11 -6
- mistralai_gcp/models/imageurl.py +1 -1
- mistralai_gcp/models/jsonschema.py +1 -1
- mistralai_gcp/models/mistralgcperror.py +26 -0
- mistralai_gcp/models/mistralpromptmode.py +8 -0
- mistralai_gcp/models/no_response_error.py +13 -0
- mistralai_gcp/models/prediction.py +4 -0
- mistralai_gcp/models/responseformat.py +5 -3
- mistralai_gcp/models/responseformats.py +0 -1
- mistralai_gcp/models/responsevalidationerror.py +25 -0
- mistralai_gcp/models/sdkerror.py +30 -14
- mistralai_gcp/models/systemmessage.py +7 -3
- mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
- mistralai_gcp/models/thinkchunk.py +35 -0
- mistralai_gcp/models/toolmessage.py +1 -1
- mistralai_gcp/models/usageinfo.py +71 -8
- mistralai_gcp/models/usermessage.py +1 -1
- mistralai_gcp/sdk.py +12 -10
- mistralai_gcp/sdkconfiguration.py +0 -7
- mistralai_gcp/types/basemodel.py +3 -3
- mistralai_gcp/utils/__init__.py +143 -45
- mistralai_gcp/utils/datetimes.py +23 -0
- mistralai_gcp/utils/enums.py +67 -27
- mistralai_gcp/utils/eventstreaming.py +10 -0
- mistralai_gcp/utils/forms.py +49 -28
- mistralai_gcp/utils/serializers.py +33 -3
- mistralai_gcp/utils/unmarshal_json_response.py +24 -0
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .agentconversation import AgentConversation, AgentConversationTypedDict
|
|
5
5
|
from .modelconversation import ModelConversation, ModelConversationTypedDict
|
|
6
|
-
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
7
|
from mistralai.utils import FieldMetadata, QueryParamMetadata
|
|
8
|
-
from
|
|
8
|
+
from pydantic import model_serializer
|
|
9
|
+
from typing import Any, Dict, Optional, Union
|
|
9
10
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class AgentsAPIV1ConversationsListRequestTypedDict(TypedDict):
|
|
13
14
|
page: NotRequired[int]
|
|
14
15
|
page_size: NotRequired[int]
|
|
16
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
class AgentsAPIV1ConversationsListRequest(BaseModel):
|
|
@@ -25,6 +27,41 @@ class AgentsAPIV1ConversationsListRequest(BaseModel):
|
|
|
25
27
|
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
26
28
|
] = 100
|
|
27
29
|
|
|
30
|
+
metadata: Annotated[
|
|
31
|
+
OptionalNullable[Dict[str, Any]],
|
|
32
|
+
FieldMetadata(query=QueryParamMetadata(serialization="json")),
|
|
33
|
+
] = UNSET
|
|
34
|
+
|
|
35
|
+
@model_serializer(mode="wrap")
|
|
36
|
+
def serialize_model(self, handler):
|
|
37
|
+
optional_fields = ["page", "page_size", "metadata"]
|
|
38
|
+
nullable_fields = ["metadata"]
|
|
39
|
+
null_default_fields = []
|
|
40
|
+
|
|
41
|
+
serialized = handler(self)
|
|
42
|
+
|
|
43
|
+
m = {}
|
|
44
|
+
|
|
45
|
+
for n, f in type(self).model_fields.items():
|
|
46
|
+
k = f.alias or n
|
|
47
|
+
val = serialized.get(k)
|
|
48
|
+
serialized.pop(k, None)
|
|
49
|
+
|
|
50
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
51
|
+
is_set = (
|
|
52
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
53
|
+
or k in null_default_fields
|
|
54
|
+
) # pylint: disable=no-member
|
|
55
|
+
|
|
56
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
57
|
+
m[k] = val
|
|
58
|
+
elif val != UNSET_SENTINEL and (
|
|
59
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
60
|
+
):
|
|
61
|
+
m[k] = val
|
|
62
|
+
|
|
63
|
+
return m
|
|
64
|
+
|
|
28
65
|
|
|
29
66
|
ResponseBodyTypedDict = TypeAliasType(
|
|
30
67
|
"ResponseBodyTypedDict",
|
|
@@ -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
|
|
|
@@ -77,16 +77,19 @@ class AgentsCompletionRequestTypedDict(TypedDict):
|
|
|
77
77
|
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
78
78
|
random_seed: NotRequired[Nullable[int]]
|
|
79
79
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
80
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
80
81
|
response_format: NotRequired[ResponseFormatTypedDict]
|
|
82
|
+
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
83
|
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
82
84
|
tool_choice: NotRequired[AgentsCompletionRequestToolChoiceTypedDict]
|
|
83
85
|
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."""
|
|
86
|
+
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
87
|
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."""
|
|
88
|
+
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
89
|
n: NotRequired[Nullable[int]]
|
|
88
90
|
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
89
91
|
prediction: NotRequired[PredictionTypedDict]
|
|
92
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
90
93
|
parallel_tool_calls: NotRequired[bool]
|
|
91
94
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
92
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."""
|
|
@@ -111,22 +114,26 @@ class AgentsCompletionRequest(BaseModel):
|
|
|
111
114
|
random_seed: OptionalNullable[int] = UNSET
|
|
112
115
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
113
116
|
|
|
117
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET
|
|
118
|
+
|
|
114
119
|
response_format: Optional[ResponseFormat] = None
|
|
120
|
+
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."""
|
|
115
121
|
|
|
116
122
|
tools: OptionalNullable[List[Tool]] = UNSET
|
|
117
123
|
|
|
118
124
|
tool_choice: Optional[AgentsCompletionRequestToolChoice] = None
|
|
119
125
|
|
|
120
126
|
presence_penalty: Optional[float] = None
|
|
121
|
-
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."""
|
|
127
|
+
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."""
|
|
122
128
|
|
|
123
129
|
frequency_penalty: Optional[float] = None
|
|
124
|
-
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."""
|
|
130
|
+
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."""
|
|
125
131
|
|
|
126
132
|
n: OptionalNullable[int] = UNSET
|
|
127
133
|
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
128
134
|
|
|
129
135
|
prediction: Optional[Prediction] = None
|
|
136
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
130
137
|
|
|
131
138
|
parallel_tool_calls: Optional[bool] = None
|
|
132
139
|
|
|
@@ -142,6 +149,7 @@ class AgentsCompletionRequest(BaseModel):
|
|
|
142
149
|
"stream",
|
|
143
150
|
"stop",
|
|
144
151
|
"random_seed",
|
|
152
|
+
"metadata",
|
|
145
153
|
"response_format",
|
|
146
154
|
"tools",
|
|
147
155
|
"tool_choice",
|
|
@@ -152,7 +160,14 @@ class AgentsCompletionRequest(BaseModel):
|
|
|
152
160
|
"parallel_tool_calls",
|
|
153
161
|
"prompt_mode",
|
|
154
162
|
]
|
|
155
|
-
nullable_fields = [
|
|
163
|
+
nullable_fields = [
|
|
164
|
+
"max_tokens",
|
|
165
|
+
"random_seed",
|
|
166
|
+
"metadata",
|
|
167
|
+
"tools",
|
|
168
|
+
"n",
|
|
169
|
+
"prompt_mode",
|
|
170
|
+
]
|
|
156
171
|
null_default_fields = []
|
|
157
172
|
|
|
158
173
|
serialized = handler(self)
|
|
@@ -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
|
|
|
@@ -76,16 +76,19 @@ class AgentsCompletionStreamRequestTypedDict(TypedDict):
|
|
|
76
76
|
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
77
77
|
random_seed: NotRequired[Nullable[int]]
|
|
78
78
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
79
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
79
80
|
response_format: NotRequired[ResponseFormatTypedDict]
|
|
81
|
+
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."""
|
|
80
82
|
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
81
83
|
tool_choice: NotRequired[AgentsCompletionStreamRequestToolChoiceTypedDict]
|
|
82
84
|
presence_penalty: NotRequired[float]
|
|
83
|
-
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."""
|
|
85
|
+
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."""
|
|
84
86
|
frequency_penalty: NotRequired[float]
|
|
85
|
-
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."""
|
|
87
|
+
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."""
|
|
86
88
|
n: NotRequired[Nullable[int]]
|
|
87
89
|
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
88
90
|
prediction: NotRequired[PredictionTypedDict]
|
|
91
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
89
92
|
parallel_tool_calls: NotRequired[bool]
|
|
90
93
|
prompt_mode: NotRequired[Nullable[MistralPromptMode]]
|
|
91
94
|
r"""Allows toggling between the reasoning mode and no system prompt. When set to `reasoning` the system prompt for reasoning models will be used."""
|
|
@@ -109,22 +112,26 @@ class AgentsCompletionStreamRequest(BaseModel):
|
|
|
109
112
|
random_seed: OptionalNullable[int] = UNSET
|
|
110
113
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
111
114
|
|
|
115
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET
|
|
116
|
+
|
|
112
117
|
response_format: Optional[ResponseFormat] = None
|
|
118
|
+
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."""
|
|
113
119
|
|
|
114
120
|
tools: OptionalNullable[List[Tool]] = UNSET
|
|
115
121
|
|
|
116
122
|
tool_choice: Optional[AgentsCompletionStreamRequestToolChoice] = None
|
|
117
123
|
|
|
118
124
|
presence_penalty: Optional[float] = None
|
|
119
|
-
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."""
|
|
125
|
+
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."""
|
|
120
126
|
|
|
121
127
|
frequency_penalty: Optional[float] = None
|
|
122
|
-
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."""
|
|
128
|
+
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."""
|
|
123
129
|
|
|
124
130
|
n: OptionalNullable[int] = UNSET
|
|
125
131
|
r"""Number of completions to return for each request, input tokens are only billed once."""
|
|
126
132
|
|
|
127
133
|
prediction: Optional[Prediction] = None
|
|
134
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
128
135
|
|
|
129
136
|
parallel_tool_calls: Optional[bool] = None
|
|
130
137
|
|
|
@@ -140,6 +147,7 @@ class AgentsCompletionStreamRequest(BaseModel):
|
|
|
140
147
|
"stream",
|
|
141
148
|
"stop",
|
|
142
149
|
"random_seed",
|
|
150
|
+
"metadata",
|
|
143
151
|
"response_format",
|
|
144
152
|
"tools",
|
|
145
153
|
"tool_choice",
|
|
@@ -150,7 +158,14 @@ class AgentsCompletionStreamRequest(BaseModel):
|
|
|
150
158
|
"parallel_tool_calls",
|
|
151
159
|
"prompt_mode",
|
|
152
160
|
]
|
|
153
|
-
nullable_fields = [
|
|
161
|
+
nullable_fields = [
|
|
162
|
+
"max_tokens",
|
|
163
|
+
"random_seed",
|
|
164
|
+
"metadata",
|
|
165
|
+
"tools",
|
|
166
|
+
"n",
|
|
167
|
+
"prompt_mode",
|
|
168
|
+
]
|
|
154
169
|
null_default_fields = []
|
|
155
170
|
|
|
156
171
|
serialized = handler(self)
|
|
@@ -11,7 +11,7 @@ from .websearchtool import WebSearchTool, WebSearchToolTypedDict
|
|
|
11
11
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
12
12
|
from mistralai.utils import get_discriminator
|
|
13
13
|
from pydantic import Discriminator, Tag, model_serializer
|
|
14
|
-
from typing import List, Optional, Union
|
|
14
|
+
from typing import Any, Dict, List, Optional, Union
|
|
15
15
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
16
16
|
|
|
17
17
|
|
|
@@ -52,6 +52,8 @@ class AgentUpdateRequestTypedDict(TypedDict):
|
|
|
52
52
|
name: NotRequired[Nullable[str]]
|
|
53
53
|
description: NotRequired[Nullable[str]]
|
|
54
54
|
handoffs: NotRequired[Nullable[List[str]]]
|
|
55
|
+
deployment_chat: NotRequired[Nullable[bool]]
|
|
56
|
+
metadata: NotRequired[Nullable[Dict[str, Any]]]
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
class AgentUpdateRequest(BaseModel):
|
|
@@ -72,6 +74,10 @@ class AgentUpdateRequest(BaseModel):
|
|
|
72
74
|
|
|
73
75
|
handoffs: OptionalNullable[List[str]] = UNSET
|
|
74
76
|
|
|
77
|
+
deployment_chat: OptionalNullable[bool] = UNSET
|
|
78
|
+
|
|
79
|
+
metadata: OptionalNullable[Dict[str, Any]] = UNSET
|
|
80
|
+
|
|
75
81
|
@model_serializer(mode="wrap")
|
|
76
82
|
def serialize_model(self, handler):
|
|
77
83
|
optional_fields = [
|
|
@@ -82,8 +88,18 @@ class AgentUpdateRequest(BaseModel):
|
|
|
82
88
|
"name",
|
|
83
89
|
"description",
|
|
84
90
|
"handoffs",
|
|
91
|
+
"deployment_chat",
|
|
92
|
+
"metadata",
|
|
93
|
+
]
|
|
94
|
+
nullable_fields = [
|
|
95
|
+
"instructions",
|
|
96
|
+
"model",
|
|
97
|
+
"name",
|
|
98
|
+
"description",
|
|
99
|
+
"handoffs",
|
|
100
|
+
"deployment_chat",
|
|
101
|
+
"metadata",
|
|
85
102
|
]
|
|
86
|
-
nullable_fields = ["instructions", "model", "name", "description", "handoffs"]
|
|
87
103
|
null_default_fields = []
|
|
88
104
|
|
|
89
105
|
serialized = handler(self)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import UnrecognizedStr
|
|
5
|
+
from typing import Literal, Union
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
AudioEncoding = Union[
|
|
9
|
+
Literal[
|
|
10
|
+
"pcm_s16le", "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw"
|
|
11
|
+
],
|
|
12
|
+
UnrecognizedStr,
|
|
13
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .audioencoding import AudioEncoding
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.utils import validate_open_enum
|
|
7
|
+
from pydantic.functional_validators import PlainValidator
|
|
8
|
+
from typing_extensions import Annotated, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AudioFormatTypedDict(TypedDict):
|
|
12
|
+
encoding: AudioEncoding
|
|
13
|
+
sample_rate: int
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AudioFormat(BaseModel):
|
|
17
|
+
encoding: Annotated[AudioEncoding, PlainValidator(validate_open_enum(False))]
|
|
18
|
+
|
|
19
|
+
sample_rate: int
|
|
@@ -14,6 +14,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
|
|
14
14
|
|
|
15
15
|
class AudioTranscriptionRequestTypedDict(TypedDict):
|
|
16
16
|
model: str
|
|
17
|
+
r"""ID of the model to be used."""
|
|
17
18
|
file: NotRequired[FileTypedDict]
|
|
18
19
|
file_url: NotRequired[Nullable[str]]
|
|
19
20
|
r"""Url of a file to be transcribed"""
|
|
@@ -29,6 +30,7 @@ class AudioTranscriptionRequestTypedDict(TypedDict):
|
|
|
29
30
|
|
|
30
31
|
class AudioTranscriptionRequest(BaseModel):
|
|
31
32
|
model: Annotated[str, FieldMetadata(multipart=True)]
|
|
33
|
+
r"""ID of the model to be used."""
|
|
32
34
|
|
|
33
35
|
file: Annotated[
|
|
34
36
|
Optional[File], FieldMetadata(multipart=MultipartFormMetadata(file=True))
|
mistralai/models/batchjobin.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .apiendpoint import APIEndpoint
|
|
5
|
+
from .batchrequest import BatchRequest, BatchRequestTypedDict
|
|
5
6
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
7
|
from mistralai.utils import validate_open_enum
|
|
7
8
|
from pydantic import model_serializer
|
|
@@ -11,31 +12,51 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class BatchJobInTypedDict(TypedDict):
|
|
14
|
-
input_files: List[str]
|
|
15
15
|
endpoint: APIEndpoint
|
|
16
|
+
input_files: NotRequired[Nullable[List[str]]]
|
|
17
|
+
r"""The list of input files to be used for batch inference, these files should be `jsonl` files, containing the input data corresponding to the bory request for the batch inference in a \"body\" field. An example of such file is the following: ```json {\"custom_id\": \"0\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French cheese?\"}]}} {\"custom_id\": \"1\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French wine?\"}]}} ```"""
|
|
18
|
+
requests: NotRequired[Nullable[List[BatchRequestTypedDict]]]
|
|
16
19
|
model: NotRequired[Nullable[str]]
|
|
20
|
+
r"""The model to be used for batch inference."""
|
|
17
21
|
agent_id: NotRequired[Nullable[str]]
|
|
22
|
+
r"""In case you want to use a specific agent from the **deprecated** agents api for batch inference, you can specify the agent ID here."""
|
|
18
23
|
metadata: NotRequired[Nullable[Dict[str, str]]]
|
|
24
|
+
r"""The metadata of your choice to be associated with the batch inference job."""
|
|
19
25
|
timeout_hours: NotRequired[int]
|
|
26
|
+
r"""The timeout in hours for the batch inference job."""
|
|
20
27
|
|
|
21
28
|
|
|
22
29
|
class BatchJobIn(BaseModel):
|
|
23
|
-
input_files: List[str]
|
|
24
|
-
|
|
25
30
|
endpoint: Annotated[APIEndpoint, PlainValidator(validate_open_enum(False))]
|
|
26
31
|
|
|
32
|
+
input_files: OptionalNullable[List[str]] = UNSET
|
|
33
|
+
r"""The list of input files to be used for batch inference, these files should be `jsonl` files, containing the input data corresponding to the bory request for the batch inference in a \"body\" field. An example of such file is the following: ```json {\"custom_id\": \"0\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French cheese?\"}]}} {\"custom_id\": \"1\", \"body\": {\"max_tokens\": 100, \"messages\": [{\"role\": \"user\", \"content\": \"What is the best French wine?\"}]}} ```"""
|
|
34
|
+
|
|
35
|
+
requests: OptionalNullable[List[BatchRequest]] = UNSET
|
|
36
|
+
|
|
27
37
|
model: OptionalNullable[str] = UNSET
|
|
38
|
+
r"""The model to be used for batch inference."""
|
|
28
39
|
|
|
29
40
|
agent_id: OptionalNullable[str] = UNSET
|
|
41
|
+
r"""In case you want to use a specific agent from the **deprecated** agents api for batch inference, you can specify the agent ID here."""
|
|
30
42
|
|
|
31
43
|
metadata: OptionalNullable[Dict[str, str]] = UNSET
|
|
44
|
+
r"""The metadata of your choice to be associated with the batch inference job."""
|
|
32
45
|
|
|
33
46
|
timeout_hours: Optional[int] = 24
|
|
47
|
+
r"""The timeout in hours for the batch inference job."""
|
|
34
48
|
|
|
35
49
|
@model_serializer(mode="wrap")
|
|
36
50
|
def serialize_model(self, handler):
|
|
37
|
-
optional_fields = [
|
|
38
|
-
|
|
51
|
+
optional_fields = [
|
|
52
|
+
"input_files",
|
|
53
|
+
"requests",
|
|
54
|
+
"model",
|
|
55
|
+
"agent_id",
|
|
56
|
+
"metadata",
|
|
57
|
+
"timeout_hours",
|
|
58
|
+
]
|
|
59
|
+
nullable_fields = ["input_files", "requests", "model", "agent_id", "metadata"]
|
|
39
60
|
null_default_fields = []
|
|
40
61
|
|
|
41
62
|
serialized = handler(self)
|
mistralai/models/batchjobout.py
CHANGED
|
@@ -29,6 +29,7 @@ class BatchJobOutTypedDict(TypedDict):
|
|
|
29
29
|
agent_id: NotRequired[Nullable[str]]
|
|
30
30
|
output_file: NotRequired[Nullable[str]]
|
|
31
31
|
error_file: NotRequired[Nullable[str]]
|
|
32
|
+
outputs: NotRequired[Nullable[List[Dict[str, Any]]]]
|
|
32
33
|
started_at: NotRequired[Nullable[int]]
|
|
33
34
|
completed_at: NotRequired[Nullable[int]]
|
|
34
35
|
|
|
@@ -66,6 +67,8 @@ class BatchJobOut(BaseModel):
|
|
|
66
67
|
|
|
67
68
|
error_file: OptionalNullable[str] = UNSET
|
|
68
69
|
|
|
70
|
+
outputs: OptionalNullable[List[Dict[str, Any]]] = UNSET
|
|
71
|
+
|
|
69
72
|
started_at: OptionalNullable[int] = UNSET
|
|
70
73
|
|
|
71
74
|
completed_at: OptionalNullable[int] = UNSET
|
|
@@ -79,6 +82,7 @@ class BatchJobOut(BaseModel):
|
|
|
79
82
|
"agent_id",
|
|
80
83
|
"output_file",
|
|
81
84
|
"error_file",
|
|
85
|
+
"outputs",
|
|
82
86
|
"started_at",
|
|
83
87
|
"completed_at",
|
|
84
88
|
]
|
|
@@ -88,6 +92,7 @@ class BatchJobOut(BaseModel):
|
|
|
88
92
|
"agent_id",
|
|
89
93
|
"output_file",
|
|
90
94
|
"error_file",
|
|
95
|
+
"outputs",
|
|
91
96
|
"started_at",
|
|
92
97
|
"completed_at",
|
|
93
98
|
]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
5
|
+
from pydantic import model_serializer
|
|
6
|
+
from typing import Any, Dict
|
|
7
|
+
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BatchRequestTypedDict(TypedDict):
|
|
11
|
+
body: Dict[str, Any]
|
|
12
|
+
custom_id: NotRequired[Nullable[str]]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BatchRequest(BaseModel):
|
|
16
|
+
body: Dict[str, Any]
|
|
17
|
+
|
|
18
|
+
custom_id: OptionalNullable[str] = UNSET
|
|
19
|
+
|
|
20
|
+
@model_serializer(mode="wrap")
|
|
21
|
+
def serialize_model(self, handler):
|
|
22
|
+
optional_fields = ["custom_id"]
|
|
23
|
+
nullable_fields = ["custom_id"]
|
|
24
|
+
null_default_fields = []
|
|
25
|
+
|
|
26
|
+
serialized = handler(self)
|
|
27
|
+
|
|
28
|
+
m = {}
|
|
29
|
+
|
|
30
|
+
for n, f in type(self).model_fields.items():
|
|
31
|
+
k = f.alias or n
|
|
32
|
+
val = serialized.get(k)
|
|
33
|
+
serialized.pop(k, None)
|
|
34
|
+
|
|
35
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
36
|
+
is_set = (
|
|
37
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
38
|
+
or k in null_default_fields
|
|
39
|
+
) # pylint: disable=no-member
|
|
40
|
+
|
|
41
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
42
|
+
m[k] = val
|
|
43
|
+
elif val != UNSET_SENTINEL and (
|
|
44
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
45
|
+
):
|
|
46
|
+
m[k] = val
|
|
47
|
+
|
|
48
|
+
return m
|
|
@@ -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",
|