@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
28 lines • 1.39 kB
TypeScript
import type { Passage, RetrieveOptions, Retriever } from '../spi/retriever.js';
import type { ChunkRecord } from './ingest.js';
export interface KeywordRetrieverOptions {
/** BM25 term-frequency saturation. Default 1.5. */
k1?: number;
/** BM25 length normalization, 0 (off) … 1 (full). Default 0.75. */
b?: number;
}
/**
* An in-memory BM25 lexical retriever — the keyword half of hybrid search. Feed it the SAME
* {@link ChunkRecord}s you upsert into the vector store (from `chunkDocuments`) so their chunk ids
* line up and {@link import('./hybrid-retriever.js').HybridRetriever} can fuse the two rankings. Full
* BM25: idf, term-frequency saturation (`k1`), and document-length normalization (`b`). Honors the
* same array-OR metadata {@link matchesFilter} as the vector store. Mirrors the reference exactly.
*/
export declare class KeywordRetriever implements Retriever {
private readonly docs;
private readonly documentFrequency;
private totalLength;
private readonly k1;
private readonly b;
constructor(options?: KeywordRetrieverOptions);
/** Index (or re-index) records. Re-adding an existing id replaces its posting and updates stats. */
add(records: ChunkRecord[]): void;
private remove;
retrieve(query: string, options?: RetrieveOptions): Promise<Passage[]>;
}
//# sourceMappingURL=keyword-retriever.d.ts.map