Skip to main content

Crate rag

Crate rag 

Source

Re-exports§

pub use aggregation::count_by;
pub use aggregation::group_by;
pub use aggregation::sum_by;
pub use chunker::FixedSizeChunker;
pub use chunker::ParagraphChunker;
pub use chunker::SentenceChunker;
pub use chunker::TextChunker;
pub use chunker::RecursiveChunker;
pub use chunker::SemanticChunker;
pub use chunker::StructuralChunker;
pub use contextual::ContextualRetrieval;
pub use dedup::content_jaccard;
pub use dedup::dedup_similarities;
pub use diversify::diversify;
pub use embeddings::EmbeddingModel;
pub use embeddings::EmbeddingRequest;
pub use embeddings::HttpEmbeddingModel;
pub use embeddings::OllamaEmbeddingModel;
pub use embeddings::OpenAIEmbeddingModel;
pub use errors::RagError;
pub use errors::Result;
pub use eval::EvalReport;
pub use eval::average_precision;
pub use eval::dcg_at_k;
pub use eval::evaluate;
pub use eval::graded_relevance;
pub use eval::idcg_at_k;
pub use eval::ndcg_at_k;
pub use eval::precision_at_k;
pub use eval::recall_at_k;
pub use eval::reciprocal_rank;
pub use eval::relevance_set;
pub use fuzzy::fuzzy_filter;
pub use fuzzy::is_fuzzy_match;
pub use fuzzy::levenshtein;
pub use graph::Community;
pub use graph::GraphEdge;
pub use graph::GraphNode;
pub use graph::GraphPath;
pub use graph::GraphPersisted;
pub use graph::GraphStore;
pub use graph_rag::EntityExtractor;
pub use graph_rag::EntityInfo;
pub use graph_rag::ExtractedEntity;
pub use graph_rag::GraphInfo;
pub use graph_rag::GraphRagEngine;
pub use graph_rag::GraphRagResult;
pub use graph_rag::GraphRagSnapshot;
pub use graph_rag::SeedEntityExtractor;
pub use graph_rag::SimpleEntityExtractor;
pub use hybrid::merge_hybrid;
pub use hybrid::rrf_fusion;
pub use index::DistanceMetric;
pub use index::FlatIndex;
pub use index::Index;
pub use index_hnsw::HnswIndex;
pub use index_ivf::IvfflatIndex;
pub use ingestion::CodebaseSource;
pub use ingestion::PdfSource;
pub use ingestion::WikiSource;
pub use ingestion::ExtractedDocument;
pub use ingestion::Source;
pub use keyword::Bm25Config;
pub use keyword::Bm25Index;
pub use keyword::FieldBm25Index;
pub use keyword::tokenize;
pub use mcp::RagMcpServer;
pub use quantize::QuantizationParams;
pub use quantize::QuantizedIndex;
pub use query_rewriting::QueryRewriter;
pub use rerank::PassthroughReranker;
pub use rerank::SimilarityReranker;
pub use rerank::rerank_similarities;
pub use rerank_external::CohereReranker;
pub use rerank_external::MixedBreadReranker;
pub use rerank_external::VoyageReranker;
pub use retriever::Retriever;
pub use sparse::SparseIndex;
pub use sparse::SparseVector;
pub use vector_store::Document;
pub use vector_store::InMemoryVectorStore;
pub use vector_store::JsonPersistentVectorStore;
pub use vector_store::MetadataFilter;
pub use vector_store::MinimalVectorDB;
pub use vector_store::Similarity;
pub use vector_store::VectorStore;
pub use vector_store::load_all_documents;
pub use wal::WalOp;
pub use wal::WriteAheadLog;
pub use wal::apply_ops;

Modules§

aggregation
chunker
contextual
Contextual retrieval: rewrite chunks with surrounding document context before embedding.
dedup
Near-duplicate suppression using word-set Jaccard similarity on chunk text.
diversify
embeddings
errors
eval
Retrieval-quality evaluation metrics: Recall@k, Precision@k, MRR, MAP, NDCG.
fuzzy
Levenshtein edit distance for fuzzy string matching.
graph
graph_rag
hybrid
Combine vector similarity hits with BM25 keyword scores.
id
Minimal unique identifier generator with no external dependencies.
index
index_hnsw
index_ivf
Inverted-file (IVF) index: cluster vectors by nearest centroid, probe top clusters only.
ingestion
keyword
Okapi BM25-style lexical scoring over in-memory documents.
mcp
quantize
Scalar Int8 vector quantization for ~4x memory reduction vs f32.
query_rewriting
LLM-based query rewriting and multi-query generation.
rerank
Optional re-ranking hook for similarity lists (default: identity).
rerank_external
External reranker implementations via HTTP APIs.
retriever
simd
SIMD-accelerated distance / similarity kernels.
sparse
Sparse vector representation and search (SPLADE-style lexical-semantic signals).
vector_store
wal
Append-only write-ahead log for incremental VectorStore updates.