@mistralai/mistralai 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +16 -0
  2. package/docs/sdks/batch/README.md +2 -0
  3. package/docs/sdks/files/README.md +77 -0
  4. package/docs/sdks/mistraljobs/README.md +319 -0
  5. package/funcs/batchJobsCancel.d.ts +16 -0
  6. package/funcs/batchJobsCancel.d.ts.map +1 -0
  7. package/funcs/batchJobsCancel.js +100 -0
  8. package/funcs/batchJobsCancel.js.map +1 -0
  9. package/funcs/batchJobsCreate.d.ts +15 -0
  10. package/funcs/batchJobsCreate.d.ts.map +1 -0
  11. package/funcs/batchJobsCreate.js +94 -0
  12. package/funcs/batchJobsCreate.js.map +1 -0
  13. package/funcs/batchJobsGet.d.ts +16 -0
  14. package/funcs/batchJobsGet.d.ts.map +1 -0
  15. package/funcs/batchJobsGet.js +100 -0
  16. package/funcs/batchJobsGet.js.map +1 -0
  17. package/funcs/batchJobsList.d.ts +16 -0
  18. package/funcs/batchJobsList.d.ts.map +1 -0
  19. package/funcs/batchJobsList.js +105 -0
  20. package/funcs/batchJobsList.js.map +1 -0
  21. package/funcs/filesDownload.d.ts +15 -0
  22. package/funcs/filesDownload.d.ts.map +1 -0
  23. package/funcs/filesDownload.js +100 -0
  24. package/funcs/filesDownload.js.map +1 -0
  25. package/lib/config.d.ts +2 -2
  26. package/lib/config.js +2 -2
  27. package/models/components/apiendpoint.d.ts +34 -0
  28. package/models/components/apiendpoint.d.ts.map +1 -0
  29. package/models/components/apiendpoint.js +53 -0
  30. package/models/components/apiendpoint.js.map +1 -0
  31. package/models/components/batcherror.d.ts +27 -0
  32. package/models/components/batcherror.d.ts.map +1 -0
  33. package/models/components/batcherror.js +52 -0
  34. package/models/components/batcherror.js.map +1 -0
  35. package/models/components/batchjobin.d.ts +38 -0
  36. package/models/components/batchjobin.d.ts.map +1 -0
  37. package/models/components/batchjobin.js +70 -0
  38. package/models/components/batchjobin.js.map +1 -0
  39. package/models/components/batchjobout.d.ts +86 -0
  40. package/models/components/batchjobout.d.ts.map +1 -0
  41. package/models/components/batchjobout.js +129 -0
  42. package/models/components/batchjobout.js.map +1 -0
  43. package/models/components/batchjobsout.d.ts +53 -0
  44. package/models/components/batchjobsout.d.ts.map +1 -0
  45. package/models/components/batchjobsout.js +73 -0
  46. package/models/components/batchjobsout.js.map +1 -0
  47. package/models/components/batchjobstatus.d.ts +43 -0
  48. package/models/components/batchjobstatus.d.ts.map +1 -0
  49. package/models/components/batchjobstatus.js +55 -0
  50. package/models/components/batchjobstatus.js.map +1 -0
  51. package/models/components/chatcompletionchoice.d.ts +3 -3
  52. package/models/components/chatcompletionchoice.d.ts.map +1 -1
  53. package/models/components/chatcompletionchoice.js +3 -3
  54. package/models/components/chatcompletionchoice.js.map +1 -1
  55. package/models/components/index.d.ts +6 -0
  56. package/models/components/index.d.ts.map +1 -1
  57. package/models/components/index.js +6 -0
  58. package/models/components/index.js.map +1 -1
  59. package/models/operations/filesapiroutesdownloadfile.d.ts +25 -0
  60. package/models/operations/filesapiroutesdownloadfile.d.ts.map +1 -0
  61. package/models/operations/filesapiroutesdownloadfile.js +59 -0
  62. package/models/operations/filesapiroutesdownloadfile.js.map +1 -0
  63. package/models/operations/index.d.ts +4 -0
  64. package/models/operations/index.d.ts.map +1 -1
  65. package/models/operations/index.js +4 -0
  66. package/models/operations/index.js.map +1 -1
  67. package/models/operations/jobsapiroutesbatchcancelbatchjob.d.ts +25 -0
  68. package/models/operations/jobsapiroutesbatchcancelbatchjob.d.ts.map +1 -0
  69. package/models/operations/jobsapiroutesbatchcancelbatchjob.js +59 -0
  70. package/models/operations/jobsapiroutesbatchcancelbatchjob.js.map +1 -0
  71. package/models/operations/jobsapiroutesbatchgetbatchjob.d.ts +25 -0
  72. package/models/operations/jobsapiroutesbatchgetbatchjob.d.ts.map +1 -0
  73. package/models/operations/jobsapiroutesbatchgetbatchjob.js +59 -0
  74. package/models/operations/jobsapiroutesbatchgetbatchjob.js.map +1 -0
  75. package/models/operations/jobsapiroutesbatchgetbatchjobs.d.ts +42 -0
  76. package/models/operations/jobsapiroutesbatchgetbatchjobs.d.ts.map +1 -0
  77. package/models/operations/jobsapiroutesbatchgetbatchjobs.js +76 -0
  78. package/models/operations/jobsapiroutesbatchgetbatchjobs.js.map +1 -0
  79. package/package.json +1 -1
  80. package/packages/mistralai-azure/src/sdk/sdk.ts +1 -1
  81. package/packages/mistralai-gcp/src/sdk/sdk.ts +10 -3
  82. package/sdk/batch.d.ts +7 -0
  83. package/sdk/batch.d.ts.map +1 -0
  84. package/sdk/batch.js +16 -0
  85. package/sdk/batch.js.map +1 -0
  86. package/sdk/files.d.ts +7 -0
  87. package/sdk/files.d.ts.map +1 -1
  88. package/sdk/files.js +10 -0
  89. package/sdk/files.js.map +1 -1
  90. package/sdk/mistraljobs.d.ts +34 -0
  91. package/sdk/mistraljobs.d.ts.map +1 -0
  92. package/sdk/mistraljobs.js +52 -0
  93. package/sdk/mistraljobs.js.map +1 -0
  94. package/sdk/sdk.d.ts +3 -0
  95. package/sdk/sdk.d.ts.map +1 -1
  96. package/sdk/sdk.js +5 -0
  97. package/sdk/sdk.js.map +1 -1
  98. package/src/funcs/batchJobsCancel.ts +130 -0
  99. package/src/funcs/batchJobsCreate.ts +120 -0
  100. package/src/funcs/batchJobsGet.ts +130 -0
  101. package/src/funcs/batchJobsList.ts +133 -0
  102. package/src/funcs/filesDownload.ts +128 -0
  103. package/src/lib/config.ts +2 -2
  104. package/src/models/components/apiendpoint.ts +33 -0
  105. package/src/models/components/batcherror.ts +49 -0
  106. package/src/models/components/batchjobin.ts +77 -0
  107. package/src/models/components/batchjobout.ts +174 -0
  108. package/src/models/components/batchjobsout.ts +86 -0
  109. package/src/models/components/batchjobstatus.ts +38 -0
  110. package/src/models/components/chatcompletionchoice.ts +9 -9
  111. package/src/models/components/index.ts +6 -0
  112. package/src/models/operations/filesapiroutesdownloadfile.ts +55 -0
  113. package/src/models/operations/index.ts +4 -0
  114. package/src/models/operations/jobsapiroutesbatchcancelbatchjob.ts +56 -0
  115. package/src/models/operations/jobsapiroutesbatchgetbatchjob.ts +56 -0
  116. package/src/models/operations/jobsapiroutesbatchgetbatchjobs.ts +87 -0
  117. package/src/sdk/batch.ts +13 -0
  118. package/src/sdk/files.ts +18 -0
  119. package/src/sdk/mistraljobs.ts +82 -0
  120. package/src/sdk/sdk.ts +6 -0
package/README.md CHANGED
@@ -215,6 +215,16 @@ We have dedicated SDKs for the following providers:
215
215
  * [complete](docs/sdks/agents/README.md#complete) - Agents Completion
216
216
  * [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion
217
217
 
218
+ ### [batch](docs/sdks/batch/README.md)
219
+
220
+
221
+ #### [batch.jobs](docs/sdks/mistraljobs/README.md)
222
+
223
+ * [list](docs/sdks/mistraljobs/README.md#list) - Get Batch Jobs
224
+ * [create](docs/sdks/mistraljobs/README.md#create) - Create Batch Job
225
+ * [get](docs/sdks/mistraljobs/README.md#get) - Get Batch Job
226
+ * [cancel](docs/sdks/mistraljobs/README.md#cancel) - Cancel Batch Job
227
+
218
228
  ### [chat](docs/sdks/chat/README.md)
219
229
 
220
230
  * [complete](docs/sdks/chat/README.md#complete) - Chat Completion
@@ -235,6 +245,7 @@ We have dedicated SDKs for the following providers:
235
245
  * [list](docs/sdks/files/README.md#list) - List Files
236
246
  * [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
237
247
  * [delete](docs/sdks/files/README.md#delete) - Delete File
248
+ * [download](docs/sdks/files/README.md#download) - Download File
238
249
 
239
250
  ### [fim](docs/sdks/fim/README.md)
240
251
 
@@ -635,12 +646,17 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
635
646
 
636
647
  - [`agentsComplete`](docs/sdks/agents/README.md#complete) - Agents Completion
637
648
  - [`agentsStream`](docs/sdks/agents/README.md#stream) - Stream Agents completion
649
+ - [`batchJobsCancel`](docs/sdks/mistraljobs/README.md#cancel) - Cancel Batch Job
650
+ - [`batchJobsCreate`](docs/sdks/mistraljobs/README.md#create) - Create Batch Job
651
+ - [`batchJobsGet`](docs/sdks/mistraljobs/README.md#get) - Get Batch Job
652
+ - [`batchJobsList`](docs/sdks/mistraljobs/README.md#list) - Get Batch Jobs
638
653
  - [`chatComplete`](docs/sdks/chat/README.md#complete) - Chat Completion
639
654
  - [`chatStream`](docs/sdks/chat/README.md#stream) - Stream chat completion
640
655
  - [`classifiersModerate`](docs/sdks/classifiers/README.md#moderate) - Moderations
641
656
  - [`classifiersModerateChat`](docs/sdks/classifiers/README.md#moderatechat) - Moderations Chat
642
657
  - [`embeddingsCreate`](docs/sdks/embeddings/README.md#create) - Embeddings
643
658
  - [`filesDelete`](docs/sdks/files/README.md#delete) - Delete File
659
+ - [`filesDownload`](docs/sdks/files/README.md#download) - Download File
644
660
  - [`filesList`](docs/sdks/files/README.md#list) - List Files
645
661
  - [`filesRetrieve`](docs/sdks/files/README.md#retrieve) - Retrieve File
646
662
  - [`filesUpload`](docs/sdks/files/README.md#upload) - Upload File
@@ -0,0 +1,2 @@
1
+ # Batch
2
+ (*batch*)
@@ -11,6 +11,7 @@ Files API
11
11
  * [list](#list) - List Files
12
12
  * [retrieve](#retrieve) - Retrieve File
13
13
  * [delete](#delete) - Delete File
14
+ * [download](#download) - Download File
14
15
 
15
16
  ## upload
16
17
 
@@ -314,6 +315,82 @@ run();
314
315
 
315
316
  ### Errors
316
317
 
318
+ | Error Type | Status Code | Content Type |
319
+ | --------------- | --------------- | --------------- |
320
+ | errors.SDKError | 4XX, 5XX | \*/\* |
321
+
322
+ ## download
323
+
324
+ Download a file
325
+
326
+ ### Example Usage
327
+
328
+ ```typescript
329
+ import { Mistral } from "@mistralai/mistralai";
330
+
331
+ const mistral = new Mistral({
332
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
333
+ });
334
+
335
+ async function run() {
336
+ const result = await mistral.files.download({
337
+ fileId: "<id>",
338
+ });
339
+
340
+ // Handle the result
341
+ console.log(result);
342
+ }
343
+
344
+ run();
345
+ ```
346
+
347
+ ### Standalone function
348
+
349
+ The standalone function version of this method:
350
+
351
+ ```typescript
352
+ import { MistralCore } from "@mistralai/mistralai/core.js";
353
+ import { filesDownload } from "@mistralai/mistralai/funcs/filesDownload.js";
354
+
355
+ // Use `MistralCore` for best tree-shaking performance.
356
+ // You can create one instance of it to use across an application.
357
+ const mistral = new MistralCore({
358
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
359
+ });
360
+
361
+ async function run() {
362
+ const res = await filesDownload(mistral, {
363
+ fileId: "<id>",
364
+ });
365
+
366
+ if (!res.ok) {
367
+ throw res.error;
368
+ }
369
+
370
+ const { value: result } = res;
371
+
372
+ // Handle the result
373
+ console.log(result);
374
+ }
375
+
376
+ run();
377
+ ```
378
+
379
+ ### Parameters
380
+
381
+ | Parameter | Type | Required | Description |
382
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
383
+ | `request` | [operations.FilesApiRoutesDownloadFileRequest](../../models/operations/filesapiroutesdownloadfilerequest.md) | :heavy_check_mark: | The request object to use for the request. |
384
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
385
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
386
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
387
+
388
+ ### Response
389
+
390
+ **Promise\<[ReadableStream<Uint8Array>](../../models/.md)\>**
391
+
392
+ ### Errors
393
+
317
394
  | Error Type | Status Code | Content Type |
318
395
  | --------------- | --------------- | --------------- |
319
396
  | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,319 @@
1
+ # MistralJobs
2
+ (*batch.jobs*)
3
+
4
+ ## Overview
5
+
6
+ ### Available Operations
7
+
8
+ * [list](#list) - Get Batch Jobs
9
+ * [create](#create) - Create Batch Job
10
+ * [get](#get) - Get Batch Job
11
+ * [cancel](#cancel) - Cancel Batch Job
12
+
13
+ ## list
14
+
15
+ Get a list of batch jobs for your organization and user.
16
+
17
+ ### Example Usage
18
+
19
+ ```typescript
20
+ import { Mistral } from "@mistralai/mistralai";
21
+
22
+ const mistral = new Mistral({
23
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
24
+ });
25
+
26
+ async function run() {
27
+ const result = await mistral.batch.jobs.list();
28
+
29
+ // Handle the result
30
+ console.log(result);
31
+ }
32
+
33
+ run();
34
+ ```
35
+
36
+ ### Standalone function
37
+
38
+ The standalone function version of this method:
39
+
40
+ ```typescript
41
+ import { MistralCore } from "@mistralai/mistralai/core.js";
42
+ import { batchJobsList } from "@mistralai/mistralai/funcs/batchJobsList.js";
43
+
44
+ // Use `MistralCore` for best tree-shaking performance.
45
+ // You can create one instance of it to use across an application.
46
+ const mistral = new MistralCore({
47
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
48
+ });
49
+
50
+ async function run() {
51
+ const res = await batchJobsList(mistral);
52
+
53
+ if (!res.ok) {
54
+ throw res.error;
55
+ }
56
+
57
+ const { value: result } = res;
58
+
59
+ // Handle the result
60
+ console.log(result);
61
+ }
62
+
63
+ run();
64
+ ```
65
+
66
+ ### Parameters
67
+
68
+ | Parameter | Type | Required | Description |
69
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
70
+ | `request` | [operations.JobsApiRoutesBatchGetBatchJobsRequest](../../models/operations/jobsapiroutesbatchgetbatchjobsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
71
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
72
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
73
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
74
+
75
+ ### Response
76
+
77
+ **Promise\<[components.BatchJobsOut](../../models/components/batchjobsout.md)\>**
78
+
79
+ ### Errors
80
+
81
+ | Error Type | Status Code | Content Type |
82
+ | --------------- | --------------- | --------------- |
83
+ | errors.SDKError | 4XX, 5XX | \*/\* |
84
+
85
+ ## create
86
+
87
+ Create a new batch job, it will be queued for processing.
88
+
89
+ ### Example Usage
90
+
91
+ ```typescript
92
+ import { Mistral } from "@mistralai/mistralai";
93
+
94
+ const mistral = new Mistral({
95
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
96
+ });
97
+
98
+ async function run() {
99
+ const result = await mistral.batch.jobs.create({
100
+ inputFiles: [
101
+ "a621cf02-1cd9-4cf5-8403-315211a509a3",
102
+ ],
103
+ endpoint: "/v1/fim/completions",
104
+ model: "2",
105
+ });
106
+
107
+ // Handle the result
108
+ console.log(result);
109
+ }
110
+
111
+ run();
112
+ ```
113
+
114
+ ### Standalone function
115
+
116
+ The standalone function version of this method:
117
+
118
+ ```typescript
119
+ import { MistralCore } from "@mistralai/mistralai/core.js";
120
+ import { batchJobsCreate } from "@mistralai/mistralai/funcs/batchJobsCreate.js";
121
+
122
+ // Use `MistralCore` for best tree-shaking performance.
123
+ // You can create one instance of it to use across an application.
124
+ const mistral = new MistralCore({
125
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
126
+ });
127
+
128
+ async function run() {
129
+ const res = await batchJobsCreate(mistral, {
130
+ inputFiles: [
131
+ "a621cf02-1cd9-4cf5-8403-315211a509a3",
132
+ ],
133
+ endpoint: "/v1/fim/completions",
134
+ model: "2",
135
+ });
136
+
137
+ if (!res.ok) {
138
+ throw res.error;
139
+ }
140
+
141
+ const { value: result } = res;
142
+
143
+ // Handle the result
144
+ console.log(result);
145
+ }
146
+
147
+ run();
148
+ ```
149
+
150
+ ### Parameters
151
+
152
+ | Parameter | Type | Required | Description |
153
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
154
+ | `request` | [components.BatchJobIn](../../models/components/batchjobin.md) | :heavy_check_mark: | The request object to use for the request. |
155
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
156
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
157
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
158
+
159
+ ### Response
160
+
161
+ **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>**
162
+
163
+ ### Errors
164
+
165
+ | Error Type | Status Code | Content Type |
166
+ | --------------- | --------------- | --------------- |
167
+ | errors.SDKError | 4XX, 5XX | \*/\* |
168
+
169
+ ## get
170
+
171
+ Get a batch job details by its UUID.
172
+
173
+ ### Example Usage
174
+
175
+ ```typescript
176
+ import { Mistral } from "@mistralai/mistralai";
177
+
178
+ const mistral = new Mistral({
179
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
180
+ });
181
+
182
+ async function run() {
183
+ const result = await mistral.batch.jobs.get({
184
+ jobId: "b888f774-3e7c-4135-a18c-6b985523c4bc",
185
+ });
186
+
187
+ // Handle the result
188
+ console.log(result);
189
+ }
190
+
191
+ run();
192
+ ```
193
+
194
+ ### Standalone function
195
+
196
+ The standalone function version of this method:
197
+
198
+ ```typescript
199
+ import { MistralCore } from "@mistralai/mistralai/core.js";
200
+ import { batchJobsGet } from "@mistralai/mistralai/funcs/batchJobsGet.js";
201
+
202
+ // Use `MistralCore` for best tree-shaking performance.
203
+ // You can create one instance of it to use across an application.
204
+ const mistral = new MistralCore({
205
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
206
+ });
207
+
208
+ async function run() {
209
+ const res = await batchJobsGet(mistral, {
210
+ jobId: "b888f774-3e7c-4135-a18c-6b985523c4bc",
211
+ });
212
+
213
+ if (!res.ok) {
214
+ throw res.error;
215
+ }
216
+
217
+ const { value: result } = res;
218
+
219
+ // Handle the result
220
+ console.log(result);
221
+ }
222
+
223
+ run();
224
+ ```
225
+
226
+ ### Parameters
227
+
228
+ | Parameter | Type | Required | Description |
229
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
230
+ | `request` | [operations.JobsApiRoutesBatchGetBatchJobRequest](../../models/operations/jobsapiroutesbatchgetbatchjobrequest.md) | :heavy_check_mark: | The request object to use for the request. |
231
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
232
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
233
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
234
+
235
+ ### Response
236
+
237
+ **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>**
238
+
239
+ ### Errors
240
+
241
+ | Error Type | Status Code | Content Type |
242
+ | --------------- | --------------- | --------------- |
243
+ | errors.SDKError | 4XX, 5XX | \*/\* |
244
+
245
+ ## cancel
246
+
247
+ Request the cancellation of a batch job.
248
+
249
+ ### Example Usage
250
+
251
+ ```typescript
252
+ import { Mistral } from "@mistralai/mistralai";
253
+
254
+ const mistral = new Mistral({
255
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
256
+ });
257
+
258
+ async function run() {
259
+ const result = await mistral.batch.jobs.cancel({
260
+ jobId: "0f713502-9233-41c6-9ebd-c570b7edb496",
261
+ });
262
+
263
+ // Handle the result
264
+ console.log(result);
265
+ }
266
+
267
+ run();
268
+ ```
269
+
270
+ ### Standalone function
271
+
272
+ The standalone function version of this method:
273
+
274
+ ```typescript
275
+ import { MistralCore } from "@mistralai/mistralai/core.js";
276
+ import { batchJobsCancel } from "@mistralai/mistralai/funcs/batchJobsCancel.js";
277
+
278
+ // Use `MistralCore` for best tree-shaking performance.
279
+ // You can create one instance of it to use across an application.
280
+ const mistral = new MistralCore({
281
+ apiKey: process.env["MISTRAL_API_KEY"] ?? "",
282
+ });
283
+
284
+ async function run() {
285
+ const res = await batchJobsCancel(mistral, {
286
+ jobId: "0f713502-9233-41c6-9ebd-c570b7edb496",
287
+ });
288
+
289
+ if (!res.ok) {
290
+ throw res.error;
291
+ }
292
+
293
+ const { value: result } = res;
294
+
295
+ // Handle the result
296
+ console.log(result);
297
+ }
298
+
299
+ run();
300
+ ```
301
+
302
+ ### Parameters
303
+
304
+ | Parameter | Type | Required | Description |
305
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
306
+ | `request` | [operations.JobsApiRoutesBatchCancelBatchJobRequest](../../models/operations/jobsapiroutesbatchcancelbatchjobrequest.md) | :heavy_check_mark: | The request object to use for the request. |
307
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
308
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
309
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
310
+
311
+ ### Response
312
+
313
+ **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>**
314
+
315
+ ### Errors
316
+
317
+ | Error Type | Status Code | Content Type |
318
+ | --------------- | --------------- | --------------- |
319
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,16 @@
1
+ import { MistralCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import * as components from "../models/components/index.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import { SDKError } from "../models/errors/sdkerror.js";
6
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
7
+ import * as operations from "../models/operations/index.js";
8
+ import { Result } from "../types/fp.js";
9
+ /**
10
+ * Cancel Batch Job
11
+ *
12
+ * @remarks
13
+ * Request the cancellation of a batch job.
14
+ */
15
+ export declare function batchJobsCancel(client: MistralCore, request: operations.JobsApiRoutesBatchCancelBatchJobRequest, options?: RequestOptions): Promise<Result<components.BatchJobOut, SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
+ //# sourceMappingURL=batchJobsCancel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batchJobsCancel.d.ts","sourceRoot":"","sources":["../src/funcs/batchJobsCancel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,UAAU,CAAC,uCAAuC,EAC3D,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,WAAW,EACpB,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAoFA"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.batchJobsCancel = batchJobsCancel;
30
+ const encodings_js_1 = require("../lib/encodings.js");
31
+ const M = __importStar(require("../lib/matchers.js"));
32
+ const schemas_js_1 = require("../lib/schemas.js");
33
+ const security_js_1 = require("../lib/security.js");
34
+ const url_js_1 = require("../lib/url.js");
35
+ const components = __importStar(require("../models/components/index.js"));
36
+ const operations = __importStar(require("../models/operations/index.js"));
37
+ /**
38
+ * Cancel Batch Job
39
+ *
40
+ * @remarks
41
+ * Request the cancellation of a batch job.
42
+ */
43
+ async function batchJobsCancel(client, request, options) {
44
+ const parsed = (0, schemas_js_1.safeParse)(request, (value) => operations.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(value), "Input validation failed");
45
+ if (!parsed.ok) {
46
+ return parsed;
47
+ }
48
+ const payload = parsed.value;
49
+ const body = null;
50
+ const pathParams = {
51
+ job_id: (0, encodings_js_1.encodeSimple)("job_id", payload.job_id, {
52
+ explode: false,
53
+ charEncoding: "percent",
54
+ }),
55
+ };
56
+ const path = (0, url_js_1.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(pathParams);
57
+ const headers = new Headers({
58
+ Accept: "application/json",
59
+ });
60
+ const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey);
61
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
62
+ const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
63
+ const context = {
64
+ operationID: "jobs_api_routes_batch_cancel_batch_job",
65
+ oAuth2Scopes: [],
66
+ securitySource: client._options.apiKey,
67
+ retryConfig: (options === null || options === void 0 ? void 0 : options.retries)
68
+ || client._options.retryConfig
69
+ || { strategy: "none" },
70
+ retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"],
71
+ };
72
+ const requestRes = client._createRequest(context, {
73
+ security: requestSecurity,
74
+ method: "POST",
75
+ path: path,
76
+ headers: headers,
77
+ body: body,
78
+ timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1,
79
+ }, options);
80
+ if (!requestRes.ok) {
81
+ return requestRes;
82
+ }
83
+ const req = requestRes.value;
84
+ const doResult = await client._do(req, {
85
+ context,
86
+ errorCodes: ["4XX", "5XX"],
87
+ retryConfig: context.retryConfig,
88
+ retryCodes: context.retryCodes,
89
+ });
90
+ if (!doResult.ok) {
91
+ return doResult;
92
+ }
93
+ const response = doResult.value;
94
+ const [result] = await M.match(M.json(200, components.BatchJobOut$inboundSchema), M.fail(["4XX", "5XX"]))(response);
95
+ if (!result.ok) {
96
+ return result;
97
+ }
98
+ return result;
99
+ }
100
+ //# sourceMappingURL=batchJobsCancel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batchJobsCancel.js","sourceRoot":"","sources":["../src/funcs/batchJobsCancel.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { MistralCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import * as components from "../models/components/index.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import { SDKError } from "../models/errors/sdkerror.js";
6
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
7
+ import { Result } from "../types/fp.js";
8
+ /**
9
+ * Create Batch Job
10
+ *
11
+ * @remarks
12
+ * Create a new batch job, it will be queued for processing.
13
+ */
14
+ export declare function batchJobsCreate(client: MistralCore, request: components.BatchJobIn, options?: RequestOptions): Promise<Result<components.BatchJobOut, SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
15
+ //# sourceMappingURL=batchJobsCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batchJobsCreate.d.ts","sourceRoot":"","sources":["../src/funcs/batchJobsCreate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,UAAU,CAAC,UAAU,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,WAAW,EACpB,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CA2EA"}