Skip to content

Latest commit

 

History

History
235 lines (162 loc) · 16.7 KB

README.md

File metadata and controls

235 lines (162 loc) · 16.7 KB

Models

(models)

Overview

List and describe the various models available in the API.

Available Operations

  • listModels - Lists the currently available models, and provides basic information about each one such as the owner and availability.
  • retrieveModel - Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
  • deleteModel - Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

listModels

Lists the currently available models, and provides basic information about each one such as the owner and availability.

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.models.listModels();

  // 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 { modelsListModels } from "argot-open-ai/funcs/modelsListModels.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 modelsListModels(argotOpenAi);

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
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.ListModelsResponse>

Errors

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

retrieveModel

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

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.models.retrieveModel({
    model: "gpt-4o-mini",
  });

  // 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 { modelsRetrieveModel } from "argot-open-ai/funcs/modelsRetrieveModel.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 modelsRetrieveModel(argotOpenAi, {
    model: "gpt-4o-mini",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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

deleteModel

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

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.models.deleteModel({
    model: "ft:gpt-4o-mini:acemeco:suffix:abc123",
  });

  // 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 { modelsDeleteModel } from "argot-open-ai/funcs/modelsDeleteModel.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 modelsDeleteModel(argotOpenAi, {
    model: "ft:gpt-4o-mini:acemeco:suffix:abc123",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

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