# MistralJobs (*batch.jobs*) ## Overview ### Available Operations * [list](#list) - Get Batch Jobs * [create](#create) - Create Batch Job * [get](#get) - Get Batch Job * [cancel](#cancel) - Cancel Batch Job ## list Get a list of batch jobs for your organization and user. ### Example Usage ```typescript import { Mistral } from "@mistralai/mistralai"; const mistral = new Mistral({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const result = await mistral.batch.jobs.list({}); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { batchJobsList } from "@mistralai/mistralai/funcs/batchJobsList.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await batchJobsList(mistral, {}); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("batchJobsList failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.JobsApiRoutesBatchGetBatchJobsRequest](../../models/operations/jobsapiroutesbatchgetbatchjobsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `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. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.BatchJobsOut](../../models/components/batchjobsout.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## create Create a new batch job, it will be queued for processing. ### Example Usage ```typescript import { Mistral } from "@mistralai/mistralai"; const mistral = new Mistral({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const result = await mistral.batch.jobs.create({ inputFiles: [ "fe3343a2-3b8d-404b-ba32-a78dede2614a", ], endpoint: "/v1/classifications", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { batchJobsCreate } from "@mistralai/mistralai/funcs/batchJobsCreate.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await batchJobsCreate(mistral, { inputFiles: [ "fe3343a2-3b8d-404b-ba32-a78dede2614a", ], endpoint: "/v1/classifications", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("batchJobsCreate failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [components.BatchJobIn](../../models/components/batchjobin.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `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. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## get Get a batch job details by its UUID. ### Example Usage ```typescript import { Mistral } from "@mistralai/mistralai"; const mistral = new Mistral({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const result = await mistral.batch.jobs.get({ jobId: "4017dc9f-b629-42f4-9700-8c681b9e7f0f", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { batchJobsGet } from "@mistralai/mistralai/funcs/batchJobsGet.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await batchJobsGet(mistral, { jobId: "4017dc9f-b629-42f4-9700-8c681b9e7f0f", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("batchJobsGet failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.JobsApiRoutesBatchGetBatchJobRequest](../../models/operations/jobsapiroutesbatchgetbatchjobrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `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. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## cancel Request the cancellation of a batch job. ### Example Usage ```typescript import { Mistral } from "@mistralai/mistralai"; const mistral = new Mistral({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const result = await mistral.batch.jobs.cancel({ jobId: "4fb29d1c-535b-4f0a-a1cb-2167f86da569", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { batchJobsCancel } from "@mistralai/mistralai/funcs/batchJobsCancel.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await batchJobsCancel(mistral, { jobId: "4fb29d1c-535b-4f0a-a1cb-2167f86da569", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("batchJobsCancel failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.JobsApiRoutesBatchCancelBatchJobRequest](../../models/operations/jobsapiroutesbatchcancelbatchjobrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `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. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.BatchJobOut](../../models/components/batchjobout.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |