Skip to main content

@wildix/wim-knowledge-base-client > SearchKnowledgeBaseCommand

SearchKnowledgeBaseCommand class

Search a knowledge base by its ID and return the chunks that match the query with its score

Signature:

export declare class SearchKnowledgeBaseCommand extends SearchKnowledgeBaseCommand_base 

Extends: SearchKnowledgeBaseCommand_base

Example

Use a bare-bones client and the command you need to make an API call.

import { KnowledgeBaseClient, SearchKnowledgeBaseCommand } from "@wildix/wim-knowledge-base-client"; // ES Modules import
// const { KnowledgeBaseClient, SearchKnowledgeBaseCommand } = require("@wildix/wim-knowledge-base-client"); // CommonJS import
const client = new KnowledgeBaseClient(config);
const input = { // SearchKnowledgeBaseInput
companyId: "STRING_VALUE",
knowledgeBaseId: "STRING_VALUE", // required
query: "STRING_VALUE", // required
searchStrategy: "bm25" || "vector" || "hybrid",
searchLimit: Number("int"),
searchThreshold: "low" || "medium" || "high",
useQueryOptimization: true || false,
sessionUser: "STRING_VALUE",
sessionUri: "STRING_VALUE",
};
const command = new SearchKnowledgeBaseCommand(input);
const response = await client.send(command);
// { // SearchKnowledgeBaseOutput
// results: [ // SearchKnowledgeBaseResultsList // required
// { // SearchKnowledgeBaseResultItem
// chunkId: "STRING_VALUE", // required
// documentId: "STRING_VALUE", // required
// documentTitle: "STRING_VALUE", // required
// documentUrl: "STRING_VALUE", // required
// dataSourceId: "STRING_VALUE", // required
// dataSourceType: "files" || "confluence" || "gdrive", // required
// score: Number("double"), // required
// fullTextScore: Number("double"),
// semanticScore: Number("double"),
// documentHierarchy: [ // StringList
// "STRING_VALUE",
// ],
// content: "STRING_VALUE", // required
// metadata: "DOCUMENT_VALUE",
// },
// ],
// metadata: { // SearchResultMetadata
// sessionId: "STRING_VALUE", // required
// duration: Number("int"), // required
// },
// };