openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
40 lines (39 loc) • 1.47 kB
TypeScript
/** Returns true for low-value conversational tokens that should not drive FTS matching. */
export declare function isQueryStopWordToken(token: string): boolean;
/**
* Extract keywords from a conversational query for FTS search.
*
* Examples:
* - "that thing we discussed about the API" → ["discussed", "API"]
* - "之前讨论的那个方案" → ["讨论", "方案"]
* - "what was the solution for the bug" → ["solution", "bug"]
*/
export declare function extractKeywords(query: string, opts?: {
ftsTokenizer?: "unicode61" | "trigram";
}): string[];
/**
* Expand a query for FTS search.
* Returns both the original query and extracted keywords for OR-matching.
*
* @param query - User's original query
* @returns Object with original query and extracted keywords
*/
export declare function expandQueryForFts(query: string, opts?: {
ftsTokenizer?: "unicode61" | "trigram";
}): {
original: string;
keywords: string[];
expanded: string;
};
/**
* Type for an optional LLM-based query expander.
* Can be provided to enhance keyword extraction with semantic understanding.
*/
export type LlmQueryExpander = (query: string) => Promise<string[]>;
/**
* Expand query with optional LLM assistance.
* Falls back to local extraction if LLM is unavailable or fails.
*/
export declare function expandQueryWithLlm(query: string, llmExpander?: LlmQueryExpander, opts?: {
ftsTokenizer?: "unicode61" | "trigram";
}): Promise<string[]>;