Skip to content
Open
  •  
  •  
  •  
2,341 changes: 1,167 additions & 1,174 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ generation:
requestResponseComponentNamesFeb2024: true
securityFeb2025: false
sharedErrorComponentsApr2025: false
sharedNestedComponentsJan2026: false
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
Expand All @@ -26,7 +27,7 @@ generation:
generateNewTests: false
skipResponseBodyAssertions: false
python:
version: 1.11.0
version: 2.0.0
additionalDependencies:
dev:
pytest: ^8.2.2
Expand Down Expand Up @@ -63,7 +64,7 @@ python:
license: ""
maxMethodParams: 15
methodArguments: infer-optional-args
moduleName: ""
moduleName: mistralai.sdk
multipartArrayFormat: legacy
outputModelSuffix: output
packageManager: uv
Expand All @@ -74,3 +75,4 @@ python:
responseFormat: flat
sseFlatResponse: false
templateVersion: v2
useAsyncHooks: false
4 changes: 1 addition & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.685.0
speakeasyVersion: 1.690.0
sources:
mistral-azure-source:
sourceNamespace: mistral-openapi-azure
Expand Down Expand Up @@ -38,8 +38,6 @@ targets:
sourceNamespace: mistral-openapi
sourceRevisionDigest: sha256:ebe60088ce4a3780c57a08de7bc73f973f529822a05db12c5d9c6084e9a934e0
sourceBlobDigest: sha256:c93947af3495a5129cb6aecfe0546463917fbe1f66f2cf8f5a0accb36c035501
codeSamplesNamespace: mistral-openapi-code-samples
codeSamplesRevisionDigest: sha256:14b511ab3d9f6f3d9ee0c81c32c6fa2dd6be9b6a1047298cf9f1162328045b4f
workflow:
workflowVersion: 1.0.0
speakeasyVersion: 1.685.0
Expand Down
64 changes: 32 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ It's also possible to write a standalone Python script without needing to set up
# ]
# ///

from mistralai import Mistral
from mistralai.sdk import Mistral

sdk = Mistral(
# SDK arguments
Expand Down Expand Up @@ -136,7 +136,7 @@ This example shows how to create chat completions.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand Down Expand Up @@ -164,7 +164,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down Expand Up @@ -194,7 +194,7 @@ This example shows how to upload a file.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -218,7 +218,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand All @@ -244,7 +244,7 @@ This example shows how to create agents completions.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand Down Expand Up @@ -272,7 +272,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down Expand Up @@ -302,7 +302,7 @@ This example shows how to create embedding request.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -326,7 +326,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down Expand Up @@ -582,7 +582,7 @@ The stream is also a [Context Manager][context-manager] and can be used with the
underlying connection when the context is exited.

```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand Down Expand Up @@ -626,7 +626,7 @@ Certain SDK methods accept file objects as part of a request body or multi-part
>

```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -652,8 +652,8 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an

To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
```python
from mistralai import Mistral
from mistralai.utils import BackoffStrategy, RetryConfig
from mistralai.sdk import Mistral
from mistralai.sdk.utils import BackoffStrategy, RetryConfig
import os


Expand All @@ -671,8 +671,8 @@ with Mistral(

If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
```python
from mistralai import Mistral
from mistralai.utils import BackoffStrategy, RetryConfig
from mistralai.sdk import Mistral
from mistralai.sdk.utils import BackoffStrategy, RetryConfig
import os


Expand All @@ -692,7 +692,7 @@ with Mistral(
<!-- Start Error Handling [errors] -->
## Error Handling

[`MistralError`](./src/mistralai/models/mistralerror.py) is the base class for all HTTP error responses. It has the following properties:
[`MistralError`](./src/mistralai/sdk/models/mistralerror.py) is the base class for all HTTP error responses. It has the following properties:

| Property | Type | Description |
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
Expand All @@ -705,8 +705,8 @@ with Mistral(

### Example
```python
import mistralai
from mistralai import Mistral, models
import mistralai.sdk
from mistralai.sdk import Mistral, models
import os


Expand All @@ -732,12 +732,12 @@ with Mistral(

# Depending on the method different errors may be thrown
if isinstance(e, models.HTTPValidationError):
print(e.data.detail) # Optional[List[mistralai.ValidationError]]
print(e.data.detail) # Optional[List[mistralai.sdk.ValidationError]]
```

### Error Classes
**Primary error:**
* [`MistralError`](./src/mistralai/models/mistralerror.py): The base class for HTTP error responses.
* [`MistralError`](./src/mistralai/sdk/models/mistralerror.py): The base class for HTTP error responses.

<details><summary>Less common errors (6)</summary>

Expand All @@ -749,9 +749,9 @@ with Mistral(
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.


**Inherit from [`MistralError`](./src/mistralai/models/mistralerror.py)**:
* [`HTTPValidationError`](./src/mistralai/models/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 48 of 70 methods.*
* [`ResponseValidationError`](./src/mistralai/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
**Inherit from [`MistralError`](./src/mistralai/sdk/models/mistralerror.py)**:
* [`HTTPValidationError`](./src/mistralai/sdk/models/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 48 of 70 methods.*
* [`ResponseValidationError`](./src/mistralai/sdk/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.

</details>

Expand All @@ -772,7 +772,7 @@ You can override the default server globally by passing a server name to the `se
#### Example

```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -792,7 +792,7 @@ with Mistral(

The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -818,7 +818,7 @@ This allows you to wrap the client with your own custom logic, such as adding cu

For example, you could specify a header for every request that this sdk makes as follows:
```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import httpx

http_client = httpx.Client(headers={"x-custom-header": "someValue"})
Expand All @@ -827,8 +827,8 @@ s = Mistral(client=http_client)

or you could wrap the client with your own custom logic:
```python
from mistralai import Mistral
from mistralai.httpclient import AsyncHttpClient
from mistralai.sdk import Mistral
from mistralai.sdk.httpclient import AsyncHttpClient
import httpx

class CustomClient(AsyncHttpClient):
Expand Down Expand Up @@ -903,7 +903,7 @@ This SDK supports the following security scheme globally:

To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -927,7 +927,7 @@ The `Mistral` class implements the context manager protocol and registers a fina
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers

```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import os
def main():

Expand All @@ -954,11 +954,11 @@ You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass your own logger class directly into your SDK.
```python
from mistralai import Mistral
from mistralai.sdk import Mistral
import logging

logging.basicConfig(level=logging.DEBUG)
s = Mistral(debug_logger=logging.getLogger("mistralai"))
s = Mistral(debug_logger=logging.getLogger("mistralai.sdk"))
```

You can also enable a default debug logger by setting an environment variable `MISTRAL_DEBUG` to true.
Expand Down
16 changes: 8 additions & 8 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This example shows how to create chat completions.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand Down Expand Up @@ -33,7 +33,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down Expand Up @@ -63,7 +63,7 @@ This example shows how to upload a file.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -87,7 +87,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand All @@ -113,7 +113,7 @@ This example shows how to create agents completions.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand Down Expand Up @@ -141,7 +141,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down Expand Up @@ -171,7 +171,7 @@ This example shows how to create embedding request.

```python
# Synchronous Example
from mistralai import Mistral
from mistralai.sdk import Mistral
import os


Expand All @@ -195,7 +195,7 @@ The same SDK client can also be used to make asynchronous requests by importing
```python
# Asynchronous Example
import asyncio
from mistralai import Mistral
from mistralai.sdk import Mistral
import os

async def main():
Expand Down
4 changes: 2 additions & 2 deletions docs/models/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Chat to classify

## Supported Types

### `models.InstructRequestInputs`
### `models.InstructRequest`

```python
value: models.InstructRequestInputs = /* values here */
value: models.InstructRequest = /* values here */
```

### `List[models.InstructRequest]`
Expand Down
8 changes: 0 additions & 8 deletions docs/models/instructrequestinputs.md

This file was deleted.

Loading