mistralai 1.4.0__py3-none-any.whl → 1.5.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/_version.py +3 -3
- mistralai/chat.py +87 -5
- mistralai/classifiers.py +27 -25
- mistralai/embeddings.py +2 -8
- mistralai/extra/README.md +56 -0
- mistralai/extra/__init__.py +5 -0
- mistralai/extra/struct_chat.py +41 -0
- mistralai/extra/tests/__init__.py +0 -0
- mistralai/extra/tests/test_struct_chat.py +103 -0
- mistralai/extra/tests/test_utils.py +162 -0
- mistralai/extra/utils/__init__.py +3 -0
- mistralai/extra/utils/_pydantic_helper.py +20 -0
- mistralai/extra/utils/response_format.py +24 -0
- mistralai/fim.py +5 -5
- mistralai/httpclient.py +50 -0
- mistralai/models/__init__.py +41 -16
- mistralai/models/assistantmessage.py +2 -0
- mistralai/models/chatcompletionrequest.py +3 -10
- mistralai/models/chatcompletionstreamrequest.py +3 -10
- mistralai/models/chatmoderationrequest.py +86 -0
- mistralai/models/classificationrequest.py +7 -36
- mistralai/models/contentchunk.py +8 -1
- mistralai/models/documenturlchunk.py +62 -0
- mistralai/models/embeddingrequest.py +1 -37
- mistralai/models/fimcompletionrequest.py +2 -3
- mistralai/models/fimcompletionstreamrequest.py +2 -3
- mistralai/models/jsonschema.py +55 -0
- mistralai/models/ocrimageobject.py +77 -0
- mistralai/models/ocrpagedimensions.py +25 -0
- mistralai/models/ocrpageobject.py +64 -0
- mistralai/models/ocrrequest.py +97 -0
- mistralai/models/ocrresponse.py +26 -0
- mistralai/models/ocrusageinfo.py +51 -0
- mistralai/models/prediction.py +4 -5
- mistralai/models/responseformat.py +36 -1
- mistralai/models/responseformats.py +1 -1
- mistralai/ocr.py +238 -0
- mistralai/sdk.py +15 -2
- {mistralai-1.4.0.dist-info → mistralai-1.5.1.dist-info}/METADATA +37 -1
- {mistralai-1.4.0.dist-info → mistralai-1.5.1.dist-info}/RECORD +42 -24
- {mistralai-1.4.0.dist-info → mistralai-1.5.1.dist-info}/WHEEL +1 -1
- mistralai/models/chatclassificationrequest.py +0 -113
- {mistralai-1.4.0.dist-info → mistralai-1.5.1.dist-info}/LICENSE +0 -0
mistralai/ocr.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from mistralai import models, utils
|
|
5
|
+
from mistralai._hooks import HookContext
|
|
6
|
+
from mistralai.types import Nullable, OptionalNullable, UNSET
|
|
7
|
+
from mistralai.utils import get_security_from_env
|
|
8
|
+
from typing import Any, List, Mapping, Optional, Union
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Ocr(BaseSDK):
|
|
12
|
+
r"""OCR API"""
|
|
13
|
+
|
|
14
|
+
def process(
|
|
15
|
+
self,
|
|
16
|
+
*,
|
|
17
|
+
model: Nullable[str],
|
|
18
|
+
document: Union[models.Document, models.DocumentTypedDict],
|
|
19
|
+
id: Optional[str] = None,
|
|
20
|
+
pages: OptionalNullable[List[int]] = UNSET,
|
|
21
|
+
include_image_base64: OptionalNullable[bool] = UNSET,
|
|
22
|
+
image_limit: OptionalNullable[int] = UNSET,
|
|
23
|
+
image_min_size: OptionalNullable[int] = UNSET,
|
|
24
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
25
|
+
server_url: Optional[str] = None,
|
|
26
|
+
timeout_ms: Optional[int] = None,
|
|
27
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
28
|
+
) -> models.OCRResponse:
|
|
29
|
+
r"""OCR
|
|
30
|
+
|
|
31
|
+
:param model:
|
|
32
|
+
:param document: Document to run OCR on
|
|
33
|
+
:param id:
|
|
34
|
+
:param pages: Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0
|
|
35
|
+
:param include_image_base64: Include image URLs in response
|
|
36
|
+
:param image_limit: Max images to extract
|
|
37
|
+
:param image_min_size: Minimum height and width of image to extract
|
|
38
|
+
:param retries: Override the default retry configuration for this method
|
|
39
|
+
:param server_url: Override the default server URL for this method
|
|
40
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
41
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
42
|
+
"""
|
|
43
|
+
base_url = None
|
|
44
|
+
url_variables = None
|
|
45
|
+
if timeout_ms is None:
|
|
46
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
47
|
+
|
|
48
|
+
if server_url is not None:
|
|
49
|
+
base_url = server_url
|
|
50
|
+
|
|
51
|
+
request = models.OCRRequest(
|
|
52
|
+
model=model,
|
|
53
|
+
id=id,
|
|
54
|
+
document=utils.get_pydantic_model(document, models.Document),
|
|
55
|
+
pages=pages,
|
|
56
|
+
include_image_base64=include_image_base64,
|
|
57
|
+
image_limit=image_limit,
|
|
58
|
+
image_min_size=image_min_size,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
req = self._build_request(
|
|
62
|
+
method="POST",
|
|
63
|
+
path="/v1/ocr",
|
|
64
|
+
base_url=base_url,
|
|
65
|
+
url_variables=url_variables,
|
|
66
|
+
request=request,
|
|
67
|
+
request_body_required=True,
|
|
68
|
+
request_has_path_params=False,
|
|
69
|
+
request_has_query_params=True,
|
|
70
|
+
user_agent_header="user-agent",
|
|
71
|
+
accept_header_value="application/json",
|
|
72
|
+
http_headers=http_headers,
|
|
73
|
+
security=self.sdk_configuration.security,
|
|
74
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
75
|
+
request, False, False, "json", models.OCRRequest
|
|
76
|
+
),
|
|
77
|
+
timeout_ms=timeout_ms,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
if retries == UNSET:
|
|
81
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
82
|
+
retries = self.sdk_configuration.retry_config
|
|
83
|
+
|
|
84
|
+
retry_config = None
|
|
85
|
+
if isinstance(retries, utils.RetryConfig):
|
|
86
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
87
|
+
|
|
88
|
+
http_res = self.do_request(
|
|
89
|
+
hook_ctx=HookContext(
|
|
90
|
+
operation_id="ocr_v1_ocr_post",
|
|
91
|
+
oauth2_scopes=[],
|
|
92
|
+
security_source=get_security_from_env(
|
|
93
|
+
self.sdk_configuration.security, models.Security
|
|
94
|
+
),
|
|
95
|
+
),
|
|
96
|
+
request=req,
|
|
97
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
98
|
+
retry_config=retry_config,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
data: Any = None
|
|
102
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
103
|
+
return utils.unmarshal_json(http_res.text, models.OCRResponse)
|
|
104
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
105
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
106
|
+
raise models.HTTPValidationError(data=data)
|
|
107
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
108
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
109
|
+
raise models.SDKError(
|
|
110
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
111
|
+
)
|
|
112
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
113
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
114
|
+
raise models.SDKError(
|
|
115
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
content_type = http_res.headers.get("Content-Type")
|
|
119
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
120
|
+
raise models.SDKError(
|
|
121
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
122
|
+
http_res.status_code,
|
|
123
|
+
http_res_text,
|
|
124
|
+
http_res,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
async def process_async(
|
|
128
|
+
self,
|
|
129
|
+
*,
|
|
130
|
+
model: Nullable[str],
|
|
131
|
+
document: Union[models.Document, models.DocumentTypedDict],
|
|
132
|
+
id: Optional[str] = None,
|
|
133
|
+
pages: OptionalNullable[List[int]] = UNSET,
|
|
134
|
+
include_image_base64: OptionalNullable[bool] = UNSET,
|
|
135
|
+
image_limit: OptionalNullable[int] = UNSET,
|
|
136
|
+
image_min_size: OptionalNullable[int] = UNSET,
|
|
137
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
138
|
+
server_url: Optional[str] = None,
|
|
139
|
+
timeout_ms: Optional[int] = None,
|
|
140
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
141
|
+
) -> models.OCRResponse:
|
|
142
|
+
r"""OCR
|
|
143
|
+
|
|
144
|
+
:param model:
|
|
145
|
+
:param document: Document to run OCR on
|
|
146
|
+
:param id:
|
|
147
|
+
:param pages: Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0
|
|
148
|
+
:param include_image_base64: Include image URLs in response
|
|
149
|
+
:param image_limit: Max images to extract
|
|
150
|
+
:param image_min_size: Minimum height and width of image to extract
|
|
151
|
+
:param retries: Override the default retry configuration for this method
|
|
152
|
+
:param server_url: Override the default server URL for this method
|
|
153
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
154
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
155
|
+
"""
|
|
156
|
+
base_url = None
|
|
157
|
+
url_variables = None
|
|
158
|
+
if timeout_ms is None:
|
|
159
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
160
|
+
|
|
161
|
+
if server_url is not None:
|
|
162
|
+
base_url = server_url
|
|
163
|
+
|
|
164
|
+
request = models.OCRRequest(
|
|
165
|
+
model=model,
|
|
166
|
+
id=id,
|
|
167
|
+
document=utils.get_pydantic_model(document, models.Document),
|
|
168
|
+
pages=pages,
|
|
169
|
+
include_image_base64=include_image_base64,
|
|
170
|
+
image_limit=image_limit,
|
|
171
|
+
image_min_size=image_min_size,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
req = self._build_request_async(
|
|
175
|
+
method="POST",
|
|
176
|
+
path="/v1/ocr",
|
|
177
|
+
base_url=base_url,
|
|
178
|
+
url_variables=url_variables,
|
|
179
|
+
request=request,
|
|
180
|
+
request_body_required=True,
|
|
181
|
+
request_has_path_params=False,
|
|
182
|
+
request_has_query_params=True,
|
|
183
|
+
user_agent_header="user-agent",
|
|
184
|
+
accept_header_value="application/json",
|
|
185
|
+
http_headers=http_headers,
|
|
186
|
+
security=self.sdk_configuration.security,
|
|
187
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
188
|
+
request, False, False, "json", models.OCRRequest
|
|
189
|
+
),
|
|
190
|
+
timeout_ms=timeout_ms,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
if retries == UNSET:
|
|
194
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
195
|
+
retries = self.sdk_configuration.retry_config
|
|
196
|
+
|
|
197
|
+
retry_config = None
|
|
198
|
+
if isinstance(retries, utils.RetryConfig):
|
|
199
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
200
|
+
|
|
201
|
+
http_res = await self.do_request_async(
|
|
202
|
+
hook_ctx=HookContext(
|
|
203
|
+
operation_id="ocr_v1_ocr_post",
|
|
204
|
+
oauth2_scopes=[],
|
|
205
|
+
security_source=get_security_from_env(
|
|
206
|
+
self.sdk_configuration.security, models.Security
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
request=req,
|
|
210
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
211
|
+
retry_config=retry_config,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
data: Any = None
|
|
215
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
216
|
+
return utils.unmarshal_json(http_res.text, models.OCRResponse)
|
|
217
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
218
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
|
219
|
+
raise models.HTTPValidationError(data=data)
|
|
220
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
221
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
222
|
+
raise models.SDKError(
|
|
223
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
224
|
+
)
|
|
225
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
226
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
227
|
+
raise models.SDKError(
|
|
228
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
content_type = http_res.headers.get("Content-Type")
|
|
232
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
233
|
+
raise models.SDKError(
|
|
234
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
235
|
+
http_res.status_code,
|
|
236
|
+
http_res_text,
|
|
237
|
+
http_res,
|
|
238
|
+
)
|
mistralai/sdk.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
|
-
from .httpclient import AsyncHttpClient, HttpClient
|
|
4
|
+
from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients
|
|
5
5
|
from .sdkconfiguration import SDKConfiguration
|
|
6
6
|
from .utils.logger import Logger, get_default_logger
|
|
7
7
|
from .utils.retries import RetryConfig
|
|
@@ -17,8 +17,10 @@ from mistralai.files import Files
|
|
|
17
17
|
from mistralai.fim import Fim
|
|
18
18
|
from mistralai.fine_tuning import FineTuning
|
|
19
19
|
from mistralai.models_ import Models
|
|
20
|
+
from mistralai.ocr import Ocr
|
|
20
21
|
from mistralai.types import OptionalNullable, UNSET
|
|
21
|
-
from typing import Any, Callable, Dict, Optional, Union
|
|
22
|
+
from typing import Any, Callable, Dict, Optional, Union, cast
|
|
23
|
+
import weakref
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
class Mistral(BaseSDK):
|
|
@@ -40,6 +42,8 @@ class Mistral(BaseSDK):
|
|
|
40
42
|
r"""Embeddings API."""
|
|
41
43
|
classifiers: Classifiers
|
|
42
44
|
r"""Classifiers API."""
|
|
45
|
+
ocr: Ocr
|
|
46
|
+
r"""OCR API"""
|
|
43
47
|
|
|
44
48
|
def __init__(
|
|
45
49
|
self,
|
|
@@ -118,6 +122,14 @@ class Mistral(BaseSDK):
|
|
|
118
122
|
# pylint: disable=protected-access
|
|
119
123
|
self.sdk_configuration.__dict__["_hooks"] = hooks
|
|
120
124
|
|
|
125
|
+
weakref.finalize(
|
|
126
|
+
self,
|
|
127
|
+
close_clients,
|
|
128
|
+
cast(ClientOwner, self.sdk_configuration),
|
|
129
|
+
self.sdk_configuration.client,
|
|
130
|
+
self.sdk_configuration.async_client,
|
|
131
|
+
)
|
|
132
|
+
|
|
121
133
|
self._init_sdks()
|
|
122
134
|
|
|
123
135
|
def _init_sdks(self):
|
|
@@ -130,6 +142,7 @@ class Mistral(BaseSDK):
|
|
|
130
142
|
self.agents = Agents(self.sdk_configuration)
|
|
131
143
|
self.embeddings = Embeddings(self.sdk_configuration)
|
|
132
144
|
self.classifiers = Classifiers(self.sdk_configuration)
|
|
145
|
+
self.ocr = Ocr(self.sdk_configuration)
|
|
133
146
|
|
|
134
147
|
def __enter__(self):
|
|
135
148
|
return self
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mistralai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.1
|
|
4
4
|
Summary: Python Client SDK for the Mistral AI API.
|
|
5
5
|
Author: Mistral
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -67,6 +67,7 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
67
67
|
* [Server Selection](https://github.com/mistralai/client-python/blob/master/#server-selection)
|
|
68
68
|
* [Custom HTTP Client](https://github.com/mistralai/client-python/blob/master/#custom-http-client)
|
|
69
69
|
* [Authentication](https://github.com/mistralai/client-python/blob/master/#authentication)
|
|
70
|
+
* [Resource Management](https://github.com/mistralai/client-python/blob/master/#resource-management)
|
|
70
71
|
* [Debugging](https://github.com/mistralai/client-python/blob/master/#debugging)
|
|
71
72
|
* [IDE Support](https://github.com/mistralai/client-python/blob/master/#ide-support)
|
|
72
73
|
* [Development](https://github.com/mistralai/client-python/blob/master/#development)
|
|
@@ -77,6 +78,11 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
77
78
|
<!-- Start SDK Installation [installation] -->
|
|
78
79
|
## SDK Installation
|
|
79
80
|
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> **Python version upgrade policy**
|
|
83
|
+
>
|
|
84
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
85
|
+
|
|
80
86
|
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
81
87
|
|
|
82
88
|
### PIP
|
|
@@ -461,6 +467,10 @@ The documentation for the GCP SDK is available [here](https://github.com/mistral
|
|
|
461
467
|
* [archive](https://github.com/mistralai/client-python/blob/master/docs/sdks/models/README.md#archive) - Archive Fine Tuned Model
|
|
462
468
|
* [unarchive](https://github.com/mistralai/client-python/blob/master/docs/sdks/models/README.md#unarchive) - Unarchive Fine Tuned Model
|
|
463
469
|
|
|
470
|
+
### [ocr](https://github.com/mistralai/client-python/blob/master/docs/sdks/ocr/README.md)
|
|
471
|
+
|
|
472
|
+
* [process](https://github.com/mistralai/client-python/blob/master/docs/sdks/ocr/README.md#process) - OCR
|
|
473
|
+
|
|
464
474
|
</details>
|
|
465
475
|
<!-- End Available Resources and Operations [operations] -->
|
|
466
476
|
|
|
@@ -779,6 +789,32 @@ with Mistral(
|
|
|
779
789
|
```
|
|
780
790
|
<!-- End Authentication [security] -->
|
|
781
791
|
|
|
792
|
+
<!-- Start Resource Management [resource-management] -->
|
|
793
|
+
## Resource Management
|
|
794
|
+
|
|
795
|
+
The `Mistral` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
796
|
+
|
|
797
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
798
|
+
|
|
799
|
+
```python
|
|
800
|
+
from mistralai import Mistral
|
|
801
|
+
import os
|
|
802
|
+
def main():
|
|
803
|
+
with Mistral(
|
|
804
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
805
|
+
) as mistral:
|
|
806
|
+
# Rest of application here...
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
# Or when using async:
|
|
810
|
+
async def amain():
|
|
811
|
+
async with Mistral(
|
|
812
|
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
813
|
+
) as mistral:
|
|
814
|
+
# Rest of application here...
|
|
815
|
+
```
|
|
816
|
+
<!-- End Resource Management [resource-management] -->
|
|
817
|
+
|
|
782
818
|
<!-- Start Debugging [debug] -->
|
|
783
819
|
## Debugging
|
|
784
820
|
|
|
@@ -131,52 +131,62 @@ mistralai/_hooks/deprecation_warning.py,sha256=eyEOf7-o9uqqNWJnufD2RXp3dYrGV4in9
|
|
|
131
131
|
mistralai/_hooks/registration.py,sha256=ML0W-XbE4WYdJ4eGks_XxF2aLCJTaIWjQATFGzFwvyU,861
|
|
132
132
|
mistralai/_hooks/sdkhooks.py,sha256=s-orhdvnV89TmI3QiPC2LWQtYeM9RrsG1CTll-fYZmQ,2559
|
|
133
133
|
mistralai/_hooks/types.py,sha256=vUkTVk_TSaK10aEj368KYWvnd4T5EsawixMcTro_UHc,2570
|
|
134
|
-
mistralai/_version.py,sha256=
|
|
134
|
+
mistralai/_version.py,sha256=pBAiPZarkMWJ_MM3cNcwKrR6I5rxAjX8exNV9MXZ99Y,460
|
|
135
135
|
mistralai/agents.py,sha256=63-FJfMJ_9Qb0O0-uorAJM8km4FHpCEjjIk14margM8,31392
|
|
136
136
|
mistralai/async_client.py,sha256=KUdYxIIqoD6L7vB0EGwUR6lQ0NK5iCTHjnLVR9CVcJY,355
|
|
137
137
|
mistralai/basesdk.py,sha256=da0sFeLR-ztU5-fuGJ4TMqUnnqSzXbPAjpNgKI52tBk,11999
|
|
138
138
|
mistralai/batch.py,sha256=YN4D0Duwrap9Ysmp_lRpADYp1Znay7THE_z8ERGvDds,501
|
|
139
|
-
mistralai/chat.py,sha256=
|
|
140
|
-
mistralai/classifiers.py,sha256=
|
|
139
|
+
mistralai/chat.py,sha256=TpFLC7pprrJ3rf3pL3RQRbFeruuihu_Vo9sRKLr2koU,39289
|
|
140
|
+
mistralai/classifiers.py,sha256=VpnCqw1H4saN_6-xjT8592lQIs5GNfZ9s5UvcacG5v0,16808
|
|
141
141
|
mistralai/client.py,sha256=hrPg-LciKMKiascF0WbRRmqQyCv1lb2yDh6j-aaKVNo,509
|
|
142
|
-
mistralai/embeddings.py,sha256=
|
|
142
|
+
mistralai/embeddings.py,sha256=aCjn43G2gzV2GSNap0xmNxAN5_xygC_9QFT4lMbZhAM,8244
|
|
143
|
+
mistralai/extra/README.md,sha256=BTS9fy0ijkiUP7ZVoFQ7FVBxHtXIXqucYZyy_ucFjo4,1739
|
|
144
|
+
mistralai/extra/__init__.py,sha256=MHf0pUgLc9Sb7eTUE31JlE2FKMxfQupmJ_iR8UkgQ9w,360
|
|
145
|
+
mistralai/extra/struct_chat.py,sha256=ZkpdExC5rgC-nBZ44hQIVhQmK6lYMk36RBSFPZMFaIg,2157
|
|
146
|
+
mistralai/extra/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
|
+
mistralai/extra/tests/test_struct_chat.py,sha256=WT6GGfcbXCok8UkEny19u4q1g2QOgkekvmAb3ZinQZ8,4343
|
|
148
|
+
mistralai/extra/tests/test_utils.py,sha256=VesGDR_IiE6u0iY7yOi1iERd7esdJgi2aL4xZp0vKVI,5113
|
|
149
|
+
mistralai/extra/utils/__init__.py,sha256=SExo5t_hx0ybiQhVJIG3r3hOA-Pfny3lIO_WsqNXlN8,116
|
|
150
|
+
mistralai/extra/utils/_pydantic_helper.py,sha256=kU_HbsSl1qGXnrrHnBcxun2MtHowu8eBp3jYMyFsPWw,859
|
|
151
|
+
mistralai/extra/utils/response_format.py,sha256=OiIpNXMODKJ6U2QDCXxPHBoVtXzXF7jtBzCLmI4t_CU,907
|
|
143
152
|
mistralai/files.py,sha256=E1-MxJc-84IdKrc-0k-bvYNa7OSoNFCQ7wBX9tMnFb8,44359
|
|
144
|
-
mistralai/fim.py,sha256=
|
|
153
|
+
mistralai/fim.py,sha256=14IVw1I6OkNVHx6g7cgXlwp5ZxuTku_8BNRL8FYntG0,27239
|
|
145
154
|
mistralai/fine_tuning.py,sha256=UENQqfE054VEsAYxdruV-TBLFIFfO-joXNznH08GUvE,477
|
|
146
|
-
mistralai/httpclient.py,sha256=
|
|
155
|
+
mistralai/httpclient.py,sha256=N-D-srtDBykpfyVKacTY4upDGvNLqdWlEYqhJvta99E,4194
|
|
147
156
|
mistralai/jobs.py,sha256=SVNlvn8XGaCkNJ5tKOKci5QLavacmkNqoYeIGF4ik0Q,43481
|
|
148
157
|
mistralai/mistral_jobs.py,sha256=2ScKd2Tv79-MWxEQkrqr53Ikya8rmTbSiJ96judp7DY,30166
|
|
149
|
-
mistralai/models/__init__.py,sha256=
|
|
158
|
+
mistralai/models/__init__.py,sha256=39Owsya5LkbCsZIu_EUeXPq2WWcKVl0Fg1A6Ce-6vxI,22771
|
|
150
159
|
mistralai/models/agentscompletionrequest.py,sha256=2tV6_p33zLCfBD7EzlAVeSjG0E_pknbVZlbQFM3Lulc,7794
|
|
151
160
|
mistralai/models/agentscompletionstreamrequest.py,sha256=D1fla5nnnwNKXwHG1w4XVGnqaEvx6sOuhTXdP_e65sM,7239
|
|
152
161
|
mistralai/models/apiendpoint.py,sha256=Hvar5leWsJR_FYb0UzRlSw3vRdBZhk_6BR5r2pIb214,400
|
|
153
162
|
mistralai/models/archiveftmodelout.py,sha256=dQx1J91UA06pjk2r7okhKMyBBePmHal7SPpn6Y_wEsY,820
|
|
154
|
-
mistralai/models/assistantmessage.py,sha256=
|
|
163
|
+
mistralai/models/assistantmessage.py,sha256=pmOhSINRB8sJ11lNtfKEL0k6-JnTEJ7cjlWW9D0pIMM,2624
|
|
155
164
|
mistralai/models/basemodelcard.py,sha256=nv-xjoZFCuIdjKBl98dVH5puT7qh0AC2MaE7WTsMxfs,2985
|
|
156
165
|
mistralai/models/batcherror.py,sha256=tThkO9B-g-6eDSBCm1Emd-zDI4B3mk2vAl0L1MI3pdQ,390
|
|
157
166
|
mistralai/models/batchjobin.py,sha256=1GDaaHJeGVo71F4HVZkTdX92bmr3DieNB0ZuHFzBIeE,1850
|
|
158
167
|
mistralai/models/batchjobout.py,sha256=AXFSgDFGY_1LFVHtVdp66y08DUZCxsZtZ_NzTAJYDWM,3067
|
|
159
168
|
mistralai/models/batchjobsout.py,sha256=Tq6bcb4_-fcW8C9AOnfJN8_sTy1NQhDn82qFOKdFPcg,868
|
|
160
169
|
mistralai/models/batchjobstatus.py,sha256=WlrIl5vWQGfLmgQA91_9CnCMKhWN6Lli458fT-4Asj4,294
|
|
161
|
-
mistralai/models/chatclassificationrequest.py,sha256=WYthWiE7euFSeJYJRQJMXmxbWzGDl8kpF4yyLO9ZJaE,3225
|
|
162
170
|
mistralai/models/chatcompletionchoice.py,sha256=6iIFLZj2KYx0HFfzS3-E3sNXG6mPEAlDyXxIA5iZI_U,849
|
|
163
|
-
mistralai/models/chatcompletionrequest.py,sha256=
|
|
171
|
+
mistralai/models/chatcompletionrequest.py,sha256=Qm2b3Ohv3hQi4N6bGn53EsdiHDmwK8BL4JFT06R3VT4,9651
|
|
164
172
|
mistralai/models/chatcompletionresponse.py,sha256=sLE-_Bx9W5rH2-HE2fBWPVbJbmBWx_jSY2mJ3KBEn6w,792
|
|
165
|
-
mistralai/models/chatcompletionstreamrequest.py,sha256=
|
|
173
|
+
mistralai/models/chatcompletionstreamrequest.py,sha256=5IPSsJC51NdNdQ3uZrVnHx0eIZUvFEIeJ9CD6T53Bz4,9339
|
|
174
|
+
mistralai/models/chatmoderationrequest.py,sha256=LX-dhlYxecEzChSTt4jo4DA8lC4DEp5brgaiksTGF-o,2367
|
|
166
175
|
mistralai/models/checkpointout.py,sha256=A2kXS8-VT_1lbg3brifVjZD6tXdsET8vLqBm2a-yXgA,1109
|
|
167
176
|
mistralai/models/classificationobject.py,sha256=JqaKo3AQD4t5X12ZnHjJ6K3Y6LXUn94uGdLJSoGr8vY,665
|
|
168
|
-
mistralai/models/classificationrequest.py,sha256=
|
|
177
|
+
mistralai/models/classificationrequest.py,sha256=FqQfSrGYwLUjVw78Ft7tbmhAkUN0FqolCn4MNArOuR8,922
|
|
169
178
|
mistralai/models/classificationresponse.py,sha256=TeBV7mH0nvLswPdLhv4ZaDTsXvuVYJqSe5Uci7qVSMA,649
|
|
170
179
|
mistralai/models/completionchunk.py,sha256=Cdq-FBWa1oBhrxapoOAj8qr6xmkeIPsfPQSbjeK6NLY,871
|
|
171
180
|
mistralai/models/completionevent.py,sha256=rFc5dJBRnNOzspI95Jhkjd9WyM476u48cN0T1Vh-Cxw,399
|
|
172
181
|
mistralai/models/completionresponsestreamchoice.py,sha256=gw5-_iOyznuimumDtBV65E3zwUW0KH1OHP55dGCAsAA,1927
|
|
173
|
-
mistralai/models/contentchunk.py,sha256=
|
|
182
|
+
mistralai/models/contentchunk.py,sha256=V8-d2u9ReICA6uXZwJTUXu88VfKRIAsLRO6o113Mcw8,1073
|
|
174
183
|
mistralai/models/delete_model_v1_models_model_id_deleteop.py,sha256=lnVRFX-G0jkn1dCFC89sXY2Pj_w4QfMDeF1tPjS4hWE,602
|
|
175
184
|
mistralai/models/deletefileout.py,sha256=s3a-H2RgFQ9HX0kYSmP6GwmwE1jghz7dBj-3G0NBVSY,587
|
|
176
185
|
mistralai/models/deletemodelout.py,sha256=W_crO0WtksoKUgq5s9Yh8zS8RxSuyKYQCBt1i8vB1sE,693
|
|
177
186
|
mistralai/models/deltamessage.py,sha256=7NtvEjdmBOl86rwOx7x2fcCCJSzIF8K6-eu-G9Wr9PI,1939
|
|
178
187
|
mistralai/models/detailedjobout.py,sha256=aw3xmCM6E2kE1cPI5MtLZOdbtaP7FLBeHZG7ACtlEKg,4862
|
|
179
|
-
mistralai/models/
|
|
188
|
+
mistralai/models/documenturlchunk.py,sha256=NbUo4DOQteGfA5koBA_jj1DfyLwxoXq43QE5RVrAhoM,1934
|
|
189
|
+
mistralai/models/embeddingrequest.py,sha256=d8l83jwIfTBtiXYWxCwAnZaTp_fptmZ9SbPBFr2mK5g,826
|
|
180
190
|
mistralai/models/embeddingresponse.py,sha256=te6E_LYEzRjHJ9QREmsFp5PeNP2J_8ALVjyb1T20pNA,663
|
|
181
191
|
mistralai/models/embeddingresponsedata.py,sha256=fJ3mrZqyBBBE40a6iegOJX3DVDfgyMRq23ByeGSTLFk,534
|
|
182
192
|
mistralai/models/eventout.py,sha256=TouRJeISBLphMTPHfgSOpuoOmbGDVohPOrdgHyExMpw,1633
|
|
@@ -189,9 +199,9 @@ mistralai/models/files_api_routes_retrieve_fileop.py,sha256=8DjSbYqUqFoPq-qcNXyV
|
|
|
189
199
|
mistralai/models/files_api_routes_upload_fileop.py,sha256=gIGH5xcPryWYkj1FmNv_0-9He-QB_rRf1a5nUYBNDTU,2213
|
|
190
200
|
mistralai/models/fileschema.py,sha256=n_IjCdNOrC2fuzkv75wJn01XvqGTmPK3JqAFSHaOiMA,2597
|
|
191
201
|
mistralai/models/filesignedurl.py,sha256=VwvuhzhJulAB99Qxz6zr-2F1aINosAfaSxU0IhytDSU,289
|
|
192
|
-
mistralai/models/fimcompletionrequest.py,sha256=
|
|
202
|
+
mistralai/models/fimcompletionrequest.py,sha256=wWDCkQ_PMnjB8DrIuIvVJlPGqQtTpVDHt4p7xJ204Ug,6565
|
|
193
203
|
mistralai/models/fimcompletionresponse.py,sha256=_QwzRuL3KuKkyrA4Fxp366SW0H0EzOA7f4FLkWLm-PM,790
|
|
194
|
-
mistralai/models/fimcompletionstreamrequest.py,sha256=
|
|
204
|
+
mistralai/models/fimcompletionstreamrequest.py,sha256=fxuR8FDOWMwIqlYU9ttAfGeRdVgTz4l2k26_OEfxelg,5944
|
|
195
205
|
mistralai/models/ftmodelcapabilitiesout.py,sha256=H1kKEChUPgYT31ZQUz0tn9NRa7Z3hRZlh-sFfDYvBos,648
|
|
196
206
|
mistralai/models/ftmodelcard.py,sha256=G3dioHDMOhbI5HIw5gCaxZDb1sCthBzkXIAYMNHwya8,3300
|
|
197
207
|
mistralai/models/ftmodelout.py,sha256=dw-y8KKT_7rzW6tu10gfc1YKB8-Kpw4e4zy23z_U1d4,2530
|
|
@@ -218,15 +228,22 @@ mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py,sha256=h
|
|
|
218
228
|
mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py,sha256=_pkyhD7OzG-59fgcajI9NmSLTLDktkCxXo_IuvWeyfs,636
|
|
219
229
|
mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py,sha256=s-EYS-Hw0NExYeIyN-3JlHbKmnTmtyB8ljVSfOylqYk,907
|
|
220
230
|
mistralai/models/jobsout.py,sha256=uCKt0aw7yXzI4oLDGeAAEhsRjdRg3g7lPopg0__czTA,818
|
|
231
|
+
mistralai/models/jsonschema.py,sha256=Sh6VCcRxJffd-vXX61GVElbxKNi-j2MKvMUZQcW5EUs,1653
|
|
221
232
|
mistralai/models/legacyjobmetadataout.py,sha256=08zAGNTSrICsK8u2SFFUXiNWF7MCQvezmFQeMQzxsys,4762
|
|
222
233
|
mistralai/models/listfilesout.py,sha256=tW2fNabLKcftc5kytkjwVaChlOzWRL4FKtNzDak9MNs,468
|
|
223
234
|
mistralai/models/metricout.py,sha256=dXQMMU4Nk6-Zr06Jx1TWilFi6cOwiVLjSanCFn0cPxo,2034
|
|
224
235
|
mistralai/models/modelcapabilities.py,sha256=No-Dl09zT1sG4MxsWnx4s8Yo1tUeMQ7k-HR_iQFIMFc,703
|
|
225
236
|
mistralai/models/modellist.py,sha256=D4Y784kQkx0ARhofFrpEqGLfxa-jTY8ev0TQMrD_n8I,995
|
|
226
|
-
mistralai/models/
|
|
237
|
+
mistralai/models/ocrimageobject.py,sha256=QDylsNCXy78rWLHuE4CrnQAPXnubz0-FN1wQXtsVsDA,2534
|
|
238
|
+
mistralai/models/ocrpagedimensions.py,sha256=oP4v80I8d6ZELSZt6cRoECd6uIONgdyCeeFalm-4OvM,609
|
|
239
|
+
mistralai/models/ocrpageobject.py,sha256=s0OzcCA0cLTFYahNOr0-r4ds7WOsXYhEx-QcNLngW7M,2085
|
|
240
|
+
mistralai/models/ocrrequest.py,sha256=KKFFvxsGsOQKAYFpuZ02-VsiJWNawlIIz-7dPPtNklU,3112
|
|
241
|
+
mistralai/models/ocrresponse.py,sha256=JpI9Yl6fYeGf6Wsn4M4Z-i6Ir2qAlMKFQnVXqsLiC5Y,752
|
|
242
|
+
mistralai/models/ocrusageinfo.py,sha256=cWtxHxXyJn3U1qJgG-XU-1xfC7poGHvhVtPqdrFrfII,1571
|
|
243
|
+
mistralai/models/prediction.py,sha256=BgWbbeSi1eD9Rh1xk8srXlRgD7Xooj8nLsbSQ21pNRo,718
|
|
227
244
|
mistralai/models/referencechunk.py,sha256=A9vV5pZv-tUqGlswdu0HOyCYy0Q-UIJY0Oc9ZfM6XJA,519
|
|
228
|
-
mistralai/models/responseformat.py,sha256
|
|
229
|
-
mistralai/models/responseformats.py,sha256=
|
|
245
|
+
mistralai/models/responseformat.py,sha256=-TAPGth3_FAiNl-kuE4COI5cSP5fxQ7xewFSV989i58,2225
|
|
246
|
+
mistralai/models/responseformats.py,sha256=O9lwS2M9m53DsRxTC4uRP12SvRhgaQoMjIYsDys5A7s,503
|
|
230
247
|
mistralai/models/retrieve_model_v1_models_model_id_getop.py,sha256=N9_JFwiz9tz4zRXJ9c1V0c_anFEVxVzPDoFt2Wrer4M,1388
|
|
231
248
|
mistralai/models/retrievefileout.py,sha256=nAjSITJCHj0daChhpwOZTmps-74mmYZO4IckGA0yIvQ,2644
|
|
232
249
|
mistralai/models/sampletype.py,sha256=zowUiTFxum8fltBs6j__BrFPio-dQdG0CIyLj-5icG8,316
|
|
@@ -253,8 +270,9 @@ mistralai/models/validationerror.py,sha256=DouDBJmBhbW4KPsF5rZEyBdnB_adC-l32kuHC
|
|
|
253
270
|
mistralai/models/wandbintegration.py,sha256=BkLD3r08ToZkMAhPXdnC7bfOGr3banKqt1wVKMGehUQ,2406
|
|
254
271
|
mistralai/models/wandbintegrationout.py,sha256=C0HpS8jJGnACs7eWnuIq0qJEroIUAbjkvzfSSkSKS7Q,2274
|
|
255
272
|
mistralai/models_.py,sha256=r0etSSUChK7hxxf7ZyhoeloyE8TyPRL1s5Jh4Jgukbw,44394
|
|
273
|
+
mistralai/ocr.py,sha256=aMro4iLNC7Jr65N2A-3DVcs1AIWNUOG_9n_5zAD4V2M,9703
|
|
256
274
|
mistralai/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
|
|
257
|
-
mistralai/sdk.py,sha256=
|
|
275
|
+
mistralai/sdk.py,sha256=ZStm1fV-bzMxVgnkmsHpi1hyY0603xTTwSecv0oPyzg,5842
|
|
258
276
|
mistralai/sdkconfiguration.py,sha256=sx6U1xgxFbflhJdOBAeI7isId-8wlMd8NK9pi-JGs1o,1789
|
|
259
277
|
mistralai/types/__init__.py,sha256=RArOwSgeeTIva6h-4ttjXwMUeCkz10nAFBL9D-QljI4,377
|
|
260
278
|
mistralai/types/basemodel.py,sha256=PexI39iKiOkIlobB8Ueo0yn8PLHp6_wb-WO-zelNDZY,1170
|
|
@@ -274,7 +292,7 @@ mistralai/utils/serializers.py,sha256=BSJT7kBOkNBFyP7KREyMoe14JGbgijD1M6AXFMbdmc
|
|
|
274
292
|
mistralai/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
|
275
293
|
mistralai/utils/values.py,sha256=_89YXPTI_BU6SXJBzFR4pIzTCBPQW9tsOTN1jeBBIDs,3428
|
|
276
294
|
mistralai/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
|
|
277
|
-
mistralai-1.
|
|
278
|
-
mistralai-1.
|
|
279
|
-
mistralai-1.
|
|
280
|
-
mistralai-1.
|
|
295
|
+
mistralai-1.5.1.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
|
|
296
|
+
mistralai-1.5.1.dist-info/METADATA,sha256=3SyFjKQU-IBkJmJuUV-2BUDEPXSRaS5Z9PmJvmK65Og,29449
|
|
297
|
+
mistralai-1.5.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
298
|
+
mistralai-1.5.1.dist-info/RECORD,,
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
|
5
|
-
from .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
6
|
-
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
7
|
-
from .usermessage import UserMessage, UserMessageTypedDict
|
|
8
|
-
from mistralai.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
9
|
-
from mistralai.utils import get_discriminator
|
|
10
|
-
import pydantic
|
|
11
|
-
from pydantic import Discriminator, Tag, model_serializer
|
|
12
|
-
from typing import List, Union
|
|
13
|
-
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
TwoTypedDict = TypeAliasType(
|
|
17
|
-
"TwoTypedDict",
|
|
18
|
-
Union[
|
|
19
|
-
SystemMessageTypedDict,
|
|
20
|
-
UserMessageTypedDict,
|
|
21
|
-
AssistantMessageTypedDict,
|
|
22
|
-
ToolMessageTypedDict,
|
|
23
|
-
],
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Two = Annotated[
|
|
28
|
-
Union[
|
|
29
|
-
Annotated[AssistantMessage, Tag("assistant")],
|
|
30
|
-
Annotated[SystemMessage, Tag("system")],
|
|
31
|
-
Annotated[ToolMessage, Tag("tool")],
|
|
32
|
-
Annotated[UserMessage, Tag("user")],
|
|
33
|
-
],
|
|
34
|
-
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
OneTypedDict = TypeAliasType(
|
|
39
|
-
"OneTypedDict",
|
|
40
|
-
Union[
|
|
41
|
-
SystemMessageTypedDict,
|
|
42
|
-
UserMessageTypedDict,
|
|
43
|
-
AssistantMessageTypedDict,
|
|
44
|
-
ToolMessageTypedDict,
|
|
45
|
-
],
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
One = Annotated[
|
|
50
|
-
Union[
|
|
51
|
-
Annotated[AssistantMessage, Tag("assistant")],
|
|
52
|
-
Annotated[SystemMessage, Tag("system")],
|
|
53
|
-
Annotated[ToolMessage, Tag("tool")],
|
|
54
|
-
Annotated[UserMessage, Tag("user")],
|
|
55
|
-
],
|
|
56
|
-
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ChatClassificationRequestInputsTypedDict = TypeAliasType(
|
|
61
|
-
"ChatClassificationRequestInputsTypedDict",
|
|
62
|
-
Union[List[OneTypedDict], List[List[TwoTypedDict]]],
|
|
63
|
-
)
|
|
64
|
-
r"""Chat to classify"""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ChatClassificationRequestInputs = TypeAliasType(
|
|
68
|
-
"ChatClassificationRequestInputs", Union[List[One], List[List[Two]]]
|
|
69
|
-
)
|
|
70
|
-
r"""Chat to classify"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class ChatClassificationRequestTypedDict(TypedDict):
|
|
74
|
-
inputs: ChatClassificationRequestInputsTypedDict
|
|
75
|
-
r"""Chat to classify"""
|
|
76
|
-
model: Nullable[str]
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class ChatClassificationRequest(BaseModel):
|
|
80
|
-
inputs: Annotated[ChatClassificationRequestInputs, pydantic.Field(alias="input")]
|
|
81
|
-
r"""Chat to classify"""
|
|
82
|
-
|
|
83
|
-
model: Nullable[str]
|
|
84
|
-
|
|
85
|
-
@model_serializer(mode="wrap")
|
|
86
|
-
def serialize_model(self, handler):
|
|
87
|
-
optional_fields = []
|
|
88
|
-
nullable_fields = ["model"]
|
|
89
|
-
null_default_fields = []
|
|
90
|
-
|
|
91
|
-
serialized = handler(self)
|
|
92
|
-
|
|
93
|
-
m = {}
|
|
94
|
-
|
|
95
|
-
for n, f in self.model_fields.items():
|
|
96
|
-
k = f.alias or n
|
|
97
|
-
val = serialized.get(k)
|
|
98
|
-
serialized.pop(k, None)
|
|
99
|
-
|
|
100
|
-
optional_nullable = k in optional_fields and k in nullable_fields
|
|
101
|
-
is_set = (
|
|
102
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
103
|
-
or k in null_default_fields
|
|
104
|
-
) # pylint: disable=no-member
|
|
105
|
-
|
|
106
|
-
if val is not None and val != UNSET_SENTINEL:
|
|
107
|
-
m[k] = val
|
|
108
|
-
elif val != UNSET_SENTINEL and (
|
|
109
|
-
not k in optional_fields or (optional_nullable and is_set)
|
|
110
|
-
):
|
|
111
|
-
m[k] = val
|
|
112
|
-
|
|
113
|
-
return m
|
|
File without changes
|