Skip to main content

Crate quorumrag

Crate quorumrag 

Source
Expand description

§quorumrag

Quorum-based retrieval-augmented generation.

Instead of trusting a single retriever, QuorumRAG runs several retrievers (dense embeddings at different chunk sizes, plus BM25) over the same corpus, fuses their results with reciprocal rank fusion, clusters semantically similar evidence, and then keeps only the clusters that multiple retrievers agree on (the “quorum”). The surviving evidence is ranked and turned into a context string that can be handed to a generator.

The crate talks to a local Ollama server for both embeddings and generation.

§Quick start

use quorumrag::{Config, QuorumRag};

let config_str = std::fs::read_to_string("config.toml")?;
let config: Config = toml::from_str(&config_str)?;

let rag = QuorumRag::build(config).await?;
let answer = rag.answer("What is the capital of France?").await?;
println!("{answer}");

For finer control, QuorumRag::retrieve returns the ranked EvidenceClusters and the assembled context without invoking the generator.

Re-exports§

pub use config::Config;
pub use config::OllamaConfig;
pub use config::RetrieverConfig;
pub use config::RetrieverType;
pub use embedding::EmbeddingClient;
pub use generation::Generator;
pub use models::Candidate;
pub use models::Chunk;
pub use models::EvidenceCluster;
pub use models::Query;

Modules§

clustering
config
context
corpus
embedding
evaluation
generation
models
quorum
ranking
retrievers

Structs§

QuorumRag
A fully indexed QuorumRAG pipeline: retrievers, an embedder, and a generator wired together from a Config.
RetrievalResult
The outcome of a retrieval: the assembled context plus the structured evidence behind it.

Functions§

embed_chunks_parallel
Embed chunks in batches of Config::embed_batch, embedding each batch concurrently against the Ollama server at base_url.