Skip to content

Commit bcc7748

Browse files
github-actions[bot]speakeasybotamenasria
authored
chore: 🐝 Update SDK - Generate MISTRALAI MISTRALAI-SDK 1.5.0 (#184)
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.476.2 * [Feature] Structured Outputs * Add --no-root to CI's poetry install * Different CI fix * Fix CI * Rename schema_ to schema_definition * Set version to 1.5.0 --------- Co-authored-by: speakeasybot <[email protected]> Co-authored-by: Alexandre Menasria <[email protected]>
1 parent 77c7220 commit bcc7748

36 files changed

+901
-38
lines changed

.genignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pyproject.toml
2-
examples/*
2+
examples/*
3+
src/mistral/extra/*
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Linting Python custom files
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.12'
23+
24+
- name: Install ruff
25+
run: pip install ruff
26+
27+
- name: Lint with ruff
28+
# No need to lint the automatically generated Speakeasy code
29+
run: |
30+
ruff check examples/
31+
ruff check src/mistralai/_hooks/ --exclude __init__.py --exclude sdkhooks.py --exclude types.py
32+
ruff check src/mistralai/extra/
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Testing Python custom files
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
id: setup-python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Install Poetry
26+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
27+
with:
28+
virtualenvs-create: true
29+
virtualenvs-in-project: true
30+
virtualenvs-path: .venv
31+
installer-parallel: true
32+
33+
- name: Load cached venv
34+
id: cached-poetry-dependencies
35+
uses: actions/cache@v4
36+
with:
37+
path: .venv
38+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
39+
40+
- name: Install dependencies
41+
# Install dependencies if cache does not exist
42+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
43+
run: poetry install --no-interaction --no-root
44+
45+
- name: Run the 'src/mistralai/extra' package unit tests
46+
run: |
47+
source .venv/bin/activate
48+
python3.12 -m unittest discover -s src/mistralai/extra/tests -t src

.speakeasy/gen.lock

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
lockVersion: 2.0.0
22
id: 2d045ec7-2ebb-4f4d-ad25-40953b132161
33
management:
4-
docChecksum: dbfa566129ede53f4e3b2c91e81f6f74
4+
docChecksum: 553c31591e8dc33a58cb75f348c3aa72
55
docVersion: 0.0.2
6-
speakeasyVersion: 1.469.11
7-
generationVersion: 2.493.32
8-
releaseVersion: 1.4.0
9-
configChecksum: 46cde4e28fb5efba97051b54ac2e1c83
6+
speakeasyVersion: 1.477.0
7+
generationVersion: 2.497.0
8+
releaseVersion: 1.5.0
9+
configChecksum: 9a5649c5c372dc5fd2fde38a0faee40e
1010
repoURL: https://github.com/mistralai/client-python.git
1111
installationURL: https://github.com/mistralai/client-python.git
1212
published: true
1313
features:
1414
python:
1515
additionalDependencies: 1.0.0
1616
constsAndDefaults: 1.0.5
17-
core: 5.10.4
17+
core: 5.10.5
18+
customCodeRegions: 0.1.1
1819
defaultEnabledRetries: 0.2.0
1920
downloadStreams: 1.0.1
2021
enumUnions: 0.1.0
@@ -155,6 +156,7 @@ generatedFiles:
155156
- docs/models/jobsapiroutesfinetuningupdatefinetunedmodelrequest.md
156157
- docs/models/jobsout.md
157158
- docs/models/jobsoutobject.md
159+
- docs/models/jsonschema.md
158160
- docs/models/legacyjobmetadataout.md
159161
- docs/models/legacyjobmetadataoutobject.md
160162
- docs/models/listfilesout.md
@@ -319,6 +321,7 @@ generatedFiles:
319321
- src/mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py
320322
- src/mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py
321323
- src/mistralai/models/jobsout.py
324+
- src/mistralai/models/jsonschema.py
322325
- src/mistralai/models/legacyjobmetadataout.py
323326
- src/mistralai/models/listfilesout.py
324327
- src/mistralai/models/metricout.py
@@ -566,6 +569,7 @@ examples:
566569
responses:
567570
"422":
568571
application/json: {}
572+
"200": {}
569573
fim_completion_v1_fim_completions_post:
570574
speakeasy-default-fim-completion-v1-fim-completions-post:
571575
requestBody:
@@ -582,6 +586,7 @@ examples:
582586
responses:
583587
"422":
584588
application/json: {}
589+
"200": {}
585590
agents_completion_v1_agents_completions_post:
586591
speakeasy-default-agents-completion-v1-agents-completions-post:
587592
requestBody:
@@ -598,6 +603,7 @@ examples:
598603
responses:
599604
"422":
600605
application/json: {}
606+
"200": {}
601607
embeddings_v1_embeddings_post:
602608
speakeasy-default-embeddings-v1-embeddings-post:
603609
requestBody:

.speakeasy/gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ generation:
1313
oAuth2ClientCredentialsEnabled: true
1414
oAuth2PasswordEnabled: false
1515
python:
16-
version: 1.4.0
16+
version: 1.5.0
1717
additionalDependencies:
1818
dev:
1919
pytest: ^8.2.2
@@ -23,7 +23,7 @@ python:
2323
clientServerStatusCodesAsErrors: true
2424
defaultErrorName: SDKError
2525
description: Python Client SDK for the Mistral AI API.
26-
enableCustomCodeRegions: false
26+
enableCustomCodeRegions: true
2727
enumFormat: union
2828
envVarPrefix: MISTRAL
2929
fixFlags:

.speakeasy/workflow.lock

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.469.11
1+
speakeasyVersion: 1.477.0
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-azure-source
@@ -14,11 +14,10 @@ sources:
1414
- latest
1515
mistral-openapi:
1616
sourceNamespace: mistral-openapi
17-
sourceRevisionDigest: sha256:c414dd5eecca5f02fe9012a1d131f696e0257fe100c371609272dbc6c522ef07
18-
sourceBlobDigest: sha256:f48af039106d00de84345fd095fbf4831f18fbeeef07e9ff7bba70a0e07eda07
17+
sourceRevisionDigest: sha256:af4a2854e017abc0ec9e4b557186611dcd69468d82d5ac7f81bfbe49165fc18d
18+
sourceBlobDigest: sha256:9f1bbc418fba3c7b5031bacdf9d431aff476fb4b2aa3838ed50fb3922563703c
1919
tags:
2020
- latest
21-
- speakeasy-sdk-regen-1737393201
2221
targets:
2322
mistralai-azure-sdk:
2423
source: mistral-azure-source
@@ -37,10 +36,10 @@ targets:
3736
mistralai-sdk:
3837
source: mistral-openapi
3938
sourceNamespace: mistral-openapi
40-
sourceRevisionDigest: sha256:c414dd5eecca5f02fe9012a1d131f696e0257fe100c371609272dbc6c522ef07
41-
sourceBlobDigest: sha256:f48af039106d00de84345fd095fbf4831f18fbeeef07e9ff7bba70a0e07eda07
39+
sourceRevisionDigest: sha256:af4a2854e017abc0ec9e4b557186611dcd69468d82d5ac7f81bfbe49165fc18d
40+
sourceBlobDigest: sha256:9f1bbc418fba3c7b5031bacdf9d431aff476fb4b2aa3838ed50fb3922563703c
4241
codeSamplesNamespace: mistral-openapi-code-samples
43-
codeSamplesRevisionDigest: sha256:3f61d33c46733b24ecd422423900425b381529da038992e59bdb5a9b766bdf89
42+
codeSamplesRevisionDigest: sha256:cbf9b277d16c47816fc5d63b4c69cf0fbd1fe99d424c34ab465d2b61fcc6e5e8
4443
workflow:
4544
workflowVersion: 1.0.0
4645
speakeasyVersion: latest

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
4242
* [Server Selection](#server-selection)
4343
* [Custom HTTP Client](#custom-http-client)
4444
* [Authentication](#authentication)
45+
* [Resource Management](#resource-management)
4546
* [Debugging](#debugging)
4647
* [IDE Support](#ide-support)
4748
* [Development](#development)
@@ -52,6 +53,11 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
5253
<!-- Start SDK Installation [installation] -->
5354
## SDK Installation
5455

56+
> [!NOTE]
57+
> **Python version upgrade policy**
58+
>
59+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
60+
5561
The SDK can be installed with either *pip* or *poetry* package managers.
5662

5763
### PIP
@@ -754,6 +760,32 @@ with Mistral(
754760
```
755761
<!-- End Authentication [security] -->
756762

763+
<!-- Start Resource Management [resource-management] -->
764+
## Resource Management
765+
766+
The `Mistral` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
767+
768+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
769+
770+
```python
771+
from mistralai import Mistral
772+
import os
773+
def main():
774+
with Mistral(
775+
api_key=os.getenv("MISTRAL_API_KEY", ""),
776+
) as mistral:
777+
# Rest of application here...
778+
779+
780+
# Or when using async:
781+
async def amain():
782+
async with Mistral(
783+
api_key=os.getenv("MISTRAL_API_KEY", ""),
784+
) as mistral:
785+
# Rest of application here...
786+
```
787+
<!-- End Resource Management [resource-management] -->
788+
757789
<!-- Start Debugging [debug] -->
758790
## Debugging
759791

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,14 @@ Based on:
148148
### Generated
149149
- [python v1.4.0] .
150150
### Releases
151-
- [PyPI v1.4.0] https://pypi.org/project/mistralai/1.4.0 - .
151+
- [PyPI v1.4.0] https://pypi.org/project/mistralai/1.4.0 - .
152+
153+
## 2025-01-27 13:57:39
154+
### Changes
155+
Based on:
156+
- OpenAPI Doc
157+
- Speakeasy CLI 1.476.2 (2.495.1) https://github.com/speakeasy-api/speakeasy
158+
### Generated
159+
- [python v1.5.0] .
160+
### Releases
161+
- [PyPI v1.5.0] https://pypi.org/project/mistralai/1.5.0 - .

docs/models/jsonschema.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# JSONSchema
2+
3+
4+
## Fields
5+
6+
| Field | Type | Required | Description |
7+
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
8+
| `name` | *str* | :heavy_check_mark: | N/A |
9+
| `schema_definition` | Dict[str, *Any*] | :heavy_check_mark: | N/A |
10+
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
11+
| `strict` | *Optional[bool]* | :heavy_minus_sign: | N/A |

0 commit comments

Comments
 (0)