Skip to content

Latest commit

 

History

History
312 lines (227 loc) · 24.5 KB

File metadata and controls

312 lines (227 loc) · 24.5 KB

Workflows.Deployments

Overview

Available Operations

listDeployments

List Deployments

Example Usage

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

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

async function run() {
  const result = await mistral.workflows.deployments.listDeployments({});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

getDeployment

Get Deployment

Example Usage

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

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

async function run() {
  const result = await mistral.workflows.deployments.getDeployment({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

getDeploymentLogs

Retrieve logs for a deployment (across all of its workers).

Use after/before/order on the first request to set the time range and sort order; for the next pages pass the cursor from the previous response (it remembers the range and order).

Example Usage

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

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

async function run() {
  const result = await mistral.workflows.deployments.getDeploymentLogs({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

streamDeploymentLogs

Stream logs for a deployment (all of its workers) via SSE.

Resume cursor comes from the Last-Event-ID header or last_event_id query param (header wins) and takes precedence over after; omit all to tail from the deployment start.

Example Usage

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

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

async function run() {
  const result = await mistral.workflows.deployments.streamDeploymentLogs({
    name: "<value>",
  });

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

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*