Skip to content

Commit 8ad393a

Browse files
authored
chore: 🐝 Update SDK - Generate MISTRALAI-SDK 1.10.0 #134
2 parents 02dfca7 + 1b922cb commit 8ad393a

File tree

347 files changed

+4639
-4732
lines changed

Some content is hidden

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

347 files changed

+4639
-4732
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/examples/node_modules
2+
.DS_Store
3+
**/.speakeasy/temp/
4+
**/.speakeasy/logs/
5+
.DS_Store
6+
.env.*.local
17
/mcp-server
28
/bin
39
/.eslintcache

.speakeasy/gen.lock

Lines changed: 313 additions & 324 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,34 @@ generation:
77
maintainOpenAPIOrder: true
88
usageSnippets:
99
optionalPropertyRendering: withExample
10+
sdkInitStyle: constructor
1011
useClassNamesForArrayFields: true
1112
fixes:
1213
nameResolutionDec2023: true
1314
nameResolutionFeb2025: false
1415
parameterOrderingFeb2024: true
1516
requestResponseComponentNamesFeb2024: true
1617
securityFeb2025: false
18+
sharedErrorComponentsApr2025: false
1719
auth:
1820
oAuth2ClientCredentialsEnabled: true
1921
oAuth2PasswordEnabled: false
22+
tests:
23+
generateTests: true
24+
generateNewTests: false
25+
skipResponseBodyAssertions: false
2026
typescript:
21-
version: 1.9.19
27+
version: 1.10.0
2228
additionalDependencies:
2329
dependencies:
2430
zod-to-json-schema: ^3.24.1
2531
devDependencies: {}
2632
peerDependencies: {}
2733
additionalPackageJSON: {}
2834
author: Speakeasy
35+
baseErrorName: MistralError
2936
clientServerStatusCodesAsErrors: true
37+
constFieldsAlwaysOptional: true
3038
defaultErrorName: SDKError
3139
enableCustomCodeRegions: true
3240
enableMCPServer: false
@@ -53,4 +61,5 @@ typescript:
5361
packageName: '@mistralai/mistralai'
5462
responseFormat: flat
5563
templateVersion: v2
64+
usageSDKInitImports: []
5665
useIndexModules: true

.speakeasy/workflow.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.517.3
1+
speakeasyVersion: 1.606.10
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-openapi-azure
@@ -20,7 +20,7 @@ sources:
2020
sourceBlobDigest: sha256:97767522559603de92a9738938e522cea4d558b2a854500acf6fe8d81f8ccfb8
2121
tags:
2222
- latest
23-
- speakeasy-sdk-regen-1756795665
23+
- speakeasy-sdk-regen-1756820432
2424
targets:
2525
mistralai-azure-sdk:
2626
source: mistral-azure-source
@@ -42,10 +42,10 @@ targets:
4242
sourceRevisionDigest: sha256:eefc1f0b6a5e9ec673d317d61cad766290710b5fc369412491b75f732cccfedd
4343
sourceBlobDigest: sha256:97767522559603de92a9738938e522cea4d558b2a854500acf6fe8d81f8ccfb8
4444
codeSamplesNamespace: mistral-openapi-code-samples
45-
codeSamplesRevisionDigest: sha256:34e2099c693e2889e7a954dd68353d33403f7b2bdb0eb39e2c69f3c8c1e58b70
45+
codeSamplesRevisionDigest: sha256:2fee7233bdb7d0e0abb8ee3d4f91687a225f5085d54ab422bf8b41cea45d5907
4646
workflow:
4747
workflowVersion: 1.0.0
48-
speakeasyVersion: 1.517.3
48+
speakeasyVersion: v1.606.10
4949
sources:
5050
mistral-azure-source:
5151
inputs:

FUNCTIONS.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ specific category of applications.
2121
```typescript
2222
import { MistralCore } from "@mistralai/mistralai/core.js";
2323
import { filesUpload } from "@mistralai/mistralai/funcs/filesUpload.js";
24-
import { SDKValidationError } from "@mistralai/mistralai/models/errors/sdkvalidationerror.js";
2524
import { openAsBlob } from "node:fs";
2625

2726
// Use `MistralCore` for best tree-shaking performance.
@@ -34,28 +33,12 @@ async function run() {
3433
const res = await filesUpload(mistral, {
3534
file: await openAsBlob("example.file"),
3635
});
37-
38-
switch (true) {
39-
case res.ok:
40-
// The success case will be handled outside of the switch block
41-
break;
42-
case res.error instanceof SDKValidationError:
43-
// Pretty-print validation errors.
44-
return console.log(res.error.pretty());
45-
case res.error instanceof Error:
46-
return console.log(res.error);
47-
default:
48-
// TypeScript's type checking will fail on the following line if the above
49-
// cases were not exhaustive.
50-
res.error satisfies never;
51-
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
36+
if (res.ok) {
37+
const { value: result } = res;
38+
console.log(result);
39+
} else {
40+
console.log("filesUpload failed:", res.error);
5241
}
53-
54-
55-
const { value: result } = res;
56-
57-
// Handle the result
58-
console.log(result);
5942
}
6043

6144
run();

README.md

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ async function run() {
111111
],
112112
});
113113

114-
// Handle the result
115114
console.log(result);
116115
}
117116

@@ -136,7 +135,6 @@ async function run() {
136135
file: await openAsBlob("example.file"),
137136
});
138137

139-
// Handle the result
140138
console.log(result);
141139
}
142140

@@ -167,7 +165,6 @@ async function run() {
167165
agentId: "<id>",
168166
});
169167

170-
// Handle the result
171168
console.log(result);
172169
}
173170

@@ -195,7 +192,6 @@ async function run() {
195192
],
196193
});
197194

198-
// Handle the result
199195
console.log(result);
200196
}
201197

@@ -367,7 +363,16 @@ const mistral = new Mistral({
367363

368364
async function run() {
369365
const result = await mistral.beta.conversations.startStream({
370-
inputs: "<value>",
366+
inputs: [
367+
{
368+
object: "entry",
369+
type: "agent.handoff",
370+
previousAgentId: "<id>",
371+
previousAgentName: "<value>",
372+
nextAgentId: "<id>",
373+
nextAgentName: "<value>",
374+
},
375+
],
371376
});
372377

373378
for await (const event of result) {
@@ -408,13 +413,12 @@ const mistral = new Mistral({
408413

409414
async function run() {
410415
const result = await mistral.beta.libraries.documents.upload({
411-
libraryId: "6886a454-7910-4a2b-b98a-ab61ec65fc41",
416+
libraryId: "a02150d9-5ee0-4877-b62c-28b1fcdf3b76",
412417
requestBody: {
413418
file: await openAsBlob("example.file"),
414419
},
415420
});
416421

417-
// Handle the result
418422
console.log(result);
419423
}
420424

@@ -450,7 +454,6 @@ async function run() {
450454
},
451455
});
452456

453-
// Handle the result
454457
console.log(result);
455458
}
456459

@@ -479,7 +482,6 @@ const mistral = new Mistral({
479482
async function run() {
480483
const result = await mistral.models.list();
481484

482-
// Handle the result
483485
console.log(result);
484486
}
485487

@@ -491,51 +493,42 @@ run();
491493
<!-- Start Error Handling [errors] -->
492494
## Error Handling
493495

494-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `list` method may throw the following errors:
496+
[`MistralError`](./src/models/errors/mistralerror.ts) is the base class for all HTTP error responses. It has the following properties:
495497

496-
| Error Type | Status Code | Content Type |
497-
| -------------------------- | ----------- | ---------------- |
498-
| errors.HTTPValidationError | 422 | application/json |
499-
| errors.SDKError | 4XX, 5XX | \*/\* |
500-
501-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `SDKError`.
498+
| Property | Type | Description |
499+
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
500+
| `error.message` | `string` | Error message |
501+
| `error.statusCode` | `number` | HTTP response status code eg `404` |
502+
| `error.headers` | `Headers` | HTTP response headers |
503+
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
504+
| `error.rawResponse` | `Response` | Raw HTTP response |
505+
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
502506

507+
### Example
503508
```typescript
504509
import { Mistral } from "@mistralai/mistralai";
505-
import {
506-
HTTPValidationError,
507-
SDKValidationError,
508-
} from "@mistralai/mistralai/models/errors";
510+
import * as errors from "@mistralai/mistralai/models/errors";
509511

510512
const mistral = new Mistral({
511513
apiKey: process.env["MISTRAL_API_KEY"] ?? "",
512514
});
513515

514516
async function run() {
515-
let result;
516517
try {
517-
result = await mistral.models.list();
518+
const result = await mistral.models.list();
518519

519-
// Handle the result
520520
console.log(result);
521-
} catch (err) {
522-
switch (true) {
523-
// The server response does not match the expected SDK schema
524-
case (err instanceof SDKValidationError): {
525-
// Pretty-print will provide a human-readable multi-line error message
526-
console.error(err.pretty());
527-
// Raw value may also be inspected
528-
console.error(err.rawValue);
529-
return;
530-
}
531-
case (err instanceof HTTPValidationError): {
532-
// Handle err.data$: HTTPValidationErrorData
533-
console.error(err);
534-
return;
535-
}
536-
default: {
537-
// Other errors such as network errors, see HTTPClientErrors for more details
538-
throw err;
521+
} catch (error) {
522+
// The base class for HTTP error responses
523+
if (error instanceof errors.MistralError) {
524+
console.log(error.message);
525+
console.log(error.statusCode);
526+
console.log(error.body);
527+
console.log(error.headers);
528+
529+
// Depending on the method different errors may be thrown
530+
if (error instanceof errors.HTTPValidationError) {
531+
console.log(error.data$.detail); // ValidationError[]
539532
}
540533
}
541534
}
@@ -545,17 +538,29 @@ run();
545538

546539
```
547540

548-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
541+
### Error Classes
542+
**Primary error:**
543+
* [`MistralError`](./src/models/errors/mistralerror.ts): The base class for HTTP error responses.
549544

550-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
545+
<details><summary>Less common errors (7)</summary>
546+
547+
<br />
548+
549+
**Network errors:**
550+
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
551+
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
552+
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
553+
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
554+
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
555+
556+
557+
**Inherit from [`MistralError`](./src/models/errors/mistralerror.ts)**:
558+
* [`HTTPValidationError`](./src/models/errors/httpvalidationerror.ts): Validation Error. Status code `422`. Applicable to 47 of 68 methods.*
559+
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
560+
561+
</details>
551562

552-
| HTTP Client Error | Description |
553-
| ---------------------------------------------------- | ---------------------------------------------------- |
554-
| RequestAbortedError | HTTP request was aborted by the client |
555-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
556-
| ConnectionError | HTTP client was unable to make a request to a server |
557-
| InvalidRequestError | Any input used to create a request is invalid |
558-
| UnexpectedClientError | Unrecognised or unexpected error |
563+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
559564
<!-- End Error Handling [errors] -->
560565

561566
<!-- Start Server Selection [server] -->
@@ -582,7 +587,6 @@ const mistral = new Mistral({
582587
async function run() {
583588
const result = await mistral.models.list();
584589

585-
// Handle the result
586590
console.log(result);
587591
}
588592

@@ -604,7 +608,6 @@ const mistral = new Mistral({
604608
async function run() {
605609
const result = await mistral.models.list();
606610

607-
// Handle the result
608611
console.log(result);
609612
}
610613

@@ -684,7 +687,6 @@ const mistral = new Mistral({
684687
async function run() {
685688
const result = await mistral.models.list();
686689

687-
// Handle the result
688690
console.log(result);
689691
}
690692

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,14 @@ Based on:
268268
### Generated
269269
- [typescript v1.9.19] .
270270
### Releases
271-
- [NPM v1.9.19] https://www.npmjs.com/package/@mistralai/mistralai/v/1.9.19 - .
271+
- [NPM v1.9.19] https://www.npmjs.com/package/@mistralai/mistralai/v/1.9.19 - .
272+
273+
## 2025-09-02 13:40:15
274+
### Changes
275+
Based on:
276+
- OpenAPI Doc
277+
- Speakeasy CLI 1.606.10 (2.687.13) https://github.com/speakeasy-api/speakeasy
278+
### Generated
279+
- [typescript v1.10.0] .
280+
### Releases
281+
- [NPM v1.10.0] https://www.npmjs.com/package/@mistralai/mistralai/v/1.10.0 - .

USAGE.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async function run() {
2222
],
2323
});
2424

25-
// Handle the result
2625
console.log(result);
2726
}
2827

@@ -47,7 +46,6 @@ async function run() {
4746
file: await openAsBlob("example.file"),
4847
});
4948

50-
// Handle the result
5149
console.log(result);
5250
}
5351

@@ -78,7 +76,6 @@ async function run() {
7876
agentId: "<id>",
7977
});
8078

81-
// Handle the result
8279
console.log(result);
8380
}
8481

@@ -106,7 +103,6 @@ async function run() {
106103
],
107104
});
108105

109-
// Handle the result
110106
console.log(result);
111107
}
112108

0 commit comments

Comments
 (0)