Skip to content

Latest commit

 

History

History
261 lines (175 loc) · 25.4 KB

README.md

File metadata and controls

261 lines (175 loc) · 25.4 KB

Model

(model)

Available Operations

createModel

This endpoint will train a new custom model

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.createModel({
    datasetId: "<value>",
    instancePrompt: "<value>",
    name: "<value>",
  });

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

run();

Parameters

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

Response

Promise<operations.CreateModelResponse>

Errors

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

delete3DModelById

This endpoint deletes the specific 3D Model

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.delete3DModelById("<value>", {});

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

run();

Parameters

Parameter Type Required Description
id string ✔️ "id" is required (enter it either in parameters or request body)
requestBody operations.Delete3DModelByIdRequestBody Query parameters can also be provided in the request body as a JSON object
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.

Response

Promise<operations.Delete3DModelByIdResponse>

Errors

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

deleteModelById

This endpoint will delete a specific custom model

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.deleteModelById("<value>");

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

run();

Parameters

Parameter Type Required Description
id string ✔️ The ID of the model to delete.
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.

Response

Promise<operations.DeleteModelByIdResponse>

Errors

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

getModelById

This endpoint gets the specific custom model

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.getModelById("<value>");

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

run();

Parameters

Parameter Type Required Description
id string ✔️ The ID of the custom model to return.
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.

Response

Promise<operations.GetModelByIdResponse>

Errors

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

listPlatformModels

Get a list of public Platform Models available for use with generations.

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.listPlatformModels();

  // 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.

Response

Promise<operations.ListPlatformModelsResponse>

Errors

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

uploadModelAsset

This endpoint returns presigned details to upload a 3D model to S3

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.model.uploadModelAsset({});

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

run();

Parameters

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

Response

Promise<operations.UploadModelAssetResponse>

Errors

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