-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <bot@speakeasyapi.dev> Co-authored-by: Alexandre Menasria <alexandre.menasria@mistral.ai>
- Loading branch information
1 parent
77c7220
commit bcc7748
Showing
36 changed files
with
901 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pyproject.toml | ||
examples/* | ||
examples/* | ||
src/mistral/extra/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Linting Python custom files | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install ruff | ||
run: pip install ruff | ||
|
||
- name: Lint with ruff | ||
# No need to lint the automatically generated Speakeasy code | ||
run: | | ||
ruff check examples/ | ||
ruff check src/mistralai/_hooks/ --exclude __init__.py --exclude sdkhooks.py --exclude types.py | ||
ruff check src/mistralai/extra/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Testing Python custom files | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
id: setup-python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
virtualenvs-path: .venv | ||
installer-parallel: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
# Install dependencies if cache does not exist | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Run the 'src/mistralai/extra' package unit tests | ||
run: | | ||
source .venv/bin/activate | ||
python3.12 -m unittest discover -s src/mistralai/extra/tests -t src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# JSONSchema | ||
|
||
|
||
## Fields | ||
|
||
| Field | Type | Required | Description | | ||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- | | ||
| `name` | *str* | :heavy_check_mark: | N/A | | ||
| `schema_definition` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | ||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | ||
| `strict` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
import asyncio | ||
import os | ||
from pydantic import BaseModel | ||
|
||
from mistralai import Mistral | ||
|
||
async def main(): | ||
|
||
api_key = os.environ["MISTRAL_API_KEY"] | ||
client = Mistral(api_key=api_key) | ||
|
||
class Explanation(BaseModel): | ||
explanation: str | ||
output: str | ||
|
||
class MathDemonstration(BaseModel): | ||
steps: list[Explanation] | ||
final_answer: str | ||
|
||
chat_response = await client.chat.parse_async( | ||
model="mistral-large-2411", | ||
messages=[ | ||
{"role": "system", "content": "You are a helpful math tutor. You will be provided with a math problem, and your goal will be to output a step by step solution, along with a final answer. For each step, just provide the output as an equation use the explanation field to detail the reasoning."}, | ||
{"role": "user", "content": "How can I solve 8x + 7 = -23"}, | ||
], | ||
response_format = MathDemonstration | ||
) | ||
print(chat_response.choices[0].message.parsed) | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.