Skip to content

latent.rag

Reusable RAG retrieval: vector search, BM25, and hybrid RRF fusion.

Submodules are lazy-loaded via latent._lazy. The [rag] extra gates the heavy retrievers + embeddings (chromadb, sentence-transformers, voyageai); the lightweight pieces (models, metrics, adaptive, components) work without it.

Quick start::

from latent.rag import RAGAdapter

rag = RAGAdapter(
    backend="hybrid",
    embedding_provider="openai",
    embedding_model="text-embedding-3-small",
)
await rag.index_documents(["# My Doc\nHello world"])
results = await rag.search("hello")