Skip to content

Latest commit

 

History

History
519 lines (359 loc) · 35.8 KB

README.md

File metadata and controls

519 lines (359 loc) · 35.8 KB

FineTuning

(fineTuning)

Overview

Manage fine-tuning jobs to tailor a model to your specific training data.

Available Operations

  • createFineTuningJob - Creates a fine-tuning job which begins the process of creating a new model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Learn more about fine-tuning

Learn more about fine-tuning

createFineTuningJob

Creates a fine-tuning job which begins the process of creating a new model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Learn more about fine-tuning

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.createFineTuningJob({
    model: "gpt-4o-mini",
    trainingFile: "file-abc123",
    validationFile: "file-abc123",
    integrations: [
      {
        type: "wandb",
        wandb: {
          project: "my-wandb-project",
          tags: [
            "custom-tag",
          ],
        },
      },
    ],
    seed: 42,
  });

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningCreateFineTuningJob } from "argot-open-ai/funcs/fineTuningCreateFineTuningJob.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningCreateFineTuningJob(argotOpenAi, {
    model: "gpt-4o-mini",
    trainingFile: "file-abc123",
    validationFile: "file-abc123",
    integrations: [
      {
        type: "wandb",
        wandb: {
          project: "my-wandb-project",
          tags: [
            "custom-tag",
          ],
        },
      },
    ],
    seed: 42,
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request components.CreateFineTuningJobRequest ✔️ 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.FineTuningJob>

Errors

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

listPaginatedFineTuningJobs

List your organization's fine-tuning jobs

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.listPaginatedFineTuningJobs({});

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningListPaginatedFineTuningJobs } from "argot-open-ai/funcs/fineTuningListPaginatedFineTuningJobs.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningListPaginatedFineTuningJobs(argotOpenAi, {});

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

retrieveFineTuningJob

Get info about a fine-tuning job.

Learn more about fine-tuning

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.retrieveFineTuningJob({
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningRetrieveFineTuningJob } from "argot-open-ai/funcs/fineTuningRetrieveFineTuningJob.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningRetrieveFineTuningJob(argotOpenAi, {
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

listFineTuningEvents

Get status updates for a fine-tuning job.

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.listFineTuningEvents({
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningListFineTuningEvents } from "argot-open-ai/funcs/fineTuningListFineTuningEvents.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningListFineTuningEvents(argotOpenAi, {
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

cancelFineTuningJob

Immediately cancel a fine-tune job.

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.cancelFineTuningJob({
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningCancelFineTuningJob } from "argot-open-ai/funcs/fineTuningCancelFineTuningJob.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningCancelFineTuningJob(argotOpenAi, {
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

listFineTuningJobCheckpoints

List checkpoints for a fine-tuning job.

Example Usage

import { ArgotOpenAi } from "argot-open-ai";

const argotOpenAi = new ArgotOpenAi({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const result = await argotOpenAi.fineTuning.listFineTuningJobCheckpoints({
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

run();

Standalone function

The standalone function version of this method:

import { ArgotOpenAiCore } from "argot-open-ai/core.js";
import { fineTuningListFineTuningJobCheckpoints } from "argot-open-ai/funcs/fineTuningListFineTuningJobCheckpoints.js";

// Use `ArgotOpenAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const argotOpenAi = new ArgotOpenAiCore({
  apiKeyAuth: process.env["ARGOTOPENAI_API_KEY_AUTH"] ?? "",
});

async function run() {
  const res = await fineTuningListFineTuningJobCheckpoints(argotOpenAi, {
    fineTuningJobId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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