Trueno-RAG
Pure-Rust Retrieval-Augmented Generation (RAG) pipeline built on Trueno compute primitives.
Features
- Pure Rust - Zero Python/C++ dependencies
- SIMD-Accelerated - Built on Trueno compute primitives
- Flexible Chunking - 6 strategies: Recursive, Fixed, Sentence, Paragraph, Semantic, Structural
- Hybrid Retrieval - Dense (vector) + Sparse (BM25) search
- Multiple Fusion - RRF, Linear, DBSF, Convex, Union, Intersection
- Reranking - Lexical, cross-encoder, and composite rerankers
- Evaluation Metrics - Recall, Precision, MRR, NDCG, MAP
- Query Preprocessing - HyDE, multi-query expansion, synonyms
Quick Start
use ;
// Build pipeline
let mut pipeline = new
.chunker
.embedder
.reranker
.fusion
.build?;
// Index documents
let doc = new.with_title;
pipeline.index_document?;
// Query with context
let = pipeline.query_with_context?;
println!;
Installation
[]
= "0.1"
Examples
# Basic RAG pipeline
# Compare chunking strategies
# Hybrid search with different fusion
# Retrieval metrics evaluation
Documentation
# Build and serve documentation book
# Or build only
Chunking Strategies
| Strategy | Use Case |
|---|---|
RecursiveChunker |
General purpose (default) |
FixedSizeChunker |
Uniform chunks |
SentenceChunker |
Preserve sentences |
ParagraphChunker |
Paragraph-level retrieval |
SemanticChunker |
Topic-based grouping |
StructuralChunker |
Markdown/structured docs |
Fusion Strategies
| Strategy | Description |
|---|---|
RRF |
Reciprocal Rank Fusion (default, most robust) |
Linear |
Weighted combination |
DBSF |
Distribution-based score fusion |
Convex |
Convex combination |
Union |
Maximum recall |
Intersection |
Maximum precision |
Development
# Run tests
# Fast tests (release mode)
# Lint
# Format
# Full CI check
# Coverage report
Architecture
Document -> Chunker -> Embedder -> Index (Dense + Sparse)
|
Query -> Preprocessor -> Retriever -> Fusion -> Reranker -> Context
License
MIT