@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
28 lines • 958 B
JavaScript
/**
* A {@link Retriever} over a store's own full-text index — the lexical half of a hybrid search, next to
* an {@link import('./embedding-retriever.js').EmbeddingRetriever} over the same store:
*
* ```ts
* const store = new PgLexicalVectorStore(db, { dimension: 1536 })
* const retriever = new HybridRetriever([
* new EmbeddingRetriever(embedder, store),
* new LexicalRetriever(store),
* ])
* ```
*
* Embeds nothing, so it reports no usage. `minScore` is not forwarded: a text rank is not a similarity,
* and a floor tuned for cosine would mean nothing on it.
*/
export class LexicalRetriever {
store;
constructor(store) {
this.store = store;
}
async retrieve(query, options = {}) {
return this.store.searchText(query, {
topK: options.topK ?? 5,
...(options.filter !== undefined ? { filter: options.filter } : {}),
});
}
}
//# sourceMappingURL=lexical-retriever.js.map