mistralai 1.0.3__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/__init__.py +4 -0
- mistralai/_hooks/sdkhooks.py +23 -4
- mistralai/_hooks/types.py +27 -9
- mistralai/_version.py +12 -0
- mistralai/agents.py +334 -164
- mistralai/basesdk.py +90 -5
- mistralai/batch.py +17 -0
- mistralai/chat.py +316 -166
- mistralai/classifiers.py +396 -0
- mistralai/embeddings.py +79 -55
- mistralai/files.py +487 -194
- mistralai/fim.py +206 -132
- mistralai/fine_tuning.py +3 -2
- mistralai/jobs.py +392 -263
- mistralai/mistral_jobs.py +733 -0
- mistralai/models/__init__.py +593 -50
- mistralai/models/agentscompletionrequest.py +70 -17
- mistralai/models/agentscompletionstreamrequest.py +72 -17
- mistralai/models/apiendpoint.py +9 -0
- mistralai/models/archiveftmodelout.py +15 -5
- mistralai/models/assistantmessage.py +22 -10
- mistralai/models/{modelcard.py → basemodelcard.py} +53 -14
- 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 +13 -6
- mistralai/models/chatcompletionrequest.py +86 -21
- mistralai/models/chatcompletionresponse.py +8 -4
- mistralai/models/chatcompletionstreamrequest.py +88 -21
- mistralai/models/checkpointout.py +4 -3
- mistralai/models/classificationobject.py +21 -0
- mistralai/models/classificationrequest.py +59 -0
- mistralai/models/classificationresponse.py +21 -0
- mistralai/models/completionchunk.py +12 -5
- mistralai/models/completionevent.py +2 -3
- mistralai/models/completionresponsestreamchoice.py +22 -8
- mistralai/models/contentchunk.py +13 -10
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +5 -5
- mistralai/models/deletefileout.py +4 -3
- mistralai/models/deletemodelout.py +5 -4
- mistralai/models/deltamessage.py +23 -11
- mistralai/models/detailedjobout.py +70 -12
- mistralai/models/embeddingrequest.py +14 -9
- mistralai/models/embeddingresponse.py +7 -3
- mistralai/models/embeddingresponsedata.py +5 -4
- mistralai/models/eventout.py +11 -6
- mistralai/models/filepurpose.py +8 -0
- mistralai/models/files_api_routes_delete_fileop.py +5 -5
- 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 +5 -5
- mistralai/models/files_api_routes_upload_fileop.py +33 -14
- mistralai/models/fileschema.py +22 -15
- mistralai/models/fimcompletionrequest.py +44 -16
- mistralai/models/fimcompletionresponse.py +8 -4
- mistralai/models/fimcompletionstreamrequest.py +44 -16
- mistralai/models/finetuneablemodel.py +7 -1
- mistralai/models/ftmodelcapabilitiesout.py +6 -4
- mistralai/models/ftmodelcard.py +121 -0
- mistralai/models/ftmodelout.py +39 -9
- mistralai/models/function.py +5 -4
- mistralai/models/functioncall.py +4 -3
- mistralai/models/functionname.py +17 -0
- mistralai/models/githubrepositoryin.py +24 -7
- mistralai/models/githubrepositoryout.py +24 -7
- mistralai/models/httpvalidationerror.py +1 -3
- mistralai/models/imageurl.py +47 -0
- mistralai/models/imageurlchunk.py +38 -0
- mistralai/models/jobin.py +24 -7
- mistralai/models/jobmetadataout.py +32 -8
- mistralai/models/jobout.py +65 -12
- 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 +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +85 -18
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +5 -5
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +10 -6
- mistralai/models/jobsout.py +13 -5
- mistralai/models/legacyjobmetadataout.py +55 -9
- mistralai/models/listfilesout.py +7 -3
- mistralai/models/metricout.py +12 -8
- mistralai/models/modelcapabilities.py +9 -4
- mistralai/models/modellist.py +21 -7
- mistralai/models/responseformat.py +7 -8
- mistralai/models/responseformats.py +8 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +25 -6
- mistralai/models/retrievefileout.py +25 -15
- mistralai/models/sampletype.py +6 -2
- mistralai/models/security.py +14 -5
- mistralai/models/source.py +3 -2
- mistralai/models/systemmessage.py +10 -9
- mistralai/models/textchunk.py +14 -5
- mistralai/models/tool.py +10 -9
- mistralai/models/toolcall.py +10 -8
- mistralai/models/toolchoice.py +29 -0
- mistralai/models/toolchoiceenum.py +7 -0
- mistralai/models/toolmessage.py +13 -6
- mistralai/models/tooltypes.py +8 -0
- mistralai/models/trainingfile.py +4 -4
- mistralai/models/trainingparameters.py +34 -8
- mistralai/models/trainingparametersin.py +36 -10
- mistralai/models/unarchiveftmodelout.py +15 -5
- mistralai/models/updateftmodelin.py +9 -6
- mistralai/models/uploadfileout.py +22 -15
- mistralai/models/usageinfo.py +4 -3
- mistralai/models/usermessage.py +42 -10
- mistralai/models/validationerror.py +5 -3
- mistralai/models/wandbintegration.py +23 -7
- mistralai/models/wandbintegrationout.py +23 -8
- mistralai/models_.py +416 -294
- mistralai/sdk.py +31 -19
- mistralai/sdkconfiguration.py +9 -11
- mistralai/utils/__init__.py +14 -1
- mistralai/utils/annotations.py +13 -2
- mistralai/utils/logger.py +4 -1
- mistralai/utils/retries.py +2 -1
- mistralai/utils/security.py +13 -6
- mistralai/utils/serializers.py +25 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/METADATA +171 -66
- mistralai-1.2.0.dist-info/RECORD +276 -0
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/WHEEL +1 -1
- mistralai_azure/__init__.py +4 -0
- mistralai_azure/_hooks/sdkhooks.py +23 -4
- mistralai_azure/_hooks/types.py +27 -9
- mistralai_azure/_version.py +12 -0
- mistralai_azure/basesdk.py +91 -6
- mistralai_azure/chat.py +308 -166
- mistralai_azure/models/__init__.py +164 -16
- mistralai_azure/models/assistantmessage.py +29 -11
- mistralai_azure/models/chatcompletionchoice.py +15 -6
- mistralai_azure/models/chatcompletionrequest.py +94 -22
- mistralai_azure/models/chatcompletionresponse.py +8 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +96 -22
- mistralai_azure/models/completionchunk.py +12 -5
- mistralai_azure/models/completionevent.py +2 -3
- mistralai_azure/models/completionresponsestreamchoice.py +19 -8
- mistralai_azure/models/contentchunk.py +4 -11
- mistralai_azure/models/deltamessage.py +30 -12
- mistralai_azure/models/function.py +5 -4
- mistralai_azure/models/functioncall.py +4 -3
- mistralai_azure/models/functionname.py +17 -0
- mistralai_azure/models/httpvalidationerror.py +1 -3
- mistralai_azure/models/responseformat.py +7 -8
- mistralai_azure/models/responseformats.py +8 -0
- mistralai_azure/models/security.py +13 -5
- mistralai_azure/models/systemmessage.py +10 -9
- mistralai_azure/models/textchunk.py +14 -5
- mistralai_azure/models/tool.py +10 -9
- mistralai_azure/models/toolcall.py +10 -8
- mistralai_azure/models/toolchoice.py +29 -0
- mistralai_azure/models/toolchoiceenum.py +7 -0
- mistralai_azure/models/toolmessage.py +20 -7
- mistralai_azure/models/tooltypes.py +8 -0
- mistralai_azure/models/usageinfo.py +4 -3
- mistralai_azure/models/usermessage.py +42 -10
- mistralai_azure/models/validationerror.py +5 -3
- mistralai_azure/sdkconfiguration.py +9 -11
- mistralai_azure/utils/__init__.py +16 -3
- mistralai_azure/utils/annotations.py +13 -2
- mistralai_azure/utils/forms.py +10 -9
- mistralai_azure/utils/headers.py +8 -8
- mistralai_azure/utils/logger.py +6 -0
- mistralai_azure/utils/queryparams.py +16 -14
- mistralai_azure/utils/retries.py +2 -1
- mistralai_azure/utils/security.py +12 -6
- mistralai_azure/utils/serializers.py +42 -8
- mistralai_azure/utils/url.py +13 -8
- mistralai_azure/utils/values.py +6 -0
- mistralai_gcp/__init__.py +4 -0
- mistralai_gcp/_hooks/sdkhooks.py +23 -4
- mistralai_gcp/_hooks/types.py +27 -9
- mistralai_gcp/_version.py +12 -0
- mistralai_gcp/basesdk.py +91 -6
- mistralai_gcp/chat.py +308 -166
- mistralai_gcp/fim.py +198 -132
- mistralai_gcp/models/__init__.py +186 -18
- mistralai_gcp/models/assistantmessage.py +29 -11
- mistralai_gcp/models/chatcompletionchoice.py +15 -6
- mistralai_gcp/models/chatcompletionrequest.py +91 -22
- mistralai_gcp/models/chatcompletionresponse.py +8 -4
- mistralai_gcp/models/chatcompletionstreamrequest.py +93 -22
- mistralai_gcp/models/completionchunk.py +12 -5
- mistralai_gcp/models/completionevent.py +2 -3
- mistralai_gcp/models/completionresponsestreamchoice.py +19 -8
- mistralai_gcp/models/contentchunk.py +4 -11
- mistralai_gcp/models/deltamessage.py +30 -12
- mistralai_gcp/models/fimcompletionrequest.py +51 -17
- mistralai_gcp/models/fimcompletionresponse.py +8 -4
- mistralai_gcp/models/fimcompletionstreamrequest.py +51 -17
- mistralai_gcp/models/function.py +5 -4
- mistralai_gcp/models/functioncall.py +4 -3
- mistralai_gcp/models/functionname.py +17 -0
- mistralai_gcp/models/httpvalidationerror.py +1 -3
- mistralai_gcp/models/responseformat.py +7 -8
- mistralai_gcp/models/responseformats.py +8 -0
- mistralai_gcp/models/security.py +13 -5
- mistralai_gcp/models/systemmessage.py +10 -9
- mistralai_gcp/models/textchunk.py +14 -5
- mistralai_gcp/models/tool.py +10 -9
- mistralai_gcp/models/toolcall.py +10 -8
- mistralai_gcp/models/toolchoice.py +29 -0
- mistralai_gcp/models/toolchoiceenum.py +7 -0
- mistralai_gcp/models/toolmessage.py +20 -7
- mistralai_gcp/models/tooltypes.py +8 -0
- mistralai_gcp/models/usageinfo.py +4 -3
- mistralai_gcp/models/usermessage.py +42 -10
- mistralai_gcp/models/validationerror.py +5 -3
- mistralai_gcp/sdk.py +6 -7
- mistralai_gcp/sdkconfiguration.py +9 -11
- mistralai_gcp/utils/__init__.py +16 -3
- mistralai_gcp/utils/annotations.py +13 -2
- mistralai_gcp/utils/forms.py +10 -9
- mistralai_gcp/utils/headers.py +8 -8
- mistralai_gcp/utils/logger.py +6 -0
- mistralai_gcp/utils/queryparams.py +16 -14
- mistralai_gcp/utils/retries.py +2 -1
- mistralai_gcp/utils/security.py +12 -6
- mistralai_gcp/utils/serializers.py +42 -8
- mistralai_gcp/utils/url.py +13 -8
- mistralai_gcp/utils/values.py +6 -0
- mistralai-1.0.3.dist-info/RECORD +0 -236
- {mistralai-1.0.3.dist-info → mistralai-1.2.0.dist-info}/LICENSE +0 -0
mistralai/basesdk.py
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
from .sdkconfiguration import SDKConfiguration
|
|
4
4
|
import httpx
|
|
5
5
|
from mistralai import models, utils
|
|
6
|
-
from mistralai._hooks import
|
|
6
|
+
from mistralai._hooks import (
|
|
7
|
+
AfterErrorContext,
|
|
8
|
+
AfterSuccessContext,
|
|
9
|
+
BeforeRequestContext,
|
|
10
|
+
)
|
|
7
11
|
from mistralai.utils import RetryConfig, SerializedRequestBody, get_body_content
|
|
8
12
|
from typing import Callable, List, Optional, Tuple
|
|
9
13
|
|
|
14
|
+
|
|
10
15
|
class BaseSDK:
|
|
11
16
|
sdk_configuration: SDKConfiguration
|
|
12
17
|
|
|
@@ -24,6 +29,46 @@ class BaseSDK:
|
|
|
24
29
|
|
|
25
30
|
return utils.template_url(base_url, url_variables)
|
|
26
31
|
|
|
32
|
+
def build_request_async(
|
|
33
|
+
self,
|
|
34
|
+
method,
|
|
35
|
+
path,
|
|
36
|
+
base_url,
|
|
37
|
+
url_variables,
|
|
38
|
+
request,
|
|
39
|
+
request_body_required,
|
|
40
|
+
request_has_path_params,
|
|
41
|
+
request_has_query_params,
|
|
42
|
+
user_agent_header,
|
|
43
|
+
accept_header_value,
|
|
44
|
+
_globals=None,
|
|
45
|
+
security=None,
|
|
46
|
+
timeout_ms: Optional[int] = None,
|
|
47
|
+
get_serialized_body: Optional[
|
|
48
|
+
Callable[[], Optional[SerializedRequestBody]]
|
|
49
|
+
] = None,
|
|
50
|
+
url_override: Optional[str] = None,
|
|
51
|
+
) -> httpx.Request:
|
|
52
|
+
client = self.sdk_configuration.async_client
|
|
53
|
+
return self.build_request_with_client(
|
|
54
|
+
client,
|
|
55
|
+
method,
|
|
56
|
+
path,
|
|
57
|
+
base_url,
|
|
58
|
+
url_variables,
|
|
59
|
+
request,
|
|
60
|
+
request_body_required,
|
|
61
|
+
request_has_path_params,
|
|
62
|
+
request_has_query_params,
|
|
63
|
+
user_agent_header,
|
|
64
|
+
accept_header_value,
|
|
65
|
+
_globals,
|
|
66
|
+
security,
|
|
67
|
+
timeout_ms,
|
|
68
|
+
get_serialized_body,
|
|
69
|
+
url_override,
|
|
70
|
+
)
|
|
71
|
+
|
|
27
72
|
def build_request(
|
|
28
73
|
self,
|
|
29
74
|
method,
|
|
@@ -45,7 +90,46 @@ class BaseSDK:
|
|
|
45
90
|
url_override: Optional[str] = None,
|
|
46
91
|
) -> httpx.Request:
|
|
47
92
|
client = self.sdk_configuration.client
|
|
93
|
+
return self.build_request_with_client(
|
|
94
|
+
client,
|
|
95
|
+
method,
|
|
96
|
+
path,
|
|
97
|
+
base_url,
|
|
98
|
+
url_variables,
|
|
99
|
+
request,
|
|
100
|
+
request_body_required,
|
|
101
|
+
request_has_path_params,
|
|
102
|
+
request_has_query_params,
|
|
103
|
+
user_agent_header,
|
|
104
|
+
accept_header_value,
|
|
105
|
+
_globals,
|
|
106
|
+
security,
|
|
107
|
+
timeout_ms,
|
|
108
|
+
get_serialized_body,
|
|
109
|
+
url_override,
|
|
110
|
+
)
|
|
48
111
|
|
|
112
|
+
def build_request_with_client(
|
|
113
|
+
self,
|
|
114
|
+
client,
|
|
115
|
+
method,
|
|
116
|
+
path,
|
|
117
|
+
base_url,
|
|
118
|
+
url_variables,
|
|
119
|
+
request,
|
|
120
|
+
request_body_required,
|
|
121
|
+
request_has_path_params,
|
|
122
|
+
request_has_query_params,
|
|
123
|
+
user_agent_header,
|
|
124
|
+
accept_header_value,
|
|
125
|
+
_globals=None,
|
|
126
|
+
security=None,
|
|
127
|
+
timeout_ms: Optional[int] = None,
|
|
128
|
+
get_serialized_body: Optional[
|
|
129
|
+
Callable[[], Optional[SerializedRequestBody]]
|
|
130
|
+
] = None,
|
|
131
|
+
url_override: Optional[str] = None,
|
|
132
|
+
) -> httpx.Request:
|
|
49
133
|
query_params = {}
|
|
50
134
|
|
|
51
135
|
url = url_override
|
|
@@ -129,7 +213,7 @@ class BaseSDK:
|
|
|
129
213
|
req.method,
|
|
130
214
|
req.url,
|
|
131
215
|
req.headers,
|
|
132
|
-
get_body_content(req)
|
|
216
|
+
get_body_content(req),
|
|
133
217
|
)
|
|
134
218
|
http_res = client.send(req, stream=stream)
|
|
135
219
|
except Exception as e:
|
|
@@ -149,7 +233,7 @@ class BaseSDK:
|
|
|
149
233
|
http_res.status_code,
|
|
150
234
|
http_res.url,
|
|
151
235
|
http_res.headers,
|
|
152
|
-
"<streaming response>" if stream else http_res.text
|
|
236
|
+
"<streaming response>" if stream else http_res.text,
|
|
153
237
|
)
|
|
154
238
|
|
|
155
239
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
@@ -189,6 +273,7 @@ class BaseSDK:
|
|
|
189
273
|
) -> httpx.Response:
|
|
190
274
|
client = self.sdk_configuration.async_client
|
|
191
275
|
logger = self.sdk_configuration.debug_logger
|
|
276
|
+
|
|
192
277
|
async def do():
|
|
193
278
|
http_res = None
|
|
194
279
|
try:
|
|
@@ -200,7 +285,7 @@ class BaseSDK:
|
|
|
200
285
|
req.method,
|
|
201
286
|
req.url,
|
|
202
287
|
req.headers,
|
|
203
|
-
get_body_content(req)
|
|
288
|
+
get_body_content(req),
|
|
204
289
|
)
|
|
205
290
|
http_res = await client.send(req, stream=stream)
|
|
206
291
|
except Exception as e:
|
|
@@ -220,7 +305,7 @@ class BaseSDK:
|
|
|
220
305
|
http_res.status_code,
|
|
221
306
|
http_res.url,
|
|
222
307
|
http_res.headers,
|
|
223
|
-
"<streaming response>" if stream else http_res.text
|
|
308
|
+
"<streaming response>" if stream else http_res.text,
|
|
224
309
|
)
|
|
225
310
|
|
|
226
311
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
mistralai/batch.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from .sdkconfiguration import SDKConfiguration
|
|
5
|
+
from mistralai.mistral_jobs import MistralJobs
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Batch(BaseSDK):
|
|
9
|
+
jobs: MistralJobs
|
|
10
|
+
|
|
11
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
12
|
+
BaseSDK.__init__(self, sdk_config)
|
|
13
|
+
self.sdk_configuration = sdk_config
|
|
14
|
+
self._init_sdks()
|
|
15
|
+
|
|
16
|
+
def _init_sdks(self):
|
|
17
|
+
self.jobs = MistralJobs(self.sdk_configuration)
|