mistralai 1.8.0__py3-none-any.whl → 1.8.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 CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "mistralai"
6
- __version__: str = "1.8.0"
6
+ __version__: str = "1.8.1"
7
7
  __openapi_doc_version__: str = "1.0.0"
8
8
  __gen_version__: str = "2.548.6"
9
- __user_agent__: str = "speakeasy-sdk/python 1.8.0 2.548.6 1.0.0 mistralai"
9
+ __user_agent__: str = "speakeasy-sdk/python 1.8.1 2.548.6 1.0.0 mistralai"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
mistralai/beta.py CHANGED
@@ -8,7 +8,9 @@ from mistralai.mistral_agents import MistralAgents
8
8
 
9
9
  class Beta(BaseSDK):
10
10
  conversations: Conversations
11
+ r"""(beta) Converstations API"""
11
12
  agents: MistralAgents
13
+ r"""(beta) Agents API"""
12
14
 
13
15
  def __init__(self, sdk_config: SDKConfiguration) -> None:
14
16
  BaseSDK.__init__(self, sdk_config)
@@ -34,8 +34,9 @@ if typing.TYPE_CHECKING:
34
34
  # endregion imports
35
35
 
36
36
 
37
-
38
37
  class Conversations(BaseSDK):
38
+ r"""(beta) Converstations API"""
39
+
39
40
  # region sdk-class-body
40
41
  # Custom run code allowing client side execution of code
41
42
 
@@ -146,7 +147,9 @@ class Conversations(BaseSDK):
146
147
  completion_args=completion_args,
147
148
  )
148
149
 
149
- async def run_generator() -> AsyncGenerator[Union[RunResultEvents, RunResult], None]:
150
+ async def run_generator() -> (
151
+ AsyncGenerator[Union[RunResultEvents, RunResult], None]
152
+ ):
150
153
  current_entries = input_entries
151
154
  while True:
152
155
  received_event_tracker: defaultdict[
mistralai/embeddings.py CHANGED
@@ -18,6 +18,8 @@ class Embeddings(BaseSDK):
18
18
  inputs: Union[
19
19
  models.EmbeddingRequestInputs, models.EmbeddingRequestInputsTypedDict
20
20
  ],
21
+ output_dimension: OptionalNullable[int] = UNSET,
22
+ output_dtype: Optional[models.EmbeddingDtype] = None,
21
23
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
22
24
  server_url: Optional[str] = None,
23
25
  timeout_ms: Optional[int] = None,
@@ -29,6 +31,8 @@ class Embeddings(BaseSDK):
29
31
 
30
32
  :param model: ID of the model to use.
31
33
  :param inputs: Text to embed.
34
+ :param output_dimension: The dimension of the output embeddings.
35
+ :param output_dtype:
32
36
  :param retries: Override the default retry configuration for this method
33
37
  :param server_url: Override the default server URL for this method
34
38
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -47,6 +51,8 @@ class Embeddings(BaseSDK):
47
51
  request = models.EmbeddingRequest(
48
52
  model=model,
49
53
  inputs=inputs,
54
+ output_dimension=output_dimension,
55
+ output_dtype=output_dtype,
50
56
  )
51
57
 
52
58
  req = self._build_request(
@@ -125,6 +131,8 @@ class Embeddings(BaseSDK):
125
131
  inputs: Union[
126
132
  models.EmbeddingRequestInputs, models.EmbeddingRequestInputsTypedDict
127
133
  ],
134
+ output_dimension: OptionalNullable[int] = UNSET,
135
+ output_dtype: Optional[models.EmbeddingDtype] = None,
128
136
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
129
137
  server_url: Optional[str] = None,
130
138
  timeout_ms: Optional[int] = None,
@@ -136,6 +144,8 @@ class Embeddings(BaseSDK):
136
144
 
137
145
  :param model: ID of the model to use.
138
146
  :param inputs: Text to embed.
147
+ :param output_dimension: The dimension of the output embeddings.
148
+ :param output_dtype:
139
149
  :param retries: Override the default retry configuration for this method
140
150
  :param server_url: Override the default server URL for this method
141
151
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -154,6 +164,8 @@ class Embeddings(BaseSDK):
154
164
  request = models.EmbeddingRequest(
155
165
  model=model,
156
166
  inputs=inputs,
167
+ output_dimension=output_dimension,
168
+ output_dtype=output_dtype,
157
169
  )
158
170
 
159
171
  req = self._build_request_async(
@@ -9,6 +9,8 @@ from typing import Any, List, Mapping, Optional, Union
9
9
 
10
10
 
11
11
  class MistralAgents(BaseSDK):
12
+ r"""(beta) Agents API"""
13
+
12
14
  def create(
13
15
  self,
14
16
  *,
@@ -347,6 +347,7 @@ from .documenturlchunk import (
347
347
  DocumentURLChunkType,
348
348
  DocumentURLChunkTypedDict,
349
349
  )
350
+ from .embeddingdtype import EmbeddingDtype
350
351
  from .embeddingrequest import (
351
352
  EmbeddingRequest,
352
353
  EmbeddingRequestInputs,
@@ -964,6 +965,7 @@ __all__ = [
964
965
  "DocumentURLChunk",
965
966
  "DocumentURLChunkType",
966
967
  "DocumentURLChunkTypedDict",
968
+ "EmbeddingDtype",
967
969
  "EmbeddingRequest",
968
970
  "EmbeddingRequestInputs",
969
971
  "EmbeddingRequestInputsTypedDict",
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
  from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
5
5
  from .usageinfo import UsageInfo, UsageInfoTypedDict
6
6
  from mistralai.types import BaseModel
7
- from typing import List, Optional
8
- from typing_extensions import NotRequired, TypedDict
7
+ from typing import List
8
+ from typing_extensions import TypedDict
9
9
 
10
10
 
11
11
  class ChatCompletionResponseTypedDict(TypedDict):
@@ -13,8 +13,8 @@ class ChatCompletionResponseTypedDict(TypedDict):
13
13
  object: str
14
14
  model: str
15
15
  usage: UsageInfoTypedDict
16
- created: NotRequired[int]
17
- choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
16
+ created: int
17
+ choices: List[ChatCompletionChoiceTypedDict]
18
18
 
19
19
 
20
20
  class ChatCompletionResponse(BaseModel):
@@ -26,6 +26,6 @@ class ChatCompletionResponse(BaseModel):
26
26
 
27
27
  usage: UsageInfo
28
28
 
29
- created: Optional[int] = None
29
+ created: int
30
30
 
31
- choices: Optional[List[ChatCompletionChoice]] = None
31
+ choices: List[ChatCompletionChoice]
@@ -0,0 +1,7 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Literal
5
+
6
+
7
+ EmbeddingDtype = Literal["float", "int8", "uint8", "binary", "ubinary"]
@@ -1,10 +1,12 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from mistralai.types import BaseModel
4
+ from .embeddingdtype import EmbeddingDtype
5
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
6
  import pydantic
6
- from typing import List, Union
7
- from typing_extensions import Annotated, TypeAliasType, TypedDict
7
+ from pydantic import model_serializer
8
+ from typing import List, Optional, Union
9
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
8
10
 
9
11
 
10
12
  EmbeddingRequestInputsTypedDict = TypeAliasType(
@@ -22,6 +24,9 @@ class EmbeddingRequestTypedDict(TypedDict):
22
24
  r"""ID of the model to use."""
23
25
  inputs: EmbeddingRequestInputsTypedDict
24
26
  r"""Text to embed."""
27
+ output_dimension: NotRequired[Nullable[int]]
28
+ r"""The dimension of the output embeddings."""
29
+ output_dtype: NotRequired[EmbeddingDtype]
25
30
 
26
31
 
27
32
  class EmbeddingRequest(BaseModel):
@@ -30,3 +35,38 @@ class EmbeddingRequest(BaseModel):
30
35
 
31
36
  inputs: Annotated[EmbeddingRequestInputs, pydantic.Field(alias="input")]
32
37
  r"""Text to embed."""
38
+
39
+ output_dimension: OptionalNullable[int] = UNSET
40
+ r"""The dimension of the output embeddings."""
41
+
42
+ output_dtype: Optional[EmbeddingDtype] = None
43
+
44
+ @model_serializer(mode="wrap")
45
+ def serialize_model(self, handler):
46
+ optional_fields = ["output_dimension", "output_dtype"]
47
+ nullable_fields = ["output_dimension"]
48
+ null_default_fields = []
49
+
50
+ serialized = handler(self)
51
+
52
+ m = {}
53
+
54
+ for n, f in self.model_fields.items():
55
+ k = f.alias or n
56
+ val = serialized.get(k)
57
+ serialized.pop(k, None)
58
+
59
+ optional_nullable = k in optional_fields and k in nullable_fields
60
+ is_set = (
61
+ self.__pydantic_fields_set__.intersection({n})
62
+ or k in null_default_fields
63
+ ) # pylint: disable=no-member
64
+
65
+ if val is not None and val != UNSET_SENTINEL:
66
+ m[k] = val
67
+ elif val != UNSET_SENTINEL and (
68
+ not k in optional_fields or (optional_nullable and is_set)
69
+ ):
70
+ m[k] = val
71
+
72
+ return m
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
  from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
5
5
  from .usageinfo import UsageInfo, UsageInfoTypedDict
6
6
  from mistralai.types import BaseModel
7
- from typing import List, Optional
8
- from typing_extensions import NotRequired, TypedDict
7
+ from typing import List
8
+ from typing_extensions import TypedDict
9
9
 
10
10
 
11
11
  class FIMCompletionResponseTypedDict(TypedDict):
@@ -13,8 +13,8 @@ class FIMCompletionResponseTypedDict(TypedDict):
13
13
  object: str
14
14
  model: str
15
15
  usage: UsageInfoTypedDict
16
- created: NotRequired[int]
17
- choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
16
+ created: int
17
+ choices: List[ChatCompletionChoiceTypedDict]
18
18
 
19
19
 
20
20
  class FIMCompletionResponse(BaseModel):
@@ -26,6 +26,6 @@ class FIMCompletionResponse(BaseModel):
26
26
 
27
27
  usage: UsageInfo
28
28
 
29
- created: Optional[int] = None
29
+ created: int
30
30
 
31
- choices: Optional[List[ChatCompletionChoice]] = None
31
+ choices: List[ChatCompletionChoice]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mistralai
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Python Client SDK for the Mistral AI API.
5
5
  Author: Mistral
6
6
  Requires-Python: >=3.9
@@ -139,17 +139,17 @@ mistralai/_hooks/deprecation_warning.py,sha256=eyEOf7-o9uqqNWJnufD2RXp3dYrGV4in9
139
139
  mistralai/_hooks/registration.py,sha256=ML0W-XbE4WYdJ4eGks_XxF2aLCJTaIWjQATFGzFwvyU,861
140
140
  mistralai/_hooks/sdkhooks.py,sha256=s-orhdvnV89TmI3QiPC2LWQtYeM9RrsG1CTll-fYZmQ,2559
141
141
  mistralai/_hooks/types.py,sha256=z3AUFDpRJHj2m3h5PklvUeEcGohY0cfph4jL6-nGIzs,2812
142
- mistralai/_version.py,sha256=2h0W-7sYb3UbVvUO0AVfyy7sRfFO6mJfM7TomiOVI9I,460
142
+ mistralai/_version.py,sha256=ov7SFKb_NFEoxMwoKD6j1BNiqtY8jnujwybVOhD60gY,460
143
143
  mistralai/agents.py,sha256=o_apyuwiDzxv-U252T84ynAHCb5fn1q7MMXqrZ4oHLo,32652
144
144
  mistralai/async_client.py,sha256=KUdYxIIqoD6L7vB0EGwUR6lQ0NK5iCTHjnLVR9CVcJY,355
145
145
  mistralai/basesdk.py,sha256=GsU5bp8O5fBCl34tKxaYmeYSIIM971eAPeFBBC_BpFo,12191
146
146
  mistralai/batch.py,sha256=YN4D0Duwrap9Ysmp_lRpADYp1Znay7THE_z8ERGvDds,501
147
- mistralai/beta.py,sha256=ZoBpHRinJu_LlNM7q91HC7huXmzKVpgGLL_bRdXjqBg,662
147
+ mistralai/beta.py,sha256=wiOFmXiXNKeRMOEdgeIwVqAWg6E_3sqHc_ojwU9oZoY,728
148
148
  mistralai/chat.py,sha256=1XVVVvDi726bq6HXCur6-dsmFfzQAEpEWbKT_3sTZ4A,40549
149
149
  mistralai/classifiers.py,sha256=Cbrb6X_eq3-Yz5ZhWkOsFDTGbo3hkgh-vtIEQmU_UdI,33776
150
150
  mistralai/client.py,sha256=hrPg-LciKMKiascF0WbRRmqQyCv1lb2yDh6j-aaKVNo,509
151
- mistralai/conversations.py,sha256=2RTDBKRHPXGtTobMonJUnVWy9zP3i3aVRWE4pcKdF-Y,109256
152
- mistralai/embeddings.py,sha256=Tq5ZEo6CR0ktQCdxX7mhLy5CfzI5c8mtkuadIVtsWgM,8644
151
+ mistralai/conversations.py,sha256=53wWkEymYuoiuGpKwdoAVe5drJYTKT3JsuEQSt59uOA,109317
152
+ mistralai/embeddings.py,sha256=SHG4s0yKwCdKhYKGXKdzPXmcD4_WXI9BBnrM7cSI3gw,9258
153
153
  mistralai/extra/README.md,sha256=BTS9fy0ijkiUP7ZVoFQ7FVBxHtXIXqucYZyy_ucFjo4,1739
154
154
  mistralai/extra/__init__.py,sha256=8DsU_omYYadqcwlmBOoakBwkWKcSohwLmtB8v-jkn2M,392
155
155
  mistralai/extra/exceptions.py,sha256=4EEygCfdsniYiroHEFVSVDqerQZkpRG027mlJXvMqns,428
@@ -175,9 +175,9 @@ mistralai/fim.py,sha256=UMx-bFYbaSyANZug8VrCabHsqePdiHoYQO1YMKB2MvY,27935
175
175
  mistralai/fine_tuning.py,sha256=UENQqfE054VEsAYxdruV-TBLFIFfO-joXNznH08GUvE,477
176
176
  mistralai/httpclient.py,sha256=lC-YQ7q4yiJGKElxBeb3aZnr-4aYxjgEpZ6roeXYlyg,4318
177
177
  mistralai/jobs.py,sha256=1DZE14ad348Vg82VHhLRyXhu7SIh8_KgWXc_jP2oFIA,46767
178
- mistralai/mistral_agents.py,sha256=txjs5YVDV4u5sEHI6WFPcE3KGXb0I2Il3aJS6Eq9iCc,45543
178
+ mistralai/mistral_agents.py,sha256=FrIUGExYpwz3EyMOetLKsD-LtcsoB1xrWR86zp1WwzE,45573
179
179
  mistralai/mistral_jobs.py,sha256=EQHFFxFkkx6XvPX-9S8TRZvVSOLUL7z91cg56J8pskQ,31114
180
- mistralai/models/__init__.py,sha256=3ZtDRtA2WtDv6pOqLkBFkI2M1WmJV7hc4A6ihqudzrw,43330
180
+ mistralai/models/__init__.py,sha256=h-8plap2U1shoIGyNyeNpQmSH5GvIsVZfoT4wC_4Fcc,43395
181
181
  mistralai/models/agent.py,sha256=dx_uXYDNWoENtgK4InGqs1A9eCw1xDphMPCF_Pv43VQ,4185
182
182
  mistralai/models/agentconversation.py,sha256=WaPQn3pGiD2c6bNaP7Ya1akVQt54aK7qDtAEnHAjwrk,2086
183
183
  mistralai/models/agentcreationrequest.py,sha256=u9WM95ywRmDqnwx0yfEOT1FnJbiPY8lNtju71d3ix4A,3952
@@ -212,7 +212,7 @@ mistralai/models/builtinconnectors.py,sha256=cX1M7Q_2tsWeuH-lKWomXED7xN7Du6BJKvY
212
212
  mistralai/models/chatclassificationrequest.py,sha256=PmU036oOlGqfd75hNESDUJiN4uJNYguACoCt6CzBC2M,534
213
213
  mistralai/models/chatcompletionchoice.py,sha256=6iIFLZj2KYx0HFfzS3-E3sNXG6mPEAlDyXxIA5iZI_U,849
214
214
  mistralai/models/chatcompletionrequest.py,sha256=6Innwpi7UnKmyauATOJForAVvW0tkSnbjsiQOOp5OKg,9777
215
- mistralai/models/chatcompletionresponse.py,sha256=sLE-_Bx9W5rH2-HE2fBWPVbJbmBWx_jSY2mJ3KBEn6w,792
215
+ mistralai/models/chatcompletionresponse.py,sha256=px0hjCapAtTP50u36hiQdPcC9X6LU81Nq5aJ3AlofjM,709
216
216
  mistralai/models/chatcompletionstreamrequest.py,sha256=0NFa_nMMRmHU66Hsgu1Zm4fggT0AzvW_imrkyZ4sUxc,9465
217
217
  mistralai/models/chatmoderationrequest.py,sha256=x1eAoxx_GhaxqGRe4wsqNaUi59K39HQakkedLJVUVD8,2236
218
218
  mistralai/models/checkpointout.py,sha256=A2kXS8-VT_1lbg3brifVjZD6tXdsET8vLqBm2a-yXgA,1109
@@ -256,7 +256,8 @@ mistralai/models/deletemodelout.py,sha256=W_crO0WtksoKUgq5s9Yh8zS8RxSuyKYQCBt1i8
256
256
  mistralai/models/deltamessage.py,sha256=7NtvEjdmBOl86rwOx7x2fcCCJSzIF8K6-eu-G9Wr9PI,1939
257
257
  mistralai/models/documentlibrarytool.py,sha256=EN50sX8wgfAw7mF6W8BkOwKyqRvEzGvHgINn-evuCcg,654
258
258
  mistralai/models/documenturlchunk.py,sha256=j3JB_Cy1eIRY7fTJe8AvQrdrLEA6xsJcM1l9_a1Sh68,1704
259
- mistralai/models/embeddingrequest.py,sha256=5GUp8OUrIAcoSdhJLO8Ue45_kGuzVaCqz85g0ZQx3gM,864
259
+ mistralai/models/embeddingdtype.py,sha256=c7L-PKhBgPVPZeMGuMub0ZOs0MdxMbpW2ebE0t7oEpU,209
260
+ mistralai/models/embeddingrequest.py,sha256=BE3L0ImjkdmzwOSUQnC_vCsnvyeQqWmqRw4xgzX6vJc,2258
260
261
  mistralai/models/embeddingresponse.py,sha256=te6E_LYEzRjHJ9QREmsFp5PeNP2J_8ALVjyb1T20pNA,663
261
262
  mistralai/models/embeddingresponsedata.py,sha256=fJ3mrZqyBBBE40a6iegOJX3DVDfgyMRq23ByeGSTLFk,534
262
263
  mistralai/models/eventout.py,sha256=TouRJeISBLphMTPHfgSOpuoOmbGDVohPOrdgHyExMpw,1633
@@ -270,7 +271,7 @@ mistralai/models/files_api_routes_upload_fileop.py,sha256=gIGH5xcPryWYkj1FmNv_0-
270
271
  mistralai/models/fileschema.py,sha256=n_IjCdNOrC2fuzkv75wJn01XvqGTmPK3JqAFSHaOiMA,2597
271
272
  mistralai/models/filesignedurl.py,sha256=VwvuhzhJulAB99Qxz6zr-2F1aINosAfaSxU0IhytDSU,289
272
273
  mistralai/models/fimcompletionrequest.py,sha256=wWDCkQ_PMnjB8DrIuIvVJlPGqQtTpVDHt4p7xJ204Ug,6565
273
- mistralai/models/fimcompletionresponse.py,sha256=_QwzRuL3KuKkyrA4Fxp366SW0H0EzOA7f4FLkWLm-PM,790
274
+ mistralai/models/fimcompletionresponse.py,sha256=qNgb2WFVgkaW7Isfkk2Aol1gTV9UkhQomcDAhoPDeYw,707
274
275
  mistralai/models/fimcompletionstreamrequest.py,sha256=fxuR8FDOWMwIqlYU9ttAfGeRdVgTz4l2k26_OEfxelg,5944
275
276
  mistralai/models/finetuneablemodeltype.py,sha256=XmTpXeQU8AINnn1kVmXldFUauCaEnRtJNFAXUTVb6RQ,197
276
277
  mistralai/models/ftclassifierlossfunction.py,sha256=ApQB8ssAh2yE26-CljxPO7Jc5lxq3OoBPR4rUp-Td9U,203
@@ -390,7 +391,7 @@ mistralai/utils/serializers.py,sha256=EGH40Pgp3sSK9uM4PxL7_SYzSHtmo-Uy6QIE5xLVg6
390
391
  mistralai/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
391
392
  mistralai/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
392
393
  mistralai/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
393
- mistralai-1.8.0.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
394
- mistralai-1.8.0.dist-info/METADATA,sha256=dL-LRZiJrDkGgzpt53FZDtT7zka1PQIEIWGX4sD_Ezo,33379
395
- mistralai-1.8.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
396
- mistralai-1.8.0.dist-info/RECORD,,
394
+ mistralai-1.8.1.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
395
+ mistralai-1.8.1.dist-info/METADATA,sha256=zvxBN6ahY13VTUqmneFHFNXCrEK7Fl5nlhKFGkj_PKw,33379
396
+ mistralai-1.8.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
397
+ mistralai-1.8.1.dist-info/RECORD,,