Skip to content

Search.TextStore

Overview

Available Operations

createTextStore

Create a new text store

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.search.textStore.createTextStore({
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    createTextStoreRequest: {
      storeName: "product_catalog",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { searchTextStoreCreateTextStore } from "@meetkai/mka1/funcs/searchTextStoreCreateTextStore.js";

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

async function run() {
  const res = await searchTextStoreCreateTextStore(sdk, {
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    createTextStoreRequest: {
      storeName: "product_catalog",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("searchTextStoreCreateTextStore failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useSearchTextStoreCreateTextStoreMutation
} from "@meetkai/mka1/react-query/searchTextStoreCreateTextStore.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CreateTextStoreRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.CreateTextStoreResponse>

Errors

Error TypeStatus CodeContent Type
errors.TextStoreErrorResponse400application/json
errors.HTTPValidationError422application/json
errors.APIError4XX, 5XX*/*

addTexts

Add texts to a store with a group identifier

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.search.textStore.addTexts({
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    addTextsRequest: {
      texts: [
        "Machine learning is a subset of artificial intelligence",
        "Python is a popular programming language",
        "Deep learning uses neural networks",
      ],
      group: "tech_articles",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { searchTextStoreAddTexts } from "@meetkai/mka1/funcs/searchTextStoreAddTexts.js";

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

async function run() {
  const res = await searchTextStoreAddTexts(sdk, {
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    addTextsRequest: {
      texts: [
        "Machine learning is a subset of artificial intelligence",
        "Python is a popular programming language",
        "Deep learning uses neural networks",
      ],
      group: "tech_articles",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("searchTextStoreAddTexts failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useSearchTextStoreAddTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreAddTexts.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.AddTextsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.AddTextsResponse>

Errors

Error TypeStatus CodeContent Type
errors.TextStoreErrorResponse404application/json
errors.HTTPValidationError422application/json
errors.APIError4XX, 5XX*/*

deleteTexts

Delete texts from a store by specific texts or group identifiers

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.search.textStore.deleteTexts({
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    deleteTextsRequest: {
      groups: [
        "outdated_articles",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { searchTextStoreDeleteTexts } from "@meetkai/mka1/funcs/searchTextStoreDeleteTexts.js";

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

async function run() {
  const res = await searchTextStoreDeleteTexts(sdk, {
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    deleteTextsRequest: {
      groups: [
        "outdated_articles",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("searchTextStoreDeleteTexts failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useSearchTextStoreDeleteTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreDeleteTexts.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteTextsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.DeleteTextsResponse>

Errors

Error TypeStatus CodeContent Type
errors.TextStoreErrorResponse400, 404application/json
errors.HTTPValidationError422application/json
errors.APIError4XX, 5XX*/*

searchTexts

Search for similar texts in a store

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.search.textStore.searchTexts({
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    searchTextRequest: {
      query: "programming languages",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { searchTextStoreSearchTexts } from "@meetkai/mka1/funcs/searchTextStoreSearchTexts.js";

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

async function run() {
  const res = await searchTextStoreSearchTexts(sdk, {
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
    searchTextRequest: {
      query: "programming languages",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("searchTextStoreSearchTexts failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useSearchTextStoreSearchTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreSearchTexts.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.SearchTextsRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.SearchTextResponse>

Errors

Error TypeStatus CodeContent Type
errors.TextStoreErrorResponse404application/json
errors.HTTPValidationError422application/json
errors.APIError4XX, 5XX*/*

deleteTextStore

Delete a text store and all its data

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.search.textStore.deleteTextStore({
    storeName: "<value>",
    xApiKeyId: "<id>",
    xUserId: "<id>",
    xExchangeJwtExternalUserId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { searchTextStoreDeleteTextStore } from "@meetkai/mka1/funcs/searchTextStoreDeleteTextStore.js";

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

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

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useSearchTextStoreDeleteTextStoreMutation
} from "@meetkai/mka1/react-query/searchTextStoreDeleteTextStore.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteTextStoreRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.DeleteTextStoreResponse>

Errors

Error TypeStatus CodeContent Type
errors.TextStoreErrorResponse404application/json
errors.HTTPValidationError422application/json
errors.APIError4XX, 5XX*/*