Skip to content

Latest commit

 

History

History
447 lines (324 loc) · 32.9 KB

File metadata and controls

447 lines (324 loc) · 32.9 KB

Ai.Search

Overview

Available Operations

ingest

Ingest content into managed search index

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.ingest({
    content: "<value>",
    type: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchIngest } from "@aerostack/sdk-node/funcs/aiSearchIngest.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchIngest(sdk, {
    content: "<value>",
    type: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchIngest failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

query

Search managed index

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.query({
    text: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchQuery } from "@aerostack/sdk-node/funcs/aiSearchQuery.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchQuery(sdk, {
    text: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchQuery failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

delete

Delete item by ID

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.delete({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchDelete } from "@aerostack/sdk-node/funcs/aiSearchDelete.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchDelete(sdk, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchDelete failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

deleteByType

Delete all items of a type

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.deleteByType({
    type: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchDeleteByType } from "@aerostack/sdk-node/funcs/aiSearchDeleteByType.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchDeleteByType(sdk, {
    type: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchDeleteByType failed:", res.error);
  }
}

run();

Parameters

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

Errors

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

listTypes

List distinct types and counts

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.listTypes();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchListTypes } from "@aerostack/sdk-node/funcs/aiSearchListTypes.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchListTypes(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchListTypes 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<operations.ListTypesResponseBody>

Errors

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

configure

Update search configuration

Example Usage

import { SDK } from "@aerostack/sdk-node";

const sdk = new SDK({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await sdk.ai.search.configure({
    embeddingModel: "multilingual",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SDKCore } from "@aerostack/sdk-node/core.js";
import { aiSearchConfigure } from "@aerostack/sdk-node/funcs/aiSearchConfigure.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await aiSearchConfigure(sdk, {
    embeddingModel: "multilingual",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("aiSearchConfigure failed:", res.error);
  }
}

run();

Parameters

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

Errors

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