mistralai 1.1.0__py3-none-any.whl → 1.2.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/__init__.py +4 -0
- mistralai/_version.py +12 -0
- mistralai/agents.py +56 -22
- mistralai/batch.py +17 -0
- mistralai/chat.py +64 -30
- mistralai/classifiers.py +396 -0
- mistralai/embeddings.py +10 -6
- mistralai/files.py +252 -19
- mistralai/fim.py +40 -30
- mistralai/jobs.py +40 -20
- mistralai/mistral_jobs.py +733 -0
- mistralai/models/__init__.py +108 -18
- mistralai/models/agentscompletionrequest.py +27 -10
- mistralai/models/agentscompletionstreamrequest.py +27 -10
- mistralai/models/apiendpoint.py +9 -0
- mistralai/models/archiveftmodelout.py +11 -5
- mistralai/models/assistantmessage.py +11 -6
- mistralai/models/basemodelcard.py +22 -6
- mistralai/models/batcherror.py +17 -0
- mistralai/models/batchjobin.py +58 -0
- mistralai/models/batchjobout.py +117 -0
- mistralai/models/batchjobsout.py +30 -0
- mistralai/models/batchjobstatus.py +15 -0
- mistralai/models/chatclassificationrequest.py +104 -0
- mistralai/models/chatcompletionchoice.py +9 -4
- mistralai/models/chatcompletionrequest.py +32 -13
- mistralai/models/chatcompletionresponse.py +2 -2
- mistralai/models/chatcompletionstreamrequest.py +32 -13
- mistralai/models/checkpointout.py +1 -1
- mistralai/models/classificationobject.py +21 -0
- mistralai/models/classificationrequest.py +59 -0
- mistralai/models/classificationresponse.py +21 -0
- mistralai/models/completionchunk.py +2 -2
- mistralai/models/completionevent.py +1 -1
- mistralai/models/completionresponsestreamchoice.py +11 -5
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +1 -2
- mistralai/models/deletefileout.py +1 -1
- mistralai/models/deletemodelout.py +2 -2
- mistralai/models/deltamessage.py +14 -7
- mistralai/models/detailedjobout.py +11 -5
- mistralai/models/embeddingrequest.py +5 -5
- mistralai/models/embeddingresponse.py +2 -1
- mistralai/models/embeddingresponsedata.py +2 -2
- mistralai/models/eventout.py +2 -2
- mistralai/models/filepurpose.py +8 -0
- mistralai/models/files_api_routes_delete_fileop.py +1 -2
- mistralai/models/files_api_routes_download_fileop.py +16 -0
- mistralai/models/files_api_routes_list_filesop.py +96 -0
- mistralai/models/files_api_routes_retrieve_fileop.py +1 -2
- mistralai/models/files_api_routes_upload_fileop.py +9 -9
- mistralai/models/fileschema.py +7 -21
- mistralai/models/fimcompletionrequest.py +20 -13
- mistralai/models/fimcompletionresponse.py +2 -2
- mistralai/models/fimcompletionstreamrequest.py +20 -13
- mistralai/models/ftmodelcapabilitiesout.py +2 -2
- mistralai/models/ftmodelcard.py +24 -6
- mistralai/models/ftmodelout.py +9 -5
- mistralai/models/function.py +2 -2
- mistralai/models/functioncall.py +2 -1
- mistralai/models/functionname.py +1 -1
- mistralai/models/githubrepositoryin.py +11 -5
- mistralai/models/githubrepositoryout.py +11 -5
- mistralai/models/httpvalidationerror.py +0 -2
- mistralai/models/imageurl.py +1 -2
- mistralai/models/imageurlchunk.py +11 -5
- mistralai/models/jobin.py +2 -2
- mistralai/models/jobmetadataout.py +1 -2
- mistralai/models/jobout.py +10 -5
- mistralai/models/jobs_api_routes_batch_cancel_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +16 -0
- mistralai/models/jobs_api_routes_batch_get_batch_jobsop.py +95 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +2 -2
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +1 -2
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +1 -2
- mistralai/models/jobsout.py +9 -5
- mistralai/models/legacyjobmetadataout.py +12 -5
- mistralai/models/listfilesout.py +5 -1
- mistralai/models/metricout.py +1 -2
- mistralai/models/modelcapabilities.py +2 -2
- mistralai/models/modellist.py +2 -2
- mistralai/models/responseformat.py +2 -2
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -2
- mistralai/models/retrievefileout.py +10 -21
- mistralai/models/sampletype.py +6 -2
- mistralai/models/security.py +2 -2
- mistralai/models/source.py +3 -2
- mistralai/models/systemmessage.py +6 -6
- mistralai/models/textchunk.py +9 -5
- mistralai/models/tool.py +2 -2
- mistralai/models/toolcall.py +2 -2
- mistralai/models/toolchoice.py +2 -2
- mistralai/models/toolmessage.py +2 -2
- mistralai/models/trainingfile.py +2 -2
- mistralai/models/trainingparameters.py +7 -2
- mistralai/models/trainingparametersin.py +7 -2
- mistralai/models/unarchiveftmodelout.py +11 -5
- mistralai/models/updateftmodelin.py +1 -2
- mistralai/models/uploadfileout.py +7 -21
- mistralai/models/usageinfo.py +1 -1
- mistralai/models/usermessage.py +36 -5
- mistralai/models/validationerror.py +2 -1
- mistralai/models/wandbintegration.py +11 -5
- mistralai/models/wandbintegrationout.py +12 -6
- mistralai/models_.py +48 -24
- mistralai/sdk.py +7 -0
- mistralai/sdkconfiguration.py +7 -7
- mistralai/utils/__init__.py +8 -0
- mistralai/utils/annotations.py +13 -2
- mistralai/utils/serializers.py +25 -0
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/METADATA +90 -14
- mistralai-1.2.1.dist-info/RECORD +276 -0
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/WHEEL +1 -1
- mistralai_azure/__init__.py +4 -0
- mistralai_azure/_version.py +12 -0
- mistralai_azure/chat.py +64 -30
- mistralai_azure/models/__init__.py +9 -3
- mistralai_azure/models/assistantmessage.py +11 -6
- mistralai_azure/models/chatcompletionchoice.py +10 -5
- mistralai_azure/models/chatcompletionrequest.py +32 -13
- mistralai_azure/models/chatcompletionresponse.py +2 -2
- mistralai_azure/models/chatcompletionstreamrequest.py +32 -13
- mistralai_azure/models/completionchunk.py +2 -2
- mistralai_azure/models/completionevent.py +1 -1
- mistralai_azure/models/completionresponsestreamchoice.py +9 -4
- mistralai_azure/models/deltamessage.py +14 -7
- mistralai_azure/models/function.py +2 -2
- mistralai_azure/models/functioncall.py +2 -1
- mistralai_azure/models/functionname.py +1 -1
- mistralai_azure/models/httpvalidationerror.py +0 -2
- mistralai_azure/models/responseformat.py +2 -2
- mistralai_azure/models/security.py +1 -2
- mistralai_azure/models/systemmessage.py +6 -6
- mistralai_azure/models/textchunk.py +9 -5
- mistralai_azure/models/tool.py +2 -2
- mistralai_azure/models/toolcall.py +2 -2
- mistralai_azure/models/toolchoice.py +2 -2
- mistralai_azure/models/toolmessage.py +2 -2
- mistralai_azure/models/usageinfo.py +1 -1
- mistralai_azure/models/usermessage.py +36 -5
- mistralai_azure/models/validationerror.py +2 -1
- mistralai_azure/sdkconfiguration.py +7 -7
- mistralai_azure/utils/__init__.py +8 -0
- mistralai_azure/utils/annotations.py +13 -2
- mistralai_azure/utils/serializers.py +25 -0
- mistralai_gcp/__init__.py +4 -0
- mistralai_gcp/_version.py +12 -0
- mistralai_gcp/chat.py +64 -30
- mistralai_gcp/fim.py +40 -30
- mistralai_gcp/models/__init__.py +9 -3
- mistralai_gcp/models/assistantmessage.py +11 -6
- mistralai_gcp/models/chatcompletionchoice.py +10 -5
- mistralai_gcp/models/chatcompletionrequest.py +32 -13
- mistralai_gcp/models/chatcompletionresponse.py +2 -2
- mistralai_gcp/models/chatcompletionstreamrequest.py +32 -13
- mistralai_gcp/models/completionchunk.py +2 -2
- mistralai_gcp/models/completionevent.py +1 -1
- mistralai_gcp/models/completionresponsestreamchoice.py +9 -4
- mistralai_gcp/models/deltamessage.py +14 -7
- mistralai_gcp/models/fimcompletionrequest.py +20 -13
- mistralai_gcp/models/fimcompletionresponse.py +2 -2
- mistralai_gcp/models/fimcompletionstreamrequest.py +20 -13
- mistralai_gcp/models/function.py +2 -2
- mistralai_gcp/models/functioncall.py +2 -1
- mistralai_gcp/models/functionname.py +1 -1
- mistralai_gcp/models/httpvalidationerror.py +0 -2
- mistralai_gcp/models/responseformat.py +2 -2
- mistralai_gcp/models/security.py +1 -2
- mistralai_gcp/models/systemmessage.py +6 -6
- mistralai_gcp/models/textchunk.py +9 -5
- mistralai_gcp/models/tool.py +2 -2
- mistralai_gcp/models/toolcall.py +2 -2
- mistralai_gcp/models/toolchoice.py +2 -2
- mistralai_gcp/models/toolmessage.py +2 -2
- mistralai_gcp/models/usageinfo.py +1 -1
- mistralai_gcp/models/usermessage.py +36 -5
- mistralai_gcp/models/validationerror.py +2 -1
- mistralai_gcp/sdk.py +20 -11
- mistralai_gcp/sdkconfiguration.py +7 -7
- mistralai_gcp/utils/__init__.py +8 -0
- mistralai_gcp/utils/annotations.py +13 -2
- mistralai_gcp/utils/serializers.py +25 -0
- mistralai-1.1.0.dist-info/RECORD +0 -254
- {mistralai-1.1.0.dist-info → mistralai-1.2.1.dist-info}/LICENSE +0 -0
mistralai/fim.py
CHANGED
|
@@ -16,10 +16,9 @@ class Fim(BaseSDK):
|
|
|
16
16
|
*,
|
|
17
17
|
model: Nullable[str],
|
|
18
18
|
prompt: str,
|
|
19
|
-
temperature:
|
|
19
|
+
temperature: OptionalNullable[float] = UNSET,
|
|
20
20
|
top_p: Optional[float] = 1,
|
|
21
21
|
max_tokens: OptionalNullable[int] = UNSET,
|
|
22
|
-
min_tokens: OptionalNullable[int] = UNSET,
|
|
23
22
|
stream: Optional[bool] = False,
|
|
24
23
|
stop: Optional[
|
|
25
24
|
Union[
|
|
@@ -29,6 +28,7 @@ class Fim(BaseSDK):
|
|
|
29
28
|
] = None,
|
|
30
29
|
random_seed: OptionalNullable[int] = UNSET,
|
|
31
30
|
suffix: OptionalNullable[str] = UNSET,
|
|
31
|
+
min_tokens: OptionalNullable[int] = UNSET,
|
|
32
32
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
33
33
|
server_url: Optional[str] = None,
|
|
34
34
|
timeout_ms: Optional[int] = None,
|
|
@@ -39,14 +39,14 @@ class Fim(BaseSDK):
|
|
|
39
39
|
|
|
40
40
|
:param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
|
|
41
41
|
:param prompt: The text/code to complete.
|
|
42
|
-
:param temperature: What sampling temperature to use, between 0.0 and
|
|
42
|
+
:param temperature: What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.
|
|
43
43
|
:param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
|
|
44
44
|
:param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
|
|
45
|
-
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
46
45
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
|
|
47
46
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
48
47
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
49
48
|
:param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
|
|
49
|
+
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
50
50
|
:param retries: Override the default retry configuration for this method
|
|
51
51
|
:param server_url: Override the default server URL for this method
|
|
52
52
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -64,12 +64,12 @@ class Fim(BaseSDK):
|
|
|
64
64
|
temperature=temperature,
|
|
65
65
|
top_p=top_p,
|
|
66
66
|
max_tokens=max_tokens,
|
|
67
|
-
min_tokens=min_tokens,
|
|
68
67
|
stream=stream,
|
|
69
68
|
stop=stop,
|
|
70
69
|
random_seed=random_seed,
|
|
71
70
|
prompt=prompt,
|
|
72
71
|
suffix=suffix,
|
|
72
|
+
min_tokens=min_tokens,
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
req = self.build_request(
|
|
@@ -120,15 +120,17 @@ class Fim(BaseSDK):
|
|
|
120
120
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
121
121
|
raise models.HTTPValidationError(data=data)
|
|
122
122
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
123
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
123
124
|
raise models.SDKError(
|
|
124
|
-
"API error occurred", http_res.status_code,
|
|
125
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
125
126
|
)
|
|
126
127
|
|
|
127
128
|
content_type = http_res.headers.get("Content-Type")
|
|
129
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
128
130
|
raise models.SDKError(
|
|
129
131
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
130
132
|
http_res.status_code,
|
|
131
|
-
|
|
133
|
+
http_res_text,
|
|
132
134
|
http_res,
|
|
133
135
|
)
|
|
134
136
|
|
|
@@ -137,10 +139,9 @@ class Fim(BaseSDK):
|
|
|
137
139
|
*,
|
|
138
140
|
model: Nullable[str],
|
|
139
141
|
prompt: str,
|
|
140
|
-
temperature:
|
|
142
|
+
temperature: OptionalNullable[float] = UNSET,
|
|
141
143
|
top_p: Optional[float] = 1,
|
|
142
144
|
max_tokens: OptionalNullable[int] = UNSET,
|
|
143
|
-
min_tokens: OptionalNullable[int] = UNSET,
|
|
144
145
|
stream: Optional[bool] = False,
|
|
145
146
|
stop: Optional[
|
|
146
147
|
Union[
|
|
@@ -150,6 +151,7 @@ class Fim(BaseSDK):
|
|
|
150
151
|
] = None,
|
|
151
152
|
random_seed: OptionalNullable[int] = UNSET,
|
|
152
153
|
suffix: OptionalNullable[str] = UNSET,
|
|
154
|
+
min_tokens: OptionalNullable[int] = UNSET,
|
|
153
155
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
154
156
|
server_url: Optional[str] = None,
|
|
155
157
|
timeout_ms: Optional[int] = None,
|
|
@@ -160,14 +162,14 @@ class Fim(BaseSDK):
|
|
|
160
162
|
|
|
161
163
|
:param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
|
|
162
164
|
:param prompt: The text/code to complete.
|
|
163
|
-
:param temperature: What sampling temperature to use, between 0.0 and
|
|
165
|
+
:param temperature: What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.
|
|
164
166
|
:param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
|
|
165
167
|
:param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
|
|
166
|
-
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
167
168
|
:param stream: Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
|
|
168
169
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
169
170
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
170
171
|
:param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
|
|
172
|
+
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
171
173
|
:param retries: Override the default retry configuration for this method
|
|
172
174
|
:param server_url: Override the default server URL for this method
|
|
173
175
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -185,12 +187,12 @@ class Fim(BaseSDK):
|
|
|
185
187
|
temperature=temperature,
|
|
186
188
|
top_p=top_p,
|
|
187
189
|
max_tokens=max_tokens,
|
|
188
|
-
min_tokens=min_tokens,
|
|
189
190
|
stream=stream,
|
|
190
191
|
stop=stop,
|
|
191
192
|
random_seed=random_seed,
|
|
192
193
|
prompt=prompt,
|
|
193
194
|
suffix=suffix,
|
|
195
|
+
min_tokens=min_tokens,
|
|
194
196
|
)
|
|
195
197
|
|
|
196
198
|
req = self.build_request_async(
|
|
@@ -241,15 +243,17 @@ class Fim(BaseSDK):
|
|
|
241
243
|
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
242
244
|
raise models.HTTPValidationError(data=data)
|
|
243
245
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
246
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
244
247
|
raise models.SDKError(
|
|
245
|
-
"API error occurred", http_res.status_code,
|
|
248
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
246
249
|
)
|
|
247
250
|
|
|
248
251
|
content_type = http_res.headers.get("Content-Type")
|
|
252
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
249
253
|
raise models.SDKError(
|
|
250
254
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
251
255
|
http_res.status_code,
|
|
252
|
-
|
|
256
|
+
http_res_text,
|
|
253
257
|
http_res,
|
|
254
258
|
)
|
|
255
259
|
|
|
@@ -258,10 +262,9 @@ class Fim(BaseSDK):
|
|
|
258
262
|
*,
|
|
259
263
|
model: Nullable[str],
|
|
260
264
|
prompt: str,
|
|
261
|
-
temperature:
|
|
265
|
+
temperature: OptionalNullable[float] = UNSET,
|
|
262
266
|
top_p: Optional[float] = 1,
|
|
263
267
|
max_tokens: OptionalNullable[int] = UNSET,
|
|
264
|
-
min_tokens: OptionalNullable[int] = UNSET,
|
|
265
268
|
stream: Optional[bool] = True,
|
|
266
269
|
stop: Optional[
|
|
267
270
|
Union[
|
|
@@ -271,6 +274,7 @@ class Fim(BaseSDK):
|
|
|
271
274
|
] = None,
|
|
272
275
|
random_seed: OptionalNullable[int] = UNSET,
|
|
273
276
|
suffix: OptionalNullable[str] = UNSET,
|
|
277
|
+
min_tokens: OptionalNullable[int] = UNSET,
|
|
274
278
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
275
279
|
server_url: Optional[str] = None,
|
|
276
280
|
timeout_ms: Optional[int] = None,
|
|
@@ -281,14 +285,14 @@ class Fim(BaseSDK):
|
|
|
281
285
|
|
|
282
286
|
:param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
|
|
283
287
|
:param prompt: The text/code to complete.
|
|
284
|
-
:param temperature: What sampling temperature to use, between 0.0 and
|
|
288
|
+
:param temperature: What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.
|
|
285
289
|
:param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
|
|
286
290
|
:param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
|
|
287
|
-
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
288
291
|
:param stream:
|
|
289
292
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
290
293
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
291
294
|
:param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
|
|
295
|
+
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
292
296
|
:param retries: Override the default retry configuration for this method
|
|
293
297
|
:param server_url: Override the default server URL for this method
|
|
294
298
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -306,12 +310,12 @@ class Fim(BaseSDK):
|
|
|
306
310
|
temperature=temperature,
|
|
307
311
|
top_p=top_p,
|
|
308
312
|
max_tokens=max_tokens,
|
|
309
|
-
min_tokens=min_tokens,
|
|
310
313
|
stream=stream,
|
|
311
314
|
stop=stop,
|
|
312
315
|
random_seed=random_seed,
|
|
313
316
|
prompt=prompt,
|
|
314
317
|
suffix=suffix,
|
|
318
|
+
min_tokens=min_tokens,
|
|
315
319
|
)
|
|
316
320
|
|
|
317
321
|
req = self.build_request(
|
|
@@ -362,18 +366,21 @@ class Fim(BaseSDK):
|
|
|
362
366
|
sentinel="[DONE]",
|
|
363
367
|
)
|
|
364
368
|
if utils.match_response(http_res, "422", "application/json"):
|
|
365
|
-
|
|
369
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
370
|
+
data = utils.unmarshal_json(http_res_text, models.HTTPValidationErrorData)
|
|
366
371
|
raise models.HTTPValidationError(data=data)
|
|
367
372
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
373
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
368
374
|
raise models.SDKError(
|
|
369
|
-
"API error occurred", http_res.status_code,
|
|
375
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
370
376
|
)
|
|
371
377
|
|
|
372
378
|
content_type = http_res.headers.get("Content-Type")
|
|
379
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
373
380
|
raise models.SDKError(
|
|
374
381
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
375
382
|
http_res.status_code,
|
|
376
|
-
|
|
383
|
+
http_res_text,
|
|
377
384
|
http_res,
|
|
378
385
|
)
|
|
379
386
|
|
|
@@ -382,10 +389,9 @@ class Fim(BaseSDK):
|
|
|
382
389
|
*,
|
|
383
390
|
model: Nullable[str],
|
|
384
391
|
prompt: str,
|
|
385
|
-
temperature:
|
|
392
|
+
temperature: OptionalNullable[float] = UNSET,
|
|
386
393
|
top_p: Optional[float] = 1,
|
|
387
394
|
max_tokens: OptionalNullable[int] = UNSET,
|
|
388
|
-
min_tokens: OptionalNullable[int] = UNSET,
|
|
389
395
|
stream: Optional[bool] = True,
|
|
390
396
|
stop: Optional[
|
|
391
397
|
Union[
|
|
@@ -395,6 +401,7 @@ class Fim(BaseSDK):
|
|
|
395
401
|
] = None,
|
|
396
402
|
random_seed: OptionalNullable[int] = UNSET,
|
|
397
403
|
suffix: OptionalNullable[str] = UNSET,
|
|
404
|
+
min_tokens: OptionalNullable[int] = UNSET,
|
|
398
405
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
399
406
|
server_url: Optional[str] = None,
|
|
400
407
|
timeout_ms: Optional[int] = None,
|
|
@@ -405,14 +412,14 @@ class Fim(BaseSDK):
|
|
|
405
412
|
|
|
406
413
|
:param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
|
|
407
414
|
:param prompt: The text/code to complete.
|
|
408
|
-
:param temperature: What sampling temperature to use, between 0.0 and
|
|
415
|
+
:param temperature: What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. The default value varies depending on the model you are targeting. Call the `/models` endpoint to retrieve the appropriate value.
|
|
409
416
|
:param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
|
|
410
417
|
:param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
|
|
411
|
-
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
412
418
|
:param stream:
|
|
413
419
|
:param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
|
|
414
420
|
:param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
|
|
415
421
|
:param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
|
|
422
|
+
:param min_tokens: The minimum number of tokens to generate in the completion.
|
|
416
423
|
:param retries: Override the default retry configuration for this method
|
|
417
424
|
:param server_url: Override the default server URL for this method
|
|
418
425
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -430,12 +437,12 @@ class Fim(BaseSDK):
|
|
|
430
437
|
temperature=temperature,
|
|
431
438
|
top_p=top_p,
|
|
432
439
|
max_tokens=max_tokens,
|
|
433
|
-
min_tokens=min_tokens,
|
|
434
440
|
stream=stream,
|
|
435
441
|
stop=stop,
|
|
436
442
|
random_seed=random_seed,
|
|
437
443
|
prompt=prompt,
|
|
438
444
|
suffix=suffix,
|
|
445
|
+
min_tokens=min_tokens,
|
|
439
446
|
)
|
|
440
447
|
|
|
441
448
|
req = self.build_request_async(
|
|
@@ -486,17 +493,20 @@ class Fim(BaseSDK):
|
|
|
486
493
|
sentinel="[DONE]",
|
|
487
494
|
)
|
|
488
495
|
if utils.match_response(http_res, "422", "application/json"):
|
|
489
|
-
|
|
496
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
497
|
+
data = utils.unmarshal_json(http_res_text, models.HTTPValidationErrorData)
|
|
490
498
|
raise models.HTTPValidationError(data=data)
|
|
491
499
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
500
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
492
501
|
raise models.SDKError(
|
|
493
|
-
"API error occurred", http_res.status_code,
|
|
502
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
494
503
|
)
|
|
495
504
|
|
|
496
505
|
content_type = http_res.headers.get("Content-Type")
|
|
506
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
497
507
|
raise models.SDKError(
|
|
498
508
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
499
509
|
http_res.status_code,
|
|
500
|
-
|
|
510
|
+
http_res_text,
|
|
501
511
|
http_res,
|
|
502
512
|
)
|
mistralai/jobs.py
CHANGED
|
@@ -102,15 +102,17 @@ class Jobs(BaseSDK):
|
|
|
102
102
|
if utils.match_response(http_res, "200", "application/json"):
|
|
103
103
|
return utils.unmarshal_json(http_res.text, Optional[models.JobsOut])
|
|
104
104
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
105
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
105
106
|
raise models.SDKError(
|
|
106
|
-
"API error occurred", http_res.status_code,
|
|
107
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
107
108
|
)
|
|
108
109
|
|
|
109
110
|
content_type = http_res.headers.get("Content-Type")
|
|
111
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
110
112
|
raise models.SDKError(
|
|
111
113
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
112
114
|
http_res.status_code,
|
|
113
|
-
|
|
115
|
+
http_res_text,
|
|
114
116
|
http_res,
|
|
115
117
|
)
|
|
116
118
|
|
|
@@ -206,15 +208,17 @@ class Jobs(BaseSDK):
|
|
|
206
208
|
if utils.match_response(http_res, "200", "application/json"):
|
|
207
209
|
return utils.unmarshal_json(http_res.text, Optional[models.JobsOut])
|
|
208
210
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
211
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
209
212
|
raise models.SDKError(
|
|
210
|
-
"API error occurred", http_res.status_code,
|
|
213
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
211
214
|
)
|
|
212
215
|
|
|
213
216
|
content_type = http_res.headers.get("Content-Type")
|
|
217
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
214
218
|
raise models.SDKError(
|
|
215
219
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
216
220
|
http_res.status_code,
|
|
217
|
-
|
|
221
|
+
http_res_text,
|
|
218
222
|
http_res,
|
|
219
223
|
)
|
|
220
224
|
|
|
@@ -333,15 +337,17 @@ class Jobs(BaseSDK):
|
|
|
333
337
|
Optional[models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse],
|
|
334
338
|
)
|
|
335
339
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
340
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
336
341
|
raise models.SDKError(
|
|
337
|
-
"API error occurred", http_res.status_code,
|
|
342
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
338
343
|
)
|
|
339
344
|
|
|
340
345
|
content_type = http_res.headers.get("Content-Type")
|
|
346
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
341
347
|
raise models.SDKError(
|
|
342
348
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
343
349
|
http_res.status_code,
|
|
344
|
-
|
|
350
|
+
http_res_text,
|
|
345
351
|
http_res,
|
|
346
352
|
)
|
|
347
353
|
|
|
@@ -460,15 +466,17 @@ class Jobs(BaseSDK):
|
|
|
460
466
|
Optional[models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse],
|
|
461
467
|
)
|
|
462
468
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
469
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
463
470
|
raise models.SDKError(
|
|
464
|
-
"API error occurred", http_res.status_code,
|
|
471
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
465
472
|
)
|
|
466
473
|
|
|
467
474
|
content_type = http_res.headers.get("Content-Type")
|
|
475
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
468
476
|
raise models.SDKError(
|
|
469
477
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
470
478
|
http_res.status_code,
|
|
471
|
-
|
|
479
|
+
http_res_text,
|
|
472
480
|
http_res,
|
|
473
481
|
)
|
|
474
482
|
|
|
@@ -540,15 +548,17 @@ class Jobs(BaseSDK):
|
|
|
540
548
|
if utils.match_response(http_res, "200", "application/json"):
|
|
541
549
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
542
550
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
551
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
543
552
|
raise models.SDKError(
|
|
544
|
-
"API error occurred", http_res.status_code,
|
|
553
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
545
554
|
)
|
|
546
555
|
|
|
547
556
|
content_type = http_res.headers.get("Content-Type")
|
|
557
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
548
558
|
raise models.SDKError(
|
|
549
559
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
550
560
|
http_res.status_code,
|
|
551
|
-
|
|
561
|
+
http_res_text,
|
|
552
562
|
http_res,
|
|
553
563
|
)
|
|
554
564
|
|
|
@@ -620,15 +630,17 @@ class Jobs(BaseSDK):
|
|
|
620
630
|
if utils.match_response(http_res, "200", "application/json"):
|
|
621
631
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
622
632
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
633
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
623
634
|
raise models.SDKError(
|
|
624
|
-
"API error occurred", http_res.status_code,
|
|
635
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
625
636
|
)
|
|
626
637
|
|
|
627
638
|
content_type = http_res.headers.get("Content-Type")
|
|
639
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
628
640
|
raise models.SDKError(
|
|
629
641
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
630
642
|
http_res.status_code,
|
|
631
|
-
|
|
643
|
+
http_res_text,
|
|
632
644
|
http_res,
|
|
633
645
|
)
|
|
634
646
|
|
|
@@ -700,15 +712,17 @@ class Jobs(BaseSDK):
|
|
|
700
712
|
if utils.match_response(http_res, "200", "application/json"):
|
|
701
713
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
702
714
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
715
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
703
716
|
raise models.SDKError(
|
|
704
|
-
"API error occurred", http_res.status_code,
|
|
717
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
705
718
|
)
|
|
706
719
|
|
|
707
720
|
content_type = http_res.headers.get("Content-Type")
|
|
721
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
708
722
|
raise models.SDKError(
|
|
709
723
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
710
724
|
http_res.status_code,
|
|
711
|
-
|
|
725
|
+
http_res_text,
|
|
712
726
|
http_res,
|
|
713
727
|
)
|
|
714
728
|
|
|
@@ -780,15 +794,17 @@ class Jobs(BaseSDK):
|
|
|
780
794
|
if utils.match_response(http_res, "200", "application/json"):
|
|
781
795
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
782
796
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
797
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
783
798
|
raise models.SDKError(
|
|
784
|
-
"API error occurred", http_res.status_code,
|
|
799
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
785
800
|
)
|
|
786
801
|
|
|
787
802
|
content_type = http_res.headers.get("Content-Type")
|
|
803
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
788
804
|
raise models.SDKError(
|
|
789
805
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
790
806
|
http_res.status_code,
|
|
791
|
-
|
|
807
|
+
http_res_text,
|
|
792
808
|
http_res,
|
|
793
809
|
)
|
|
794
810
|
|
|
@@ -860,15 +876,17 @@ class Jobs(BaseSDK):
|
|
|
860
876
|
if utils.match_response(http_res, "200", "application/json"):
|
|
861
877
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
862
878
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
879
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
863
880
|
raise models.SDKError(
|
|
864
|
-
"API error occurred", http_res.status_code,
|
|
881
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
865
882
|
)
|
|
866
883
|
|
|
867
884
|
content_type = http_res.headers.get("Content-Type")
|
|
885
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
868
886
|
raise models.SDKError(
|
|
869
887
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
870
888
|
http_res.status_code,
|
|
871
|
-
|
|
889
|
+
http_res_text,
|
|
872
890
|
http_res,
|
|
873
891
|
)
|
|
874
892
|
|
|
@@ -940,14 +958,16 @@ class Jobs(BaseSDK):
|
|
|
940
958
|
if utils.match_response(http_res, "200", "application/json"):
|
|
941
959
|
return utils.unmarshal_json(http_res.text, Optional[models.DetailedJobOut])
|
|
942
960
|
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
|
961
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
943
962
|
raise models.SDKError(
|
|
944
|
-
"API error occurred", http_res.status_code,
|
|
963
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
945
964
|
)
|
|
946
965
|
|
|
947
966
|
content_type = http_res.headers.get("Content-Type")
|
|
967
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
948
968
|
raise models.SDKError(
|
|
949
969
|
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
950
970
|
http_res.status_code,
|
|
951
|
-
|
|
971
|
+
http_res_text,
|
|
952
972
|
http_res,
|
|
953
973
|
)
|