Skip to content

Latest commit

 

History

History
674 lines (491 loc) · 55.1 KB

File metadata and controls

674 lines (491 loc) · 55.1 KB

Beta.Skills

Overview

Available Operations

list

ListSkills

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.list();

  for await (const page of result) {
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsList } from "@mistralai/mistralai/funcs/betaSkillsList.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 betaSkillsList(mistral);
  if (res.ok) {
    const { value: result } = res;
    for await (const page of result) {
    console.log(page);
  }
  } else {
    console.log("betaSkillsList failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

create

CreateSkill

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.create({
    name: "<value>",
    definition: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsCreate } from "@mistralai/mistralai/funcs/betaSkillsCreate.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 betaSkillsCreate(mistral, {
    name: "<value>",
    definition: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsCreate failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

get

GetSkill

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.get({
    skillId: "<id>",
    version: 1,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsGet } from "@mistralai/mistralai/funcs/betaSkillsGet.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 betaSkillsGet(mistral, {
    skillId: "<id>",
    version: 1,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsGet failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

delete

DeleteSkill

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.delete({
    skillId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsDelete } from "@mistralai/mistralai/funcs/betaSkillsDelete.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 betaSkillsDelete(mistral, {
    skillId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsDelete failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

updateMetadata

UpdateSkill

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.updateMetadata("<id>", {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsUpdateMetadata } from "@mistralai/mistralai/funcs/betaSkillsUpdateMetadata.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 betaSkillsUpdateMetadata(mistral, "<id>", {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsUpdateMetadata failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
skillId string ✔️ N/A
requestBody operations.UpdateSkillRequest ✔️ N/A
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.Skill>

Errors

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

listVersions

ListSkillVersions

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.listVersions({
    skillId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsListVersions } from "@mistralai/mistralai/funcs/betaSkillsListVersions.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 betaSkillsListVersions(mistral, {
    skillId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsListVersions failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

createVersion

CreateSkillVersion

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.createVersion("<id>", {
    definition: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsCreateVersion } from "@mistralai/mistralai/funcs/betaSkillsCreateVersion.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 betaSkillsCreateVersion(mistral, "<id>", {
    definition: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsCreateVersion failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
skillId string ✔️ N/A
requestBody operations.CreateSkillVersionRequest ✔️ N/A
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.CreateSkillVersionResponse>

Errors

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

getVersion

GetSkillVersion

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.getVersion({
    skillId: "<id>",
    version: 1,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsGetVersion } from "@mistralai/mistralai/funcs/betaSkillsGetVersion.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 betaSkillsGetVersion(mistral, {
    skillId: "<id>",
    version: 1,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsGetVersion failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

updateVersionMetadata

UpdateSkillVersionMetadata

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.skills.updateVersionMetadata("<id>", 1, {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaSkillsUpdateVersionMetadata } from "@mistralai/mistralai/funcs/betaSkillsUpdateVersionMetadata.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 betaSkillsUpdateVersionMetadata(mistral, "<id>", 1, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaSkillsUpdateVersionMetadata failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description Example
skillId string ✔️ N/A
version number ✔️ N/A 1
requestBody operations.UpdateSkillVersionRequest ✔️ N/A
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.Skill>

Errors

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