Skip to content

Latest commit

 

History

History
845 lines (620 loc) · 66.7 KB

File metadata and controls

845 lines (620 loc) · 66.7 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 */*

createDeployment

Create 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.createDeployment({
    name: "<value>",
    spec: {
      githubUrl: "https://ugly-parade.com",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

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

updateDeployment

Update 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.updateDeployment({
    name: "<value>",
    updateDeploymentRequest: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

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

deleteDeployment

Delete 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.deleteDeployment({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

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

stopDeployment

Stop 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.stopDeployment({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

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

startDeployment

Start 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.startDeployment({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

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

restartDeployment

Restart 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.restartDeployment({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

Errors

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

listDeploymentWorkers

List Deployment Workers

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.listDeploymentWorkers({
    name: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

run();

Parameters

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

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