Skip to content

Commit a53f0d1

Browse files
github-actions[bot]speakeasybotGaspardBT
authored
chore: 🐝 Update SDK - Generate MISTRALAI MISTRALAI-SDK 1.2.1 (#154)
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.434.7 * update the gcp name logic --------- Co-authored-by: speakeasybot <[email protected]> Co-authored-by: gaspardBT <[email protected]>
1 parent cc2a09a commit a53f0d1

File tree

8 files changed

+42
-22
lines changed

8 files changed

+42
-22
lines changed

β€Ž.speakeasy/gen.lockβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ id: 2d045ec7-2ebb-4f4d-ad25-40953b132161
33
management:
44
docChecksum: ee15d853ecc28d415d6b33191893a6ff
55
docVersion: 0.0.2
6-
speakeasyVersion: 1.434.4
6+
speakeasyVersion: 1.434.7
77
generationVersion: 2.452.0
8-
releaseVersion: 1.2.0
9-
configChecksum: 17ae764aa509274d1cf2d75af5bf6abb
8+
releaseVersion: 1.2.1
9+
configChecksum: 5d659f51b118508e47958545e6b539d2
1010
repoURL: https://github.com/mistralai/client-python.git
1111
installationURL: https://github.com/mistralai/client-python.git
1212
published: true

β€Ž.speakeasy/gen.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ generation:
1313
oAuth2ClientCredentialsEnabled: true
1414
oAuth2PasswordEnabled: false
1515
python:
16-
version: 1.2.0
16+
version: 1.2.1
1717
additionalDependencies:
1818
dev:
1919
pytest: ^8.2.2

β€Ž.speakeasy/workflow.lockβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.434.4
1+
speakeasyVersion: 1.434.7
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-openapi-azure
@@ -18,6 +18,7 @@ sources:
1818
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
1919
tags:
2020
- latest
21+
- main
2122
targets:
2223
mistralai-azure-sdk:
2324
source: mistral-azure-source
@@ -35,7 +36,7 @@ targets:
3536
sourceRevisionDigest: sha256:e658442ebfc83351cbb7873fb17b03f07ff9edebd8eddfce5577e2c5c7bfafce
3637
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
3738
codeSamplesNamespace: mistral-openapi-code-samples
38-
codeSamplesRevisionDigest: sha256:e56faedc510d1c011d19e5fbbaa9d41917ffd6c22833b0795a61aa6da1cbca9b
39+
codeSamplesRevisionDigest: sha256:f48900efe513aa95888e4035452ba1d54a2b1f8e872454ccb5bdca24d4fc7b09
3940
workflow:
4041
workflowVersion: 1.0.0
4142
speakeasyVersion: latest

β€ŽRELEASES.mdβ€Ž

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,14 @@ Based on:
5858
### Generated
5959
- [python v1.2.0] .
6060
### Releases
61-
- [PyPI v1.2.0] https://pypi.org/project/mistralai/1.2.0 - .
61+
- [PyPI v1.2.0] https://pypi.org/project/mistralai/1.2.0 - .
62+
63+
## 2024-11-08 13:41:24
64+
### Changes
65+
Based on:
66+
- OpenAPI Doc
67+
- Speakeasy CLI 1.434.7 (2.452.0) https://github.com/speakeasy-api/speakeasy
68+
### Generated
69+
- [python v1.2.1] .
70+
### Releases
71+
- [PyPI v1.2.1] https://pypi.org/project/mistralai/1.2.1 - .

β€Žpackages/mistralai_gcp/src/mistralai_gcp/sdk.pyβ€Ž

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
22

33
import json
4-
from typing import Optional, Union
4+
from typing import Optional, Tuple, Union
55

66
import google.auth
77
import google.auth.credentials
@@ -20,6 +20,19 @@
2020
from .utils.logger import Logger, NoOpLogger
2121
from .utils.retries import RetryConfig
2222

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+
2336

2437
class MistralGoogleCloud(BaseSDK):
2538
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 @@ def __init__(self, region: str, project_id: str):
140153
def before_request(
141154
self, hook_ctx, request: httpx.Request
142155
) -> 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
144157
# We do this here so that the API remains more user-friendly
145-
model = None
146-
model_version = None
158+
model_id = None
147159
new_content = None
148160
if request.content:
149161
parsed = json.loads(request.content.decode("utf-8"))
150162
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
154165
new_content = json.dumps(parsed).encode("utf-8")
155166

156-
if model == "":
167+
if model_id == "":
157168
raise models.SDKError("model must be provided")
158169

159-
if model_version is None:
160-
raise models.SDKError("model_version must be provided")
161170

162171
stream = "streamRawPredict" in request.url.path
163172
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}"
165174

166175
headers = dict(request.headers)
167176
# Delete content-length header as it will need to be recalculated

β€Žpyproject.tomlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mistralai"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
description = "Python Client SDK for the Mistral AI API."
55
authors = ["Mistral"]
66
readme = "README-PYPI.md"

β€Žsrc/mistralai/_version.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import importlib.metadata
44

55
__title__: str = "mistralai"
6-
__version__: str = "1.2.0"
6+
__version__: str = "1.2.1"
77

88
try:
99
if __package__ is not None:

β€Žsrc/mistralai/sdkconfiguration.pyβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class SDKConfiguration:
2828
server: Optional[str] = ""
2929
language: str = "python"
3030
openapi_doc_version: str = "0.0.2"
31-
sdk_version: str = "1.2.0"
31+
sdk_version: str = "1.2.1"
3232
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"
3434
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
3535
timeout_ms: Optional[int] = None
3636

0 commit comments

Comments
Β (0)