Search.TextStore
Overview
Available Operations
- createTextStore - Create Store
- addTexts - Add Texts
- deleteTexts - Delete Texts
- searchTexts - Search Texts
- deleteTextStore - Delete Store
createTextStore
Create a new text store
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useSearchTextStoreCreateTextStoreMutation
} from "@meetkai/mka1/react-query/searchTextStoreCreateTextStore.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateTextStoreRequest | ✔️ | 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.CreateTextStoreResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.TextStoreErrorResponse | 400 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
addTexts
Add texts to a store with a group identifier
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useSearchTextStoreAddTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreAddTexts.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.AddTextsRequest | ✔️ | 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.AddTextsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.TextStoreErrorResponse | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
deleteTexts
Delete texts from a store by specific texts or group identifiers
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useSearchTextStoreDeleteTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreDeleteTexts.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteTextsRequest | ✔️ | 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.DeleteTextsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.TextStoreErrorResponse | 400, 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
searchTexts
Search for similar texts in a store
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useSearchTextStoreSearchTextsMutation
} from "@meetkai/mka1/react-query/searchTextStoreSearchTexts.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.SearchTextsRequest | ✔️ | 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.SearchTextResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.TextStoreErrorResponse | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
deleteTextStore
Delete a text store and all its data
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useSearchTextStoreDeleteTextStoreMutation
} from "@meetkai/mka1/react-query/searchTextStoreDeleteTextStore.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteTextStoreRequest | ✔️ | 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.DeleteTextStoreResponse>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.TextStoreErrorResponse | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |