Skip to content

Commit 72242df

Browse files
feat: update Speakeasy gen.yaml configuration (#370)
* chore: update gen.yaml with recommended v2 Speakeasy configs - Add input and dir to allowedRedefinedBuiltins - Add asyncPaginationSep2025 and conflictResistantModelImportsFeb2026 fixFlags - Set imports.paths.errors to "errors" - Increase maxMethodParams from 15 to 999 - Change multipartArrayFormat from legacy to standard * chore: sync pylintrc allowed-redefined-builtins with gen.yaml Add input and dir to match allowedRedefinedBuiltins in gen.yaml config. * chore: regenerate spec * fix: update code for renamed model classes - Filter UnknownAgentTool in agent update (context.py) - Update examples for renamed classes: - BatchRequest, UserMessage: import from models module - ClassifierTrainingParametersIn -> ClassifierTrainingParameters - ClassifierJobOut -> ClassifierFineTuningJob - Add type narrowing for ClassifierFineTuningJobDetails
1 parent 969c992 commit 72242df

File tree

658 files changed

+13796
-11219
lines changed

Some content is hidden

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

658 files changed

+13796
-11219
lines changed

.speakeasy/gen.lock

Lines changed: 1425 additions & 1454 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,49 @@ generation:
1313
requestResponseComponentNamesFeb2024: true
1414
securityFeb2025: true
1515
sharedErrorComponentsApr2025: true
16-
methodSignaturesApr2024: true
1716
sharedNestedComponentsJan2026: true
17+
nameOverrideFeb2026: true
18+
methodSignaturesApr2024: true
1819
auth:
1920
oAuth2ClientCredentialsEnabled: true
2021
oAuth2PasswordEnabled: false
2122
hoistGlobalSecurity: true
2223
schemas:
2324
allOfMergeStrategy: shallowMerge
2425
requestBodyFieldName: ""
26+
versioningStrategy: automatic
2527
persistentEdits:
2628
enabled: "true"
2729
tests:
2830
generateTests: true
2931
generateNewTests: false
3032
skipResponseBodyAssertions: false
3133
python:
32-
version: 2.0.0a3
34+
version: 2.0.0-a3.1
3335
additionalDependencies:
3436
dev:
3537
pytest: ^8.2.2
3638
pytest-asyncio: ^0.23.7
39+
main: {}
3740
allowedRedefinedBuiltins:
3841
- id
3942
- object
43+
- input
44+
- dir
4045
asyncMode: both
4146
authors:
4247
- Mistral
4348
baseErrorName: MistralError
4449
clientServerStatusCodesAsErrors: true
45-
constFieldCasing: upper
50+
constFieldCasing: normal
4651
defaultErrorName: SDKError
4752
description: Python Client SDK for the Mistral AI API.
4853
enableCustomCodeRegions: true
4954
enumFormat: union
5055
envVarPrefix: MISTRAL
5156
fixFlags:
57+
asyncPaginationSep2025: true
58+
conflictResistantModelImportsFeb2026: true
5259
responseRequiredSep2024: true
5360
flatAdditionalProperties: true
5461
flattenGlobalSecurity: true
@@ -60,17 +67,17 @@ python:
6067
option: openapi
6168
paths:
6269
callbacks: ""
63-
errors: ""
70+
errors: errors
6471
operations: ""
6572
shared: ""
6673
webhooks: ""
6774
inferUnionDiscriminators: true
6875
inputModelSuffix: input
6976
license: ""
70-
maxMethodParams: 15
77+
maxMethodParams: 999
7178
methodArguments: infer-optional-args
7279
moduleName: mistralai.client
73-
multipartArrayFormat: legacy
80+
multipartArrayFormat: standard
7481
outputModelSuffix: output
7582
packageManager: uv
7683
packageName: mistralai
@@ -80,3 +87,4 @@ python:
8087
responseFormat: flat
8188
sseFlatResponse: false
8289
templateVersion: v2
90+
useAsyncHooks: false

.speakeasy/workflow.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.685.0
1+
speakeasyVersion: 1.729.0
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-openapi-azure
@@ -14,8 +14,8 @@ sources:
1414
- latest
1515
mistral-openapi:
1616
sourceNamespace: mistral-openapi
17-
sourceRevisionDigest: sha256:74d0de7750f6a1878b68c9da683eba7a447d7c367131d0cb8f5c3b1e05829624
18-
sourceBlobDigest: sha256:41e8354c48993fc29be68959d835ea4f8e0cc1d4b4fbd527afcd970bc02c62a2
17+
sourceRevisionDigest: sha256:4f8e25101b35a66b9c93089fe3d491990268bdbefb70a349740e01ba9c8e28f8
18+
sourceBlobDigest: sha256:8566b35549178910c6fd4d005474d612bb9c476ef58785bb51c46251de145f71
1919
tags:
2020
- latest
2121
targets:
@@ -25,24 +25,24 @@ targets:
2525
sourceRevisionDigest: sha256:e32d21a6317d1bca6ab29f05603b96038e841752c2698aab47f434ea0d6530b7
2626
sourceBlobDigest: sha256:2dad2b1b7a79de6917c363ce7e870d11efe31ac08e3bfe0258f72823fe1ad13e
2727
codeSamplesNamespace: mistral-openapi-azure-code-samples
28-
codeSamplesRevisionDigest: sha256:a34c3049c604d0bb67101d042e959f14098964fe784f98975a9201c84dbf44d0
28+
codeSamplesRevisionDigest: sha256:248e5daaa44589805664ab1479502885758fde0f1da3b384b97b1a09d74c8256
2929
mistralai-gcp-sdk:
3030
source: mistral-google-cloud-source
3131
sourceNamespace: mistral-openapi-google-cloud
3232
sourceRevisionDigest: sha256:4d9938ab74c4d41d62cd24234c8b8109e286c4aeec093e21d369259a43173113
3333
sourceBlobDigest: sha256:5a558d5ea7a936723c7a5540db5a1fba63d85d25b453372e1cf16395b30c98d3
3434
codeSamplesNamespace: mistral-openapi-google-cloud-code-samples
35-
codeSamplesRevisionDigest: sha256:fa36e5999e79c32e8b2c1317cc0d6ed179912ced15194f02b5f80da22e45ae5f
35+
codeSamplesRevisionDigest: sha256:f6c4dc988e9b7be6f8d8087d14b2269be601bb9bff2227b07e1018efe88e1556
3636
mistralai-sdk:
3737
source: mistral-openapi
3838
sourceNamespace: mistral-openapi
39-
sourceRevisionDigest: sha256:74d0de7750f6a1878b68c9da683eba7a447d7c367131d0cb8f5c3b1e05829624
40-
sourceBlobDigest: sha256:41e8354c48993fc29be68959d835ea4f8e0cc1d4b4fbd527afcd970bc02c62a2
39+
sourceRevisionDigest: sha256:4f8e25101b35a66b9c93089fe3d491990268bdbefb70a349740e01ba9c8e28f8
40+
sourceBlobDigest: sha256:8566b35549178910c6fd4d005474d612bb9c476ef58785bb51c46251de145f71
4141
codeSamplesNamespace: mistral-openapi-code-samples
42-
codeSamplesRevisionDigest: sha256:99fcae1bc81801e3825648a44f5ffa62a8f124e3186e5570be40414de164e7f2
42+
codeSamplesRevisionDigest: sha256:f3cf9d6d99a27d6e753bd6e1a2f2c2fb290f412a455576de4bab610ab4825939
4343
workflow:
4444
workflowVersion: 1.0.0
45-
speakeasyVersion: 1.685.0
45+
speakeasyVersion: 1.729.0
4646
sources:
4747
mistral-azure-source:
4848
inputs:

.speakeasy/workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
workflowVersion: 1.0.0
2-
speakeasyVersion: 1.685.0
2+
speakeasyVersion: 1.729.0
33
sources:
44
mistral-azure-source:
55
inputs:

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
.PHONY: help test-generate update-speakeasy-version
1+
.PHONY: help generate test-generate update-speakeasy-version check-config
22

33
help:
44
@echo "Available targets:"
5+
@echo " make generate Generate all SDKs (main, Azure, GCP)"
56
@echo " make test-generate Test SDK generation locally"
67
@echo " make update-speakeasy-version VERSION=x.y.z Update Speakeasy CLI version"
8+
@echo " make check-config Check gen.yaml against recommended defaults"
79
@echo ""
810
@echo "Note: Production SDK generation is done via GitHub Actions:"
911
@echo " .github/workflows/sdk_generation_mistralai_sdk.yaml"
1012

13+
# Generate all SDKs (main, Azure, GCP)
14+
generate:
15+
speakeasy run -t all
16+
1117
# Test SDK generation locally.
1218
# For production, use GitHub Actions: .github/workflows/sdk_generation_mistralai_sdk.yaml
1319
# This uses the Speakeasy CLI version defined in .speakeasy/workflow.yaml
1420
test-generate:
1521
speakeasy run --skip-versioning
1622

23+
# Check gen.yaml configuration against Speakeasy recommended defaults
24+
check-config:
25+
speakeasy configure generation check
26+
1727
# Update the Speakeasy CLI version (the code generator tool).
1828
# This modifies speakeasyVersion in .speakeasy/workflow.yaml and regenerates the SDK.
1929
# Usage: make update-speakeasy-version VERSION=1.685.0

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ $ source ~/.zshenv
2727
<!-- Start Summary [summary] -->
2828
## Summary
2929

30-
Mistral AI API: Dora OpenAPI schema
31-
32-
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.
30+
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.
3331
<!-- End Summary [summary] -->
3432

3533
<!-- Start Table of Contents [toc] -->
@@ -161,8 +159,8 @@ with Mistral(
161159

162160
res = mistral.chat.complete(model="mistral-large-latest", messages=[
163161
{
164-
"content": "Who is the best French painter? Answer in one short sentence.",
165162
"role": "user",
163+
"content": "Who is the best French painter? Answer in one short sentence.",
166164
},
167165
], stream=False, response_format={
168166
"type": "text",
@@ -190,8 +188,8 @@ async def main():
190188

191189
res = await mistral.chat.complete_async(model="mistral-large-latest", messages=[
192190
{
193-
"content": "Who is the best French painter? Answer in one short sentence.",
194191
"role": "user",
192+
"content": "Who is the best French painter? Answer in one short sentence.",
195193
},
196194
], stream=False, response_format={
197195
"type": "text",
@@ -269,8 +267,8 @@ with Mistral(
269267

270268
res = mistral.agents.complete(messages=[
271269
{
272-
"content": "Who is the best French painter? Answer in one short sentence.",
273270
"role": "user",
271+
"content": "Who is the best French painter? Answer in one short sentence.",
274272
},
275273
], agent_id="<id>", stream=False, response_format={
276274
"type": "text",
@@ -298,8 +296,8 @@ async def main():
298296

299297
res = await mistral.agents.complete_async(messages=[
300298
{
301-
"content": "Who is the best French painter? Answer in one short sentence.",
302299
"role": "user",
300+
"content": "Who is the best French painter? Answer in one short sentence.",
303301
},
304302
], agent_id="<id>", stream=False, response_format={
305303
"type": "text",
@@ -616,7 +614,14 @@ with Mistral(
616614
api_key=os.getenv("MISTRAL_API_KEY", ""),
617615
) as mistral:
618616

619-
res = mistral.beta.conversations.start_stream(inputs="<value>", stream=True, completion_args={
617+
res = mistral.beta.conversations.start_stream(inputs=[
618+
{
619+
"object": "entry",
620+
"type": "function.result",
621+
"tool_call_id": "<id>",
622+
"result": "<value>",
623+
},
624+
], stream=True, completion_args={
620625
"response_format": {
621626
"type": "text",
622627
},
@@ -653,7 +658,7 @@ with Mistral(
653658
api_key=os.getenv("MISTRAL_API_KEY", ""),
654659
) as mistral:
655660

656-
res = mistral.beta.libraries.documents.upload(library_id="f973c54e-979a-4464-9d36-8cc31beb21fe", file={
661+
res = mistral.beta.libraries.documents.upload(library_id="a02150d9-5ee0-4877-b62c-28b1fcdf3b76", file={
657662
"file_name": "example.file",
658663
"content": open("example.file", "rb"),
659664
})
@@ -680,8 +685,8 @@ with Mistral(
680685
api_key=os.getenv("MISTRAL_API_KEY", ""),
681686
) as mistral:
682687

683-
res = mistral.models.list(
684-
retries=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
688+
res = mistral.models.list(,
689+
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
685690

686691
# Handle response
687692
print(res)
@@ -711,7 +716,7 @@ with Mistral(
711716
<!-- Start Error Handling [errors] -->
712717
## Error Handling
713718

714-
[`MistralError`](./src/mistralai/client/models/mistralerror.py) is the base class for all HTTP error responses. It has the following properties:
719+
[`MistralError`](./src/mistralai/client/errors/mistralerror.py) is the base class for all HTTP error responses. It has the following properties:
715720

716721
| Property | Type | Description |
717722
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
@@ -724,8 +729,7 @@ with Mistral(
724729

725730
### Example
726731
```python
727-
import mistralai.client
728-
from mistralai.client import Mistral, models
732+
from mistralai.client import Mistral, errors
729733
import os
730734

731735

@@ -741,7 +745,7 @@ with Mistral(
741745
print(res)
742746

743747

744-
except models.MistralError as e:
748+
except errors.MistralError as e:
745749
# The base class for HTTP error responses
746750
print(e.message)
747751
print(e.status_code)
@@ -750,13 +754,13 @@ with Mistral(
750754
print(e.raw_response)
751755

752756
# Depending on the method different errors may be thrown
753-
if isinstance(e, models.HTTPValidationError):
754-
print(e.data.detail) # Optional[List[mistralai.client.ValidationError]]
757+
if isinstance(e, errors.HTTPValidationError):
758+
print(e.data.detail) # Optional[List[models.ValidationError]]
755759
```
756760

757761
### Error Classes
758762
**Primary error:**
759-
* [`MistralError`](./src/mistralai/client/models/mistralerror.py): The base class for HTTP error responses.
763+
* [`MistralError`](./src/mistralai/client/errors/mistralerror.py): The base class for HTTP error responses.
760764

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

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

770774

771-
**Inherit from [`MistralError`](./src/mistralai/client/models/mistralerror.py)**:
772-
* [`HTTPValidationError`](./src/mistralai/client/models/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 53 of 75 methods.*
773-
* [`ResponseValidationError`](./src/mistralai/client/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.
775+
**Inherit from [`MistralError`](./src/mistralai/client/errors/mistralerror.py)**:
776+
* [`HTTPValidationError`](./src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 53 of 75 methods.*
777+
* [`ResponseValidationError`](./src/mistralai/client/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
774778

775779
</details>
776780

USAGE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ with Mistral(
1515

1616
res = mistral.chat.complete(model="mistral-large-latest", messages=[
1717
{
18-
"content": "Who is the best French painter? Answer in one short sentence.",
1918
"role": "user",
19+
"content": "Who is the best French painter? Answer in one short sentence.",
2020
},
2121
], stream=False, response_format={
2222
"type": "text",
@@ -44,8 +44,8 @@ async def main():
4444

4545
res = await mistral.chat.complete_async(model="mistral-large-latest", messages=[
4646
{
47-
"content": "Who is the best French painter? Answer in one short sentence.",
4847
"role": "user",
48+
"content": "Who is the best French painter? Answer in one short sentence.",
4949
},
5050
], stream=False, response_format={
5151
"type": "text",
@@ -123,8 +123,8 @@ with Mistral(
123123

124124
res = mistral.agents.complete(messages=[
125125
{
126-
"content": "Who is the best French painter? Answer in one short sentence.",
127126
"role": "user",
127+
"content": "Who is the best French painter? Answer in one short sentence.",
128128
},
129129
], agent_id="<id>", stream=False, response_format={
130130
"type": "text",
@@ -152,8 +152,8 @@ async def main():
152152

153153
res = await mistral.agents.complete_async(messages=[
154154
{
155-
"content": "Who is the best French painter? Answer in one short sentence.",
156155
"role": "user",
156+
"content": "Who is the best French painter? Answer in one short sentence.",
157157
},
158158
], agent_id="<id>", stream=False, response_format={
159159
"type": "text",
File renamed without changes.

docs/models/agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
1414
| `handoffs` | List[*str*] | :heavy_minus_sign: | N/A |
1515
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | N/A |
16-
| `object` | [Optional[models.AgentObject]](../models/agentobject.md) | :heavy_minus_sign: | N/A |
16+
| `object` | *Optional[Literal["agent"]]* | :heavy_minus_sign: | N/A |
1717
| `id` | *str* | :heavy_check_mark: | N/A |
1818
| `version` | *int* | :heavy_check_mark: | N/A |
1919
| `versions` | List[*int*] | :heavy_check_mark: | N/A |

docs/models/agentconversation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name given to the conversation. |
99
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the what the conversation is about. |
1010
| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Custom metadata for the conversation. |
11-
| `object` | [Optional[models.AgentConversationObject]](../models/agentconversationobject.md) | :heavy_minus_sign: | N/A |
11+
| `object` | *Optional[Literal["conversation"]]* | :heavy_minus_sign: | N/A |
1212
| `id` | *str* | :heavy_check_mark: | N/A |
1313
| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A |
1414
| `updated_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A |

0 commit comments

Comments
 (0)