Skip to content

Llm.FineTuning

Overview

Available Operations

create

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

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.create({
    model: "meetkai:functionary-medium",
    trainingFile: "file_abc123",
    suffix: "my-model",
    method: {
      type: "supervised",
      supervised: {
        hyperparameters: {
          nEpochs: 3,
        },
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningCreate } from "@meetkai/mka1/funcs/llmFineTuningCreate.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningCreate(sdk, {
    model: "meetkai:functionary-medium",
    trainingFile: "file_abc123",
    suffix: "my-model",
    method: {
      type: "supervised",
      supervised: {
        hyperparameters: {
          nEpochs: 3,
        },
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningCreate failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFineTuningCreateMutation
} from "@meetkai/mka1/react-query/llmFineTuningCreate.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.CreateFineTuningJobRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.FineTuningJob>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

list

List your organization's fine-tuning jobs.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.list({});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningList } from "@meetkai/mka1/funcs/llmFineTuningList.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningList(sdk, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningList failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmFineTuningList,
  useLlmFineTuningListSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFineTuningList,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFineTuningList,
  invalidateAllLlmFineTuningList,
} from "@meetkai/mka1/react-query/llmFineTuningList.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ListFineTuningJobsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.ListFineTuningJobsResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

retrieve

Get info about a fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.retrieve({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningRetrieve } from "@meetkai/mka1/funcs/llmFineTuningRetrieve.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningRetrieve(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningRetrieve failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmFineTuningRetrieve,
  useLlmFineTuningRetrieveSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFineTuningRetrieve,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFineTuningRetrieve,
  invalidateAllLlmFineTuningRetrieve,
} from "@meetkai/mka1/react-query/llmFineTuningRetrieve.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.RetrieveFineTuningJobRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.FineTuningJob>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

cancel

Immediately cancel a fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.cancel({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningCancel } from "@meetkai/mka1/funcs/llmFineTuningCancel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningCancel(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningCancel failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFineTuningCancelMutation
} from "@meetkai/mka1/react-query/llmFineTuningCancel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CancelFineTuningJobRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.FineTuningJob>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

pause

Pause a running fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.pause({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningPause } from "@meetkai/mka1/funcs/llmFineTuningPause.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningPause(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningPause failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFineTuningPauseMutation
} from "@meetkai/mka1/react-query/llmFineTuningPause.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.PauseFineTuningJobRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.FineTuningJob>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

resume

Resume a paused fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.resume({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningResume } from "@meetkai/mka1/funcs/llmFineTuningResume.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningResume(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningResume failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFineTuningResumeMutation
} from "@meetkai/mka1/react-query/llmFineTuningResume.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ResumeFineTuningJobRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.FineTuningJob>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

listEvents

Get status updates for a fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.listEvents({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningListEvents } from "@meetkai/mka1/funcs/llmFineTuningListEvents.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningListEvents(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningListEvents failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmFineTuningListEvents,
  useLlmFineTuningListEventsSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFineTuningListEvents,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFineTuningListEvents,
  invalidateAllLlmFineTuningListEvents,
} from "@meetkai/mka1/react-query/llmFineTuningListEvents.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ListFineTuningEventsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.ListEventsResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

listCheckpoints

List checkpoints for a fine-tuning job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.fineTuning.listCheckpoints({
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFineTuningListCheckpoints } from "@meetkai/mka1/funcs/llmFineTuningListCheckpoints.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmFineTuningListCheckpoints(sdk, {
    fineTuningJobId: "ftjob_aa87e2b1112a455b8deabed784372198",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFineTuningListCheckpoints failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmFineTuningListCheckpoints,
  useLlmFineTuningListCheckpointsSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFineTuningListCheckpoints,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFineTuningListCheckpoints,
  invalidateAllLlmFineTuningListCheckpoints,
} from "@meetkai/mka1/react-query/llmFineTuningListCheckpoints.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ListFineTuningCheckpointsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.ListCheckpointsResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*