mistralai 1.2.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/_version.py CHANGED
@@ -3,7 +3,7 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "mistralai"
6
- __version__: str = "1.2.0"
6
+ __version__: str = "1.2.1"
7
7
 
8
8
  try:
9
9
  if __package__ is not None:
@@ -28,9 +28,9 @@ class SDKConfiguration:
28
28
  server: Optional[str] = ""
29
29
  language: str = "python"
30
30
  openapi_doc_version: str = "0.0.2"
31
- sdk_version: str = "1.2.0"
31
+ sdk_version: str = "1.2.1"
32
32
  gen_version: str = "2.452.0"
33
- user_agent: str = "speakeasy-sdk/python 1.2.0 2.452.0 0.0.2 mistralai"
33
+ user_agent: str = "speakeasy-sdk/python 1.2.1 2.452.0 0.0.2 mistralai"
34
34
  retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
35
35
  timeout_ms: Optional[int] = None
36
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mistralai
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Python Client SDK for the Mistral AI API.
5
5
  Home-page: https://github.com/mistralai/client-python.git
6
6
  Author: Mistral
@@ -103,7 +103,7 @@ mistralai_gcp/models/usageinfo.py,sha256=Uo2LJB58JMzlrmnfMUQnDxiMCINMS63ejp-sbOq
103
103
  mistralai_gcp/models/usermessage.py,sha256=Wv_yQOP6K81KZZ13Jn0N4i7nM8qh3yuPO0t0pgq-JHQ,1693
104
104
  mistralai_gcp/models/validationerror.py,sha256=nPH4v5nEe7Vy-l4fYft3vvfb67yhGYHhoAUFDkupEZg,462
105
105
  mistralai_gcp/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
106
- mistralai_gcp/sdk.py,sha256=WkfTdRfXdLVqJXNvQG53N8ewRQDj3w-3dGztWaxR2Og,6506
106
+ mistralai_gcp/sdk.py,sha256=qmgp6E5LTBMnNN3mc1aDzmnHnvRQNTR7JEJgjBkYGWg,6730
107
107
  mistralai_gcp/sdkconfiguration.py,sha256=tl3dHaj9Bflp_NXy8vZUMVOyeo1FjFRccgYcJKOM0rk,1700
108
108
  mistralai_gcp/types/__init__.py,sha256=RArOwSgeeTIva6h-4ttjXwMUeCkz10nAFBL9D-QljI4,377
109
109
  mistralai_gcp/types/basemodel.py,sha256=PexI39iKiOkIlobB8Ueo0yn8PLHp6_wb-WO-zelNDZY,1170
@@ -130,7 +130,7 @@ mistralai/_hooks/deprecation_warning.py,sha256=eyEOf7-o9uqqNWJnufD2RXp3dYrGV4in9
130
130
  mistralai/_hooks/registration.py,sha256=ML0W-XbE4WYdJ4eGks_XxF2aLCJTaIWjQATFGzFwvyU,861
131
131
  mistralai/_hooks/sdkhooks.py,sha256=s-orhdvnV89TmI3QiPC2LWQtYeM9RrsG1CTll-fYZmQ,2559
132
132
  mistralai/_hooks/types.py,sha256=vUkTVk_TSaK10aEj368KYWvnd4T5EsawixMcTro_UHc,2570
133
- mistralai/_version.py,sha256=2mDc-6ys7Z2_9DG49D98FdOTezgZbeAhnySMQPuquT0,313
133
+ mistralai/_version.py,sha256=j99Wka-bmcP4xPwygSV8i6CYX38lJNUdWGnDWwKDOFM,313
134
134
  mistralai/agents.py,sha256=EYdKVTBsW4QeH6afr5CrWFbEL6K1wzCeZw2l5DeBdTw,28771
135
135
  mistralai/async_client.py,sha256=KUdYxIIqoD6L7vB0EGwUR6lQ0NK5iCTHjnLVR9CVcJY,355
136
136
  mistralai/basesdk.py,sha256=MQIeNInArcIcDYgSy67EDf77ykys9JwjTlnboqdpEJ8,11273
@@ -251,7 +251,7 @@ mistralai/models/wandbintegrationout.py,sha256=C0HpS8jJGnACs7eWnuIq0qJEroIUAbjkv
251
251
  mistralai/models_.py,sha256=Kj5U6ODBgKiKs93Miaq11dlV3MDvaz--nI8ucvZVark,39797
252
252
  mistralai/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
253
253
  mistralai/sdk.py,sha256=JBssVtpwLDcni_Q-IHNs62Zz8-ZxFldiOj3e42-Cb8k,5007
254
- mistralai/sdkconfiguration.py,sha256=klmP_ccBSxSvYtRpvkGJgtdk6HP2_qwTwUuovI-vIP4,1688
254
+ mistralai/sdkconfiguration.py,sha256=BWK7DpPHmxpvpWIdtqbgi5_xBxDM3Ra-EOHCmd4IzhA,1688
255
255
  mistralai/types/__init__.py,sha256=RArOwSgeeTIva6h-4ttjXwMUeCkz10nAFBL9D-QljI4,377
256
256
  mistralai/types/basemodel.py,sha256=PexI39iKiOkIlobB8Ueo0yn8PLHp6_wb-WO-zelNDZY,1170
257
257
  mistralai/utils/__init__.py,sha256=8npwwHS-7zjVrbkzBGO-Uk4GkjC240PCleMbgPK1Axs,2418
@@ -270,7 +270,7 @@ mistralai/utils/serializers.py,sha256=BSJT7kBOkNBFyP7KREyMoe14JGbgijD1M6AXFMbdmc
270
270
  mistralai/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
271
271
  mistralai/utils/values.py,sha256=_89YXPTI_BU6SXJBzFR4pIzTCBPQW9tsOTN1jeBBIDs,3428
272
272
  mistralai/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
273
- mistralai-1.2.0.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
274
- mistralai-1.2.0.dist-info/METADATA,sha256=pXGl4n99vLAB5MMcYiiXae_5wU1TZx0nM2puSZAaThM,26504
275
- mistralai-1.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
276
- mistralai-1.2.0.dist-info/RECORD,,
273
+ mistralai-1.2.1.dist-info/LICENSE,sha256=rUtQ_9GD0OyLPlb-2uWVdfE87hzudMRmsW-tS-0DK-0,11340
274
+ mistralai-1.2.1.dist-info/METADATA,sha256=Rjjd8iWB2Dx-zQeu4cN-dgmQYeQNSpk3sxFlf_iYYOY,26504
275
+ mistralai-1.2.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
276
+ mistralai-1.2.1.dist-info/RECORD,,
mistralai_gcp/sdk.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
2
2
 
3
3
  import json
4
- from typing import Optional, Union
4
+ from typing import Optional, Tuple, Union
5
5
 
6
6
  import google.auth
7
7
  import google.auth.credentials
@@ -20,6 +20,19 @@ from .sdkconfiguration import SDKConfiguration
20
20
  from .utils.logger import Logger, NoOpLogger
21
21
  from .utils.retries import RetryConfig
22
22
 
23
+ LEGACY_MODEL_ID_FORMAT = {
24
+ "codestral-2405": "codestral@2405",
25
+ "mistral-large-2407": "mistral-large@2407",
26
+ "mistral-nemo-2407": "mistral-nemo@2407",
27
+ }
28
+
29
+ def get_model_info(model: str) -> Tuple[str,str]:
30
+ # if the model requiers the legacy fomat, use it, else do nothing.
31
+ model_id = LEGACY_MODEL_ID_FORMAT.get(model, model)
32
+ model = "-".join(model.split("-")[:-1])
33
+ return model, model_id
34
+
35
+
23
36
 
24
37
  class MistralGoogleCloud(BaseSDK):
25
38
  r"""Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it."""
@@ -140,28 +153,24 @@ class GoogleCloudBeforeRequestHook(BeforeRequestHook):
140
153
  def before_request(
141
154
  self, hook_ctx, request: httpx.Request
142
155
  ) -> Union[httpx.Request, Exception]:
143
- # The goal of this function is to template in the region, project, model, and model_version into the URL path
156
+ # The goal of this function is to template in the region, project and model into the URL path
144
157
  # We do this here so that the API remains more user-friendly
145
- model = None
146
- model_version = None
158
+ model_id = None
147
159
  new_content = None
148
160
  if request.content:
149
161
  parsed = json.loads(request.content.decode("utf-8"))
150
162
  model_raw = parsed.get("model")
151
- model = "-".join(model_raw.split("-")[:-1])
152
- model_version = model_raw.split("-")[-1]
153
- parsed["model"] = model
163
+ model_name, model_id = get_model_info(model_raw)
164
+ parsed["model"] = model_name
154
165
  new_content = json.dumps(parsed).encode("utf-8")
155
166
 
156
- if model == "":
167
+ if model_id == "":
157
168
  raise models.SDKError("model must be provided")
158
169
 
159
- if model_version is None:
160
- raise models.SDKError("model_version must be provided")
161
170
 
162
171
  stream = "streamRawPredict" in request.url.path
163
172
  specifier = "streamRawPredict" if stream else "rawPredict"
164
- url = f"/v1/projects/{self.project_id}/locations/{self.region}/publishers/mistralai/models/{model}@{model_version}:{specifier}"
173
+ url = f"/v1/projects/{self.project_id}/locations/{self.region}/publishers/mistralai/models/{model_id}:{specifier}"
165
174
 
166
175
  headers = dict(request.headers)
167
176
  # Delete content-length header as it will need to be recalculated