Skip to main content

Module rag

Module rag 

Source
Expand description

Paper-driven two-stage RAG engine.

Pipeline (per-query):

query: &str
  → Embedder::embed()                      [plug-in]
  → [Stage 1 · MemRL]  TurboQuantIndex ANN (top_k_candidates)
  → [Stage 2 · MemRL]  exact cosine rerank (top_k_rerank)
  → [RAPO]             BFS graph expansion + vector score
  → [combined score]   vector_weight·v + graph_weight·g
  → [SuperLocalMemory] quality filter (min thresholds)
  → sort desc, take k
  → [Memex(RL)]        context BFS for each result (max_context_entities)

References:

  • MemRL (2601.03192): two-stage ANN → exact rerank
  • RAPO (2603.02958): graph-neighbour expansion
  • Memex (2603.03561): context-entity sizing
  • SuperLocalMemory (2602.13398): quality threshold filtering
  • NN-RAG (2511.20333): retrieval quality over quantity

Re-exports§

pub use embedder::Embedder;
pub use smart_retrieval::RetrievalWeights;
pub use smart_retrieval::SmartRetrieval;
pub use smart_retrieval::SmartSearchResult;

Modules§

embedder
Embedding abstraction for the RAG pipeline.
smart_retrieval
Four-signal retrieval scoring for SmartVector.

Structs§

RagConfig
Configuration knobs for the RAG pipeline. All fields have defaults tuned to the paper recommendations.
RagEngine
Hybrid RAG engine backed by SQLite.
RagResult
One result row from the RAG engine.

Enums§

RagError