fastrag.retrieval.bm25#

Lexical retrieval through the SDK’s LexicalStore contract.

Classes

BM25Retriever(*, store[, filter])

Rank query terms with the store's BM25 implementation.

class fastrag.retrieval.bm25.BM25Retriever(*, store, filter=None)[source]#

Bases: Retriever

Rank query terms with the store’s BM25 implementation.

store is any LexicalStore: the same open vector store a sibling VectorRetriever searches, when the backend supports both, or a separate lexical database when it does not.

Parameters:
async retrieve(query, *, k=5)[source]#

Return at most k lexical matches.

Parameters:
Return type:

list[Document]