import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.search.tables.searchData({
tableName: "<value>",
searchRequest: {
operations: [
{
type: "vector_search",
field: "embedding",
vector: [
0.11,
-0.06,
0.37,
],
distanceType: "cosine",
limit: 5,
},
{
type: "filter",
expression: "category = 'security'",
prefilter: true,
},
],
returnColumns: [
"id",
"content",
"category",
"rating",
],
},
});
console.log(result);
}
run();{
"operations_applied": [
"vector_search",
"filter",
"limit"
],
"results": [
{
"_distance": 0.102,
"category": "account",
"content": "Reset your password from the account settings page.",
"id": "doc_001",
"rating": 4.7
}
],
"search_time_ms": 18,
"total": 1
}Perform search operations on a table.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.search.tables.searchData({
tableName: "<value>",
searchRequest: {
operations: [
{
type: "vector_search",
field: "embedding",
vector: [
0.11,
-0.06,
0.37,
],
distanceType: "cosine",
limit: 5,
},
{
type: "filter",
expression: "category = 'security'",
prefilter: true,
},
],
returnColumns: [
"id",
"content",
"category",
"rating",
],
},
});
console.log(result);
}
run();{
"operations_applied": [
"vector_search",
"filter",
"limit"
],
"results": [
{
"_distance": 0.102,
"category": "account",
"content": "Reset your password from the account settings page.",
"id": "doc_001",
"rating": 4.7
}
],
"search_time_ms": 18,
"total": 1
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
Show child attributes
Was this page helpful?