@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
28 lines • 1.82 kB
TypeScript
/**
* Turning a natural-language question into full-text search terms, for the lexical leg of
* `PgLexicalVectorStore`.
*
* With the `simple` text-search configuration (no stemming, no stop words; any language) a question
* searched as is either matches nothing (every word required) or, as "any word", ranks chunks full
* of "the / of / which / de / que" first. So the query side drops the stop words of the question's
* language(s) and keeps the meaningful terms, which the store then ranks by how many of them a chunk
* holds, rare terms weighing more (an IDF over the matching rows, BM25-style).
*/
/**
* Postgres' Snowball stop word lists (`tsearch_data/{english,portuguese,spanish}.stop`), minus
* one-letter words (never terms here) and words that carry meaning in a sibling language
* ("estado", "sentido").
*/
export declare const DEFAULT_STOP_WORDS: Readonly<Record<string, ReadonlySet<string>>>;
/**
* The meaningful terms of a question, in order, deduplicated, at most `max`: the stop words of the
* language(s) the question is written in are dropped (the language(s) with the most stop words in
* it, so "sea"/"son" stay terms in an English question although they are Spanish stop words). A
* question made only of stop words keeps them all (there is nothing else to search for).
*/
export declare function keywordTerms(query: string, max?: number, stopWords?: Readonly<Record<string, ReadonlySet<string>>>): string[];
/** Whether the user wrote search syntax (a quoted phrase, `-exclusion`) worth honoring as such. */
export declare function hasSearchSyntax(query: string): boolean;
/** `'a' | 'b' | …` for `to_tsquery` (terms are letter/digit runs, so quoting is enough). */
export declare function anyTermTsquery(terms: string[]): string;
//# sourceMappingURL=lexical-query.d.ts.map