mistralai 1.5.1__py3-none-any.whl → 1.5.2__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 CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "mistralai"
6
- __version__: str = "1.5.1"
6
+ __version__: str = "1.5.2"
7
7
  __openapi_doc_version__: str = "0.0.2"
8
8
  __gen_version__: str = "2.497.0"
9
- __user_agent__: str = "speakeasy-sdk/python 1.5.1 2.497.0 0.0.2 mistralai"
9
+ __user_agent__: str = "speakeasy-sdk/python 1.5.2 2.497.0 0.0.2 mistralai"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
mistralai/embeddings.py CHANGED
@@ -14,8 +14,8 @@ class Embeddings(BaseSDK):
14
14
  def create(
15
15
  self,
16
16
  *,
17
+ model: str,
17
18
  inputs: Union[models.Inputs, models.InputsTypedDict],
18
- model: Optional[str] = "mistral-embed",
19
19
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
20
20
  server_url: Optional[str] = None,
21
21
  timeout_ms: Optional[int] = None,
@@ -25,8 +25,8 @@ class Embeddings(BaseSDK):
25
25
 
26
26
  Embeddings
27
27
 
28
- :param inputs: Text to embed.
29
28
  :param model: ID of the model to use.
29
+ :param inputs: Text to embed.
30
30
  :param retries: Override the default retry configuration for this method
31
31
  :param server_url: Override the default server URL for this method
32
32
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -114,8 +114,8 @@ class Embeddings(BaseSDK):
114
114
  async def create_async(
115
115
  self,
116
116
  *,
117
+ model: str,
117
118
  inputs: Union[models.Inputs, models.InputsTypedDict],
118
- model: Optional[str] = "mistral-embed",
119
119
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
120
120
  server_url: Optional[str] = None,
121
121
  timeout_ms: Optional[int] = None,
@@ -125,8 +125,8 @@ class Embeddings(BaseSDK):
125
125
 
126
126
  Embeddings
127
127
 
128
- :param inputs: Text to embed.
129
128
  :param model: ID of the model to use.
129
+ :param inputs: Text to embed.
130
130
  :param retries: Override the default retry configuration for this method
131
131
  :param server_url: Override the default server URL for this method
132
132
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel
2
- from typing import TypeVar, Any, Type
2
+ from typing import TypeVar, Any, Type, Dict
3
3
  from ...models import JSONSchema, ResponseFormat
4
4
  from ._pydantic_helper import rec_strict_json_schema
5
5
 
@@ -7,7 +7,7 @@ CustomPydanticModel = TypeVar("CustomPydanticModel", bound=BaseModel)
7
7
 
8
8
 
9
9
  def response_format_from_pydantic_model(
10
- model: type[CustomPydanticModel],
10
+ model: Type[CustomPydanticModel],
11
11
  ) -> ResponseFormat:
12
12
  """Generate a strict JSON schema from a pydantic model."""
13
13
  model_schema = rec_strict_json_schema(model.model_json_schema())
@@ -18,7 +18,7 @@ def response_format_from_pydantic_model(
18
18
 
19
19
 
20
20
  def pydantic_model_from_json(
21
- json_data: dict[str, Any], pydantic_model: Type[CustomPydanticModel]
21
+ json_data: Dict[str, Any], pydantic_model: Type[CustomPydanticModel]
22
22
  ) -> CustomPydanticModel:
23
23
  """Parse a JSON schema into a pydantic model."""
24
24
  return pydantic_model.model_validate(json_data)
@@ -115,7 +115,11 @@ from .detailedjobout import (
115
115
  DetailedJobOutStatus,
116
116
  DetailedJobOutTypedDict,
117
117
  )
118
- from .documenturlchunk import DocumentURLChunk, DocumentURLChunkTypedDict
118
+ from .documenturlchunk import (
119
+ DocumentURLChunk,
120
+ DocumentURLChunkType,
121
+ DocumentURLChunkTypedDict,
122
+ )
119
123
  from .embeddingrequest import (
120
124
  EmbeddingRequest,
121
125
  EmbeddingRequestTypedDict,
@@ -455,6 +459,7 @@ __all__ = [
455
459
  "Document",
456
460
  "DocumentTypedDict",
457
461
  "DocumentURLChunk",
462
+ "DocumentURLChunkType",
458
463
  "DocumentURLChunkTypedDict",
459
464
  "EmbeddingRequest",
460
465
  "EmbeddingRequestTypedDict",
@@ -2,38 +2,32 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
- from mistralai.utils import validate_const
6
- import pydantic
7
5
  from pydantic import model_serializer
8
- from pydantic.functional_validators import AfterValidator
9
6
  from typing import Literal, Optional
10
- from typing_extensions import Annotated, NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypedDict
8
+
9
+
10
+ DocumentURLChunkType = Literal["document_url"]
11
11
 
12
12
 
13
13
  class DocumentURLChunkTypedDict(TypedDict):
14
14
  document_url: str
15
- type: Literal["document_url"]
16
15
  document_name: NotRequired[Nullable[str]]
17
16
  r"""The filename of the document"""
17
+ type: NotRequired[DocumentURLChunkType]
18
18
 
19
19
 
20
20
  class DocumentURLChunk(BaseModel):
21
21
  document_url: str
22
22
 
23
- TYPE: Annotated[
24
- Annotated[
25
- Optional[Literal["document_url"]],
26
- AfterValidator(validate_const("document_url")),
27
- ],
28
- pydantic.Field(alias="type"),
29
- ] = "document_url"
30
-
31
23
  document_name: OptionalNullable[str] = UNSET
32
24
  r"""The filename of the document"""
33
25
 
26
+ type: Optional[DocumentURLChunkType] = "document_url"
27
+
34
28
  @model_serializer(mode="wrap")
35
29
  def serialize_model(self, handler):
36
- optional_fields = ["type", "document_name"]
30
+ optional_fields = ["document_name", "type"]
37
31
  nullable_fields = ["document_name"]
38
32
  null_default_fields = []
39
33
 
@@ -3,8 +3,8 @@
3
3
  from __future__ import annotations
4
4
  from mistralai.types import BaseModel
5
5
  import pydantic
6
- from typing import List, Optional, Union
7
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
6
+ from typing import List, Union
7
+ from typing_extensions import Annotated, TypeAliasType, TypedDict
8
8
 
9
9
 
10
10
  InputsTypedDict = TypeAliasType("InputsTypedDict", Union[str, List[str]])
@@ -16,15 +16,15 @@ r"""Text to embed."""
16
16
 
17
17
 
18
18
  class EmbeddingRequestTypedDict(TypedDict):
19
+ model: str
20
+ r"""ID of the model to use."""
19
21
  inputs: InputsTypedDict
20
22
  r"""Text to embed."""
21
- model: NotRequired[str]
22
- r"""ID of the model to use."""
23
23
 
24
24
 
25
25
  class EmbeddingRequest(BaseModel):
26
+ model: str
27
+ r"""ID of the model to use."""
28
+
26
29
  inputs: Annotated[Inputs, pydantic.Field(alias="input")]
27
30
  r"""Text to embed."""
28
-
29
- model: Optional[str] = "mistral-embed"
30
- r"""ID of the model to use."""
@@ -5,4 +5,4 @@ from mistralai.types import UnrecognizedStr
5
5
  from typing import Literal, Union
6
6
 
7
7
 
8
- FilePurpose = Union[Literal["fine-tune", "batch"], UnrecognizedStr]
8
+ FilePurpose = Union[Literal["fine-tune", "batch", "ocr"], UnrecognizedStr]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mistralai
3
- Version: 1.5.1
3
+ Version: 1.5.2
4
4
  Summary: Python Client SDK for the Mistral AI API.
5
5
  Author: Mistral
6
6
  Requires-Python: >=3.8
@@ -267,10 +267,10 @@ with Mistral(
267
267
  api_key=os.getenv("MISTRAL_API_KEY", ""),
268
268
  ) as mistral:
269
269
 
270
- res = mistral.embeddings.create(inputs=[
270
+ res = mistral.embeddings.create(model="mistral-embed", inputs=[
271
271
  "Embed this sentence.",
272
272
  "As well as this one.",
273
- ], model="mistral-embed")
273
+ ])
274
274
 
275
275
  # Handle response
276
276
  print(res)
@@ -290,10 +290,10 @@ async def main():
290
290
  api_key=os.getenv("MISTRAL_API_KEY", ""),
291
291
  ) as mistral:
292
292
 
293
- res = await mistral.embeddings.create_async(inputs=[
293
+ res = await mistral.embeddings.create_async(model="mistral-embed", inputs=[
294
294
  "Embed this sentence.",
295
295
  "As well as this one.",
296
- ], model="mistral-embed")
296
+ ])
297
297
 
298
298
  # Handle response
299
299
  print(res)
@@ -131,7 +131,7 @@ 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=pBAiPZarkMWJ_MM3cNcwKrR6I5rxAjX8exNV9MXZ99Y,460
134
+ mistralai/_version.py,sha256=fbAyf80YaeH2rCOFvV_CdaI7pWofNoKa90pRTkBBL74,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
@@ -139,7 +139,7 @@ mistralai/batch.py,sha256=YN4D0Duwrap9Ysmp_lRpADYp1Znay7THE_z8ERGvDds,501
139
139
  mistralai/chat.py,sha256=TpFLC7pprrJ3rf3pL3RQRbFeruuihu_Vo9sRKLr2koU,39289
140
140
  mistralai/classifiers.py,sha256=VpnCqw1H4saN_6-xjT8592lQIs5GNfZ9s5UvcacG5v0,16808
141
141
  mistralai/client.py,sha256=hrPg-LciKMKiascF0WbRRmqQyCv1lb2yDh6j-aaKVNo,509
142
- mistralai/embeddings.py,sha256=aCjn43G2gzV2GSNap0xmNxAN5_xygC_9QFT4lMbZhAM,8244
142
+ mistralai/embeddings.py,sha256=jjqH6-4T3P3jbp5kYOt1HouZ6Y27i0K_EpvY3Vu-XKA,8188
143
143
  mistralai/extra/README.md,sha256=BTS9fy0ijkiUP7ZVoFQ7FVBxHtXIXqucYZyy_ucFjo4,1739
144
144
  mistralai/extra/__init__.py,sha256=MHf0pUgLc9Sb7eTUE31JlE2FKMxfQupmJ_iR8UkgQ9w,360
145
145
  mistralai/extra/struct_chat.py,sha256=ZkpdExC5rgC-nBZ44hQIVhQmK6lYMk36RBSFPZMFaIg,2157
@@ -148,14 +148,14 @@ mistralai/extra/tests/test_struct_chat.py,sha256=WT6GGfcbXCok8UkEny19u4q1g2QOgke
148
148
  mistralai/extra/tests/test_utils.py,sha256=VesGDR_IiE6u0iY7yOi1iERd7esdJgi2aL4xZp0vKVI,5113
149
149
  mistralai/extra/utils/__init__.py,sha256=SExo5t_hx0ybiQhVJIG3r3hOA-Pfny3lIO_WsqNXlN8,116
150
150
  mistralai/extra/utils/_pydantic_helper.py,sha256=kU_HbsSl1qGXnrrHnBcxun2MtHowu8eBp3jYMyFsPWw,859
151
- mistralai/extra/utils/response_format.py,sha256=OiIpNXMODKJ6U2QDCXxPHBoVtXzXF7jtBzCLmI4t_CU,907
151
+ mistralai/extra/utils/response_format.py,sha256=uDNpvOHhk2se3JTXweWYMbnkyOcOqhMe2yxZ2lYNe1k,913
152
152
  mistralai/files.py,sha256=E1-MxJc-84IdKrc-0k-bvYNa7OSoNFCQ7wBX9tMnFb8,44359
153
153
  mistralai/fim.py,sha256=14IVw1I6OkNVHx6g7cgXlwp5ZxuTku_8BNRL8FYntG0,27239
154
154
  mistralai/fine_tuning.py,sha256=UENQqfE054VEsAYxdruV-TBLFIFfO-joXNznH08GUvE,477
155
155
  mistralai/httpclient.py,sha256=N-D-srtDBykpfyVKacTY4upDGvNLqdWlEYqhJvta99E,4194
156
156
  mistralai/jobs.py,sha256=SVNlvn8XGaCkNJ5tKOKci5QLavacmkNqoYeIGF4ik0Q,43481
157
157
  mistralai/mistral_jobs.py,sha256=2ScKd2Tv79-MWxEQkrqr53Ikya8rmTbSiJ96judp7DY,30166
158
- mistralai/models/__init__.py,sha256=39Owsya5LkbCsZIu_EUeXPq2WWcKVl0Fg1A6Ce-6vxI,22771
158
+ mistralai/models/__init__.py,sha256=vkNm0A_E435ipGQcXBZ2K_WhEi7nEVjVQPR3SdLvJ28,22838
159
159
  mistralai/models/agentscompletionrequest.py,sha256=2tV6_p33zLCfBD7EzlAVeSjG0E_pknbVZlbQFM3Lulc,7794
160
160
  mistralai/models/agentscompletionstreamrequest.py,sha256=D1fla5nnnwNKXwHG1w4XVGnqaEvx6sOuhTXdP_e65sM,7239
161
161
  mistralai/models/apiendpoint.py,sha256=Hvar5leWsJR_FYb0UzRlSw3vRdBZhk_6BR5r2pIb214,400
@@ -185,12 +185,12 @@ mistralai/models/deletefileout.py,sha256=s3a-H2RgFQ9HX0kYSmP6GwmwE1jghz7dBj-3G0N
185
185
  mistralai/models/deletemodelout.py,sha256=W_crO0WtksoKUgq5s9Yh8zS8RxSuyKYQCBt1i8vB1sE,693
186
186
  mistralai/models/deltamessage.py,sha256=7NtvEjdmBOl86rwOx7x2fcCCJSzIF8K6-eu-G9Wr9PI,1939
187
187
  mistralai/models/detailedjobout.py,sha256=aw3xmCM6E2kE1cPI5MtLZOdbtaP7FLBeHZG7ACtlEKg,4862
188
- mistralai/models/documenturlchunk.py,sha256=NbUo4DOQteGfA5koBA_jj1DfyLwxoXq43QE5RVrAhoM,1934
189
- mistralai/models/embeddingrequest.py,sha256=d8l83jwIfTBtiXYWxCwAnZaTp_fptmZ9SbPBFr2mK5g,826
188
+ mistralai/models/documenturlchunk.py,sha256=j3JB_Cy1eIRY7fTJe8AvQrdrLEA6xsJcM1l9_a1Sh68,1704
189
+ mistralai/models/embeddingrequest.py,sha256=-EbPsiGUIur80rP5QJ8QaoN5SQGoVmxVUDmUUtFB0CY,762
190
190
  mistralai/models/embeddingresponse.py,sha256=te6E_LYEzRjHJ9QREmsFp5PeNP2J_8ALVjyb1T20pNA,663
191
191
  mistralai/models/embeddingresponsedata.py,sha256=fJ3mrZqyBBBE40a6iegOJX3DVDfgyMRq23ByeGSTLFk,534
192
192
  mistralai/models/eventout.py,sha256=TouRJeISBLphMTPHfgSOpuoOmbGDVohPOrdgHyExMpw,1633
193
- mistralai/models/filepurpose.py,sha256=SPaXJpAW93EozlCU63Wtpj_KkMtjwXk41n1_ohFccQw,256
193
+ mistralai/models/filepurpose.py,sha256=lQk45E78j4bJyMi59jLH5IjU1rCUsqprF28P4ArGQoo,263
194
194
  mistralai/models/files_api_routes_delete_fileop.py,sha256=HOx-hJxphSYF-JV3zOGe2eucWQUpfVqxG0IDaSa3dcE,500
195
195
  mistralai/models/files_api_routes_download_fileop.py,sha256=y3sLFZ-j4eUuxCyIP0L-exy0ViqskDLkghkOccElBQQ,504
196
196
  mistralai/models/files_api_routes_get_signed_urlop.py,sha256=e_XczBgInaylmHJ9m5wJQ78hfCp2PrrTrT8bxGGi8BI,879
@@ -292,7 +292,7 @@ mistralai/utils/serializers.py,sha256=BSJT7kBOkNBFyP7KREyMoe14JGbgijD1M6AXFMbdmc
292
292
  mistralai/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
293
293
  mistralai/utils/values.py,sha256=_89YXPTI_BU6SXJBzFR4pIzTCBPQW9tsOTN1jeBBIDs,3428
294
294
  mistralai/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
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,,
295
+ mistralai-1.5.2.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
296
+ mistralai-1.5.2.dist-info/METADATA,sha256=aN9BU4uEtmcR69jxtQEHMfZlrkq0stVHr4ufP3AeeQU,29449
297
+ mistralai-1.5.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
298
+ mistralai-1.5.2.dist-info/RECORD,,