Skip to content

Latest commit

 

History

History
319 lines (236 loc) · 23.6 KB

File metadata and controls

319 lines (236 loc) · 23.6 KB

Beta.Rag.SearchIndexes

Overview

Available Operations

getDeploymentSummaries

Fetch all indexes available to a user

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.rag.searchIndexes.getDeploymentSummaries();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

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

Errors

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

registerDeployment

Register (or re-register) a search index

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.rag.searchIndexes.registerDeployment({
    name: "<value>",
    deployment: {
      type: "vespa",
      vespaVersion: "<value>",
      indexes: [],
      queryUrl: "https://joyful-granny.info",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaRagSearchIndexesRegisterDeployment } from "@mistralai/mistralai/funcs/betaRagSearchIndexesRegisterDeployment.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 betaRagSearchIndexesRegisterDeployment(mistral, {
    name: "<value>",
    deployment: {
      type: "vespa",
      vespaVersion: "<value>",
      indexes: [],
      queryUrl: "https://joyful-granny.info",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaRagSearchIndexesRegisterDeployment failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

unregisterDeployment

Delete all information about a 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.beta.rag.searchIndexes.unregisterDeployment({
    deploymentId: "240a5e63-fd68-4806-8290-04cce22b4c37",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaRagSearchIndexesUnregisterDeployment } from "@mistralai/mistralai/funcs/betaRagSearchIndexesUnregisterDeployment.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 betaRagSearchIndexesUnregisterDeployment(mistral, {
    deploymentId: "240a5e63-fd68-4806-8290-04cce22b4c37",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaRagSearchIndexesUnregisterDeployment failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

updateIndexMetrics

Update the metrics for a given index

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.rag.searchIndexes.updateIndexMetrics({
    deploymentId: "b0c2f463-8aef-437d-83ac-d4bfae874584",
    requestBody: {
      status: "offline",
      clearMetrics: false,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaRagSearchIndexesUpdateIndexMetrics } from "@mistralai/mistralai/funcs/betaRagSearchIndexesUpdateIndexMetrics.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 betaRagSearchIndexesUpdateIndexMetrics(mistral, {
    deploymentId: "b0c2f463-8aef-437d-83ac-d4bfae874584",
    requestBody: {
      status: "offline",
      clearMetrics: false,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaRagSearchIndexesUpdateIndexMetrics failed:", res.error);
  }
}

run();

Parameters

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

Errors

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