Skip to content

Latest commit

 

History

History
394 lines (272 loc) · 28.1 KB

README.md

File metadata and controls

394 lines (272 loc) · 28.1 KB

Jobs

(fineTuning.jobs)

Overview

Available Operations

  • list - Get Fine Tuning Jobs
  • create - Create Fine Tuning Job
  • get - Get Fine Tuning Job
  • cancel - Cancel Fine Tuning Job
  • start - Start Fine Tuning Job

list

Get a list of fine-tuning 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.fineTuning.jobs.list();
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { fineTuningJobsList } from "@mistralai/mistralai/funcs/fineTuningJobsList.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 fineTuningJobsList(mistral);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.JobsApiRoutesFineTuningGetFineTuningJobsRequest ✔️ 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.JobsOut>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

create

Create a new fine-tuning 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.fineTuning.jobs.create({
    model: "codestral-latest",
    hyperparameters: {},
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { fineTuningJobsCreate } from "@mistralai/mistralai/funcs/fineTuningJobsCreate.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 fineTuningJobsCreate(mistral, {
    model: "codestral-latest",
    hyperparameters: {},
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request components.JobIn ✔️ 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<operations.JobsApiRoutesFineTuningCreateFineTuningJobResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

get

Get a fine-tuned 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.fineTuning.jobs.get({
    jobId: "b18d8d81-fd7b-4764-a31e-475cb1f36591",
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { fineTuningJobsGet } from "@mistralai/mistralai/funcs/fineTuningJobsGet.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 fineTuningJobsGet(mistral, {
    jobId: "b18d8d81-fd7b-4764-a31e-475cb1f36591",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.JobsApiRoutesFineTuningGetFineTuningJobRequest ✔️ 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.DetailedJobOut>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

cancel

Request the cancellation of a fine tuning 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.fineTuning.jobs.cancel({
    jobId: "03fa7112-315a-4072-a9f2-43f3f1ec962e",
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { fineTuningJobsCancel } from "@mistralai/mistralai/funcs/fineTuningJobsCancel.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 fineTuningJobsCancel(mistral, {
    jobId: "03fa7112-315a-4072-a9f2-43f3f1ec962e",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.JobsApiRoutesFineTuningCancelFineTuningJobRequest ✔️ 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.DetailedJobOut>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

start

Request the start of a validated fine tuning 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.fineTuning.jobs.start({
    jobId: "0eb0f807-fb9f-4e46-9c13-4e257df6e1ba",
  });
  
  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { fineTuningJobsStart } from "@mistralai/mistralai/funcs/fineTuningJobsStart.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 fineTuningJobsStart(mistral, {
    jobId: "0eb0f807-fb9f-4e46-9c13-4e257df6e1ba",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.JobsApiRoutesFineTuningStartFineTuningJobRequest ✔️ 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.DetailedJobOut>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /