Skip to content

Commit cc2a09a

Browse files
github-actions[bot]speakeasybotGaspardBT
authored
chore: 🐝 Update SDK - Generate MISTRALAI MISTRALAI-SDK 1.2.0 (#153)
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.434.3 * push providers * fix assistant message * fix assistant message in providers --------- Co-authored-by: speakeasybot <[email protected]> Co-authored-by: gaspardBT <[email protected]>
1 parent 9f487dc commit cc2a09a

File tree

291 files changed

+5416
-1671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+5416
-1671
lines changed

.speakeasy/gen.lock

Lines changed: 123 additions & 27 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ generation:
1111
requestResponseComponentNamesFeb2024: true
1212
auth:
1313
oAuth2ClientCredentialsEnabled: true
14+
oAuth2PasswordEnabled: false
1415
python:
15-
version: 1.1.0
16+
version: 1.2.0
1617
additionalDependencies:
1718
dev:
1819
pytest: ^8.2.2
@@ -23,8 +24,11 @@ python:
2324
description: Python Client SDK for the Mistral AI API.
2425
enumFormat: union
2526
envVarPrefix: MISTRAL
27+
fixFlags:
28+
responseRequiredSep2024: false
2629
flattenGlobalSecurity: true
2730
flattenRequests: true
31+
flatteningOrder: parameters-first
2832
imports:
2933
option: openapi
3034
paths:
@@ -34,7 +38,7 @@ python:
3438
shared: ""
3539
webhooks: ""
3640
inputModelSuffix: input
37-
maxMethodParams: 4
41+
maxMethodParams: 15
3842
methodArguments: infer-optional-args
3943
outputModelSuffix: output
4044
packageName: mistralai

.speakeasy/workflow.lock

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,60 @@
1-
speakeasyVersion: 1.398.0
1+
speakeasyVersion: 1.434.4
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-openapi-azure
5-
sourceRevisionDigest: sha256:4e9539e6903e630aa69e48af190a24d3702f6038c7b7a92472c7942597c2a6f5
6-
sourceBlobDigest: sha256:3ace0709471c04a040c9763097fef0081d6c21a1be0b694dfe5991c045b76d18
5+
sourceRevisionDigest: sha256:8fda8235e30128cc8e1c4e1b828316551d03b584568789f262dc287b81d584ee
6+
sourceBlobDigest: sha256:3c039e1f8a2230a86b0e1acec6224f6b8d6f181fb222b6b3b39d38b52075a8ec
77
tags:
88
- latest
99
mistral-google-cloud-source:
1010
sourceNamespace: mistral-openapi-google-cloud
11-
sourceRevisionDigest: sha256:3047ad3ff8797fded89618b375d1398d48924a3a5f9ea1000c4284a110567c43
12-
sourceBlobDigest: sha256:02bbcef310f965d7ad089fb46d57b39f45b47cbc8f5cf90f728db03e960bdbca
11+
sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e
12+
sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be
1313
tags:
1414
- latest
1515
mistral-openapi:
1616
sourceNamespace: mistral-openapi
17-
sourceRevisionDigest: sha256:8e2d62b2242960d958406ba266eda41a013c1459dbac67195f8e2662c04cd05f
18-
sourceBlobDigest: sha256:9fbff48fe087e3b2f950b1cfa52b6a25143982741dc7e6750dd14d9c5bed4041
17+
sourceRevisionDigest: sha256:e658442ebfc83351cbb7873fb17b03f07ff9edebd8eddfce5577e2c5c7bfafce
18+
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
1919
tags:
2020
- latest
2121
targets:
2222
mistralai-azure-sdk:
2323
source: mistral-azure-source
2424
sourceNamespace: mistral-openapi-azure
25-
sourceRevisionDigest: sha256:4e9539e6903e630aa69e48af190a24d3702f6038c7b7a92472c7942597c2a6f5
26-
sourceBlobDigest: sha256:3ace0709471c04a040c9763097fef0081d6c21a1be0b694dfe5991c045b76d18
25+
sourceRevisionDigest: sha256:8fda8235e30128cc8e1c4e1b828316551d03b584568789f262dc287b81d584ee
26+
sourceBlobDigest: sha256:3c039e1f8a2230a86b0e1acec6224f6b8d6f181fb222b6b3b39d38b52075a8ec
2727
mistralai-gcp-sdk:
2828
source: mistral-google-cloud-source
2929
sourceNamespace: mistral-openapi-google-cloud
30-
sourceRevisionDigest: sha256:3047ad3ff8797fded89618b375d1398d48924a3a5f9ea1000c4284a110567c43
31-
sourceBlobDigest: sha256:02bbcef310f965d7ad089fb46d57b39f45b47cbc8f5cf90f728db03e960bdbca
30+
sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e
31+
sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be
3232
mistralai-sdk:
3333
source: mistral-openapi
3434
sourceNamespace: mistral-openapi
35-
sourceRevisionDigest: sha256:8e2d62b2242960d958406ba266eda41a013c1459dbac67195f8e2662c04cd05f
36-
sourceBlobDigest: sha256:9fbff48fe087e3b2f950b1cfa52b6a25143982741dc7e6750dd14d9c5bed4041
35+
sourceRevisionDigest: sha256:e658442ebfc83351cbb7873fb17b03f07ff9edebd8eddfce5577e2c5c7bfafce
36+
sourceBlobDigest: sha256:559403eaaa97c021eaf0022adddb1066694d879a946c87057e942806d5a2a2a2
37+
codeSamplesNamespace: mistral-openapi-code-samples
38+
codeSamplesRevisionDigest: sha256:e56faedc510d1c011d19e5fbbaa9d41917ffd6c22833b0795a61aa6da1cbca9b
3739
workflow:
3840
workflowVersion: 1.0.0
3941
speakeasyVersion: latest
4042
sources:
4143
mistral-azure-source:
4244
inputs:
43-
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure
45+
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure:main
4446
registry:
45-
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure
47+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure:main
4648
mistral-google-cloud-source:
4749
inputs:
48-
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud
50+
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud:main
4951
registry:
50-
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud
52+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud:main
5153
mistral-openapi:
5254
inputs:
53-
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi
55+
- location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi:main
5456
registry:
55-
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi
57+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi:main
5658
targets:
5759
mistralai-azure-sdk:
5860
target: python
@@ -61,16 +63,28 @@ workflow:
6163
publish:
6264
pypi:
6365
token: $pypi_token
66+
codeSamples:
67+
registry:
68+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure-code-samples
69+
blocking: false
6470
mistralai-gcp-sdk:
6571
target: python
6672
source: mistral-google-cloud-source
6773
output: ./packages/mistralai_gcp
6874
publish:
6975
pypi:
7076
token: $pypi_token
77+
codeSamples:
78+
registry:
79+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud-code-samples
80+
blocking: false
7181
mistralai-sdk:
7282
target: python
7383
source: mistral-openapi
7484
publish:
7585
pypi:
7686
token: $pypi_token
87+
codeSamples:
88+
registry:
89+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-code-samples
90+
blocking: false

.speakeasy/workflow.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,28 @@ targets:
2424
publish:
2525
pypi:
2626
token: $pypi_token
27+
codeSamples:
28+
registry:
29+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-azure-code-samples
30+
blocking: false
2731
mistralai-gcp-sdk:
2832
target: python
2933
source: mistral-google-cloud-source
3034
output: ./packages/mistralai_gcp
3135
publish:
3236
pypi:
3337
token: $pypi_token
38+
codeSamples:
39+
registry:
40+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-google-cloud-code-samples
41+
blocking: false
3442
mistralai-sdk:
3543
target: python
3644
source: mistral-openapi
3745
publish:
3846
pypi:
3947
token: $pypi_token
48+
codeSamples:
49+
registry:
50+
location: registry.speakeasyapi.dev/mistral-dev/mistral-dev/mistral-openapi-code-samples
51+
blocking: false

README.md

Lines changed: 88 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ s = Mistral(
180180

181181
res = s.agents.complete(messages=[
182182
{
183-
"content": "<value>",
183+
"content": "Who is the best French painter? Answer in one short sentence.",
184+
"role": "user",
184185
},
185186
], agent_id="<value>")
186187

@@ -212,6 +213,53 @@ async def main():
212213
# handle response
213214
pass
214215

216+
asyncio.run(main())
217+
```
218+
219+
### Create Embedding Request
220+
221+
This example shows how to create embedding request.
222+
223+
```python
224+
# Synchronous Example
225+
from mistralai import Mistral
226+
import os
227+
228+
s = Mistral(
229+
api_key=os.getenv("MISTRAL_API_KEY", ""),
230+
)
231+
232+
res = s.embeddings.create(inputs=[
233+
"Embed this sentence.",
234+
"As well as this one.",
235+
], model="Wrangler")
236+
237+
if res is not None:
238+
# handle response
239+
pass
240+
```
241+
242+
</br>
243+
244+
The same SDK client can also be used to make asychronous requests by importing asyncio.
245+
```python
246+
# Asynchronous Example
247+
import asyncio
248+
from mistralai import Mistral
249+
import os
250+
251+
async def main():
252+
s = Mistral(
253+
api_key=os.getenv("MISTRAL_API_KEY", ""),
254+
)
255+
res = await s.embeddings.create_async(inputs=[
256+
"Embed this sentence.",
257+
"As well as this one.",
258+
], model="Wrangler")
259+
if res is not None:
260+
# handle response
261+
pass
262+
215263
asyncio.run(main())
216264
```
217265
<!-- End SDK Example Usage [usage] -->
@@ -322,11 +370,26 @@ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/REA
322370
* [complete](docs/sdks/agents/README.md#complete) - Agents Completion
323371
* [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion
324372

373+
### [batch](docs/sdks/batch/README.md)
374+
375+
376+
#### [batch.jobs](docs/sdks/mistraljobs/README.md)
377+
378+
* [list](docs/sdks/mistraljobs/README.md#list) - Get Batch Jobs
379+
* [create](docs/sdks/mistraljobs/README.md#create) - Create Batch Job
380+
* [get](docs/sdks/mistraljobs/README.md#get) - Get Batch Job
381+
* [cancel](docs/sdks/mistraljobs/README.md#cancel) - Cancel Batch Job
382+
325383
### [chat](docs/sdks/chat/README.md)
326384

327385
* [complete](docs/sdks/chat/README.md#complete) - Chat Completion
328386
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
329387

388+
### [classifiers](docs/sdks/classifiers/README.md)
389+
390+
* [moderate](docs/sdks/classifiers/README.md#moderate) - Moderations
391+
* [moderate_chat](docs/sdks/classifiers/README.md#moderate_chat) - Moderations Chat
392+
330393
### [embeddings](docs/sdks/embeddings/README.md)
331394

332395
* [create](docs/sdks/embeddings/README.md#create) - Embeddings
@@ -337,6 +400,7 @@ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/REA
337400
* [list](docs/sdks/files/README.md#list) - List Files
338401
* [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
339402
* [delete](docs/sdks/files/README.md#delete) - Delete File
403+
* [download](docs/sdks/files/README.md#download) - Download File
340404

341405
### [fim](docs/sdks/fim/README.md)
342406

@@ -479,12 +543,23 @@ if res is not None:
479543
<!-- Start Error Handling [errors] -->
480544
## Error Handling
481545

482-
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
546+
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
547+
548+
By default, an API error will raise a models.SDKError exception, which has the following properties:
549+
550+
| Property | Type | Description |
551+
|-----------------|------------------|-----------------------|
552+
| `.status_code` | *int* | The HTTP status code |
553+
| `.message` | *str* | The error message |
554+
| `.raw_response` | *httpx.Response* | The raw HTTP response |
555+
| `.body` | *str* | The response content |
556+
557+
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list_async` method may raise the following exceptions:
483558

484-
| Error Object | Status Code | Content Type |
485-
| -------------------------- | ----------- | ---------------- |
486-
| models.HTTPValidationError | 422 | application/json |
487-
| models.SDKError | 4xx-5xx | */* |
559+
| Error Type | Status Code | Content Type |
560+
| -------------------------- | -------------------------- | -------------------------- |
561+
| models.HTTPValidationError | 422 | application/json |
562+
| models.SDKError | 4XX, 5XX | \*/\* |
488563

489564
### Example
490565

@@ -520,9 +595,9 @@ except models.SDKError as e:
520595

521596
You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
522597

523-
| Name | Server | Variables |
524-
| ------ | ------------------------ | --------- |
525-
| `prod` | `https://api.mistral.ai` | None |
598+
| Name | Server | Variables |
599+
| ----- | ------ | --------- |
600+
| `eu` | `https://api.mistral.ai` | None |
526601

527602
#### Example
528603

@@ -531,7 +606,7 @@ from mistralai import Mistral
531606
import os
532607

533608
s = Mistral(
534-
server="prod",
609+
server="eu",
535610
api_key=os.getenv("MISTRAL_API_KEY", ""),
536611
)
537612

@@ -653,9 +728,9 @@ s = Mistral(async_client=CustomClient(httpx.AsyncClient()))
653728

654729
This SDK supports the following security scheme globally:
655730

656-
| Name | Type | Scheme | Environment Variable |
657-
| --------- | ---- | ----------- | -------------------- |
658-
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
731+
| Name | Type | Scheme | Environment Variable |
732+
| -------------------- | -------------------- | -------------------- | -------------------- |
733+
| `api_key` | http | HTTP Bearer | `MISTRAL_API_KEY` |
659734

660735
To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
661736
```python

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,14 @@ Based on:
4848
### Generated
4949
- [python v1.1.0] .
5050
### Releases
51-
- [PyPI v1.1.0] https://pypi.org/project/mistralai/1.1.0 - .
51+
- [PyPI v1.1.0] https://pypi.org/project/mistralai/1.1.0 - .
52+
53+
## 2024-11-07 19:52:56
54+
### Changes
55+
Based on:
56+
- OpenAPI Doc
57+
- Speakeasy CLI 1.434.3 (2.452.0) https://github.com/speakeasy-api/speakeasy
58+
### Generated
59+
- [python v1.2.0] .
60+
### Releases
61+
- [PyPI v1.2.0] https://pypi.org/project/mistralai/1.2.0 - .

0 commit comments

Comments
 (0)