This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/@mistralai/mistralai/docs/sdks/mistraljobs/README.md
T

23 KiB
Raw Blame History

MistralJobs

(batch.jobs)

Overview

Available Operations

  • list - Get Batch Jobs
  • create - Create Batch Job
  • get - Get Batch Job
  • cancel - Cancel Batch Job

list

Get a list of batch jobs for your organization and user.

Example Usage

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:

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 ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchJobsOut>

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

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:

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 ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchJobOut>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get

Get a batch job details by its UUID.

Example Usage

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:

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 ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchJobOut>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

cancel

Request the cancellation of a batch job.

Example Usage

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:

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 ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchJobOut>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*