How reaatech/hybrid-rag works
hybrid-rag is a TypeScript RAG monorepo: clients submit documents or queries through the CLI, MCP tools, or the pipeline API. The pipeline coordinates ingestion, embeddings, and hybrid retrieval over configurable vector stores; retrieval combines semantic and BM25 results, with optional reranking. Separate packages provide migration, evaluation, benchmarking, ablation, and observability. The README documents the overall capabilities; source-index references and excerpts support the detailed pipeline, chunking, retrieval, and adapter relationships shown here. Other subsystem internals were not sampled.
Main entry points: pipeline.ts RAG pipeline · hybrid-retriever.ts Hybrid retriever · runner.ts Evaluation runner · qdrant-client.ts 15 vector adapters
Components 24
User interfaces
- CLI
packages/hybrid-rag-cli/src/index.ts - MCP server
packages/hybrid-rag-mcp-server/src/mcp-server.ts - RAG pipeline
packages/hybrid-rag-pipeline/src/pipeline.ts - Core types
packages/hybrid-rag/src/domain.ts
Document ingestion
- Document loading
packages/hybrid-rag-ingestion/src/loader.ts - Preprocessing
packages/hybrid-rag-ingestion/src/preprocessor.ts - Chunking engine
packages/hybrid-rag-ingestion/src/chunking-engine.ts - Chunk strategies
packages/hybrid-rag-ingestion/src/chunking-strategies
Hybrid retrieval
- Embedding service
packages/hybrid-rag-embedding/src/embedding.ts - Hybrid retriever
packages/hybrid-rag-retrieval/src/fusion/hybrid-retriever.ts - Vector search
packages/hybrid-rag-retrieval/src/vector-search.ts - BM25 search
packages/hybrid-rag-retrieval/src/bm25/search.ts - BM25 tokenizer
packages/hybrid-rag-retrieval/src/bm25/tokenizer.ts - Fusion and reranking
packages/hybrid-rag-retrieval/src/fusion/engine.ts - Cross-encoder reranker
packages/hybrid-rag-retrieval/src/reranker.ts
Vector storage
- Store selection
packages/hybrid-rag-retrieval/src/vector-store-factory.ts - 15 vector adapters
packages/hybrid-rag-qdrant/src/qdrant-client.ts - Store migration
packages/hybrid-rag-migration/src/migration.ts
Evaluation and operations
- Evaluation runner
packages/hybrid-rag-evaluation/src/runner.ts - Retrieval metrics
packages/hybrid-rag-evaluation/src/metrics/retrieval.ts - Ablation studies
packages/hybrid-rag-evaluation/src/ablation/runner.ts - Performance benchmarks
packages/hybrid-rag-evaluation/src/benchmarking/db-benchmark.ts - Observability
packages/hybrid-rag-observability/src/logger.ts
Other components
- RAG user
Connections 23
- RAG user → CLI: runs commands
README.md - RAG user → MCP server: uses agent tools
README.md - RAG user → RAG pipeline: calls API
README.md - CLI → RAG pipeline: ingests and queries
- MCP server → RAG pipeline: provides RAG tools
- RAG pipeline → Chunking engine: chunks documents
packages/hybrid-rag-pipeline/src/pipeline.ts - RAG pipeline → Embedding service: generates embeddings
packages/hybrid-rag-pipeline/src/pipeline.ts - RAG pipeline → Hybrid retriever: runs retrieval
packages/hybrid-rag-pipeline/src/pipeline.ts - RAG pipeline → Store selection: creates store
packages/hybrid-rag-pipeline/src/pipeline.ts - Document loading → Preprocessing: prepares documents
- Chunking engine → Chunk strategies: dispatches strategy
packages/hybrid-rag-ingestion/src/chunking-engine.ts - Hybrid retriever → Vector search: searches vectors
packages/hybrid-rag-retrieval/src/fusion/hybrid-retriever.ts - Hybrid retriever → BM25 search: searches keywords
packages/hybrid-rag-retrieval/src/fusion/hybrid-retriever.ts - Hybrid retriever → Fusion and reranking: fuses results
packages/hybrid-rag-retrieval/src/fusion/hybrid-retriever.ts - BM25 search → BM25 tokenizer: tokenizes text
- Fusion and reranking → Cross-encoder reranker: reranks results
packages/hybrid-rag-retrieval/src/fusion/engine.ts - Vector search → Embedding service: embeds queries
packages/hybrid-rag-retrieval/src/vector-search.ts - Store selection → 15 vector adapters: selects provider
- Store migration → 15 vector adapters: moves vectors
- Evaluation runner → Retrieval metrics: computes scores
- Evaluation runner → RAG pipeline: evaluates queries
- Ablation studies → Evaluation runner: compares variants
- Performance benchmarks → 15 vector adapters: benchmarks latency