(batch.jobs)
Get a list of batch jobs for your organization and user.
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();
// Handle the result
console.log(result);
}
run();
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) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
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. |
Promise<components.BatchJobsOut>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Create a new batch job, it will be queued for processing.
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: [
"a621cf02-1cd9-4cf5-8403-315211a509a3",
],
endpoint: "/v1/fim/completions",
model: "2",
});
// Handle the result
console.log(result);
}
run();
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: [
"a621cf02-1cd9-4cf5-8403-315211a509a3",
],
endpoint: "/v1/fim/completions",
model: "2",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
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. |
Promise<components.BatchJobOut>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Get a batch job details by its UUID.
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: "b888f774-3e7c-4135-a18c-6b985523c4bc",
});
// Handle the result
console.log(result);
}
run();
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: "b888f774-3e7c-4135-a18c-6b985523c4bc",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
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. |
Promise<components.BatchJobOut>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Request the cancellation of a batch job.
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: "0f713502-9233-41c6-9ebd-c570b7edb496",
});
// Handle the result
console.log(result);
}
run();
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: "0f713502-9233-41c6-9ebd-c570b7edb496",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
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. |
Promise<components.BatchJobOut>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |