How parthsharma1011/productionrag_hybrid_retrieval_bm25_cli works
This is a Python RAG command-line application. Users provide PDF or text documents for ingestion, then ask questions in an interactive session: the pipeline chunks and indexes documents, retrieves candidates through dense and sparse search, optionally reranks them, and sends context plus conversation history to Gemini for an answer. The README also documents persistent indexes, query caching, memory, and reranker comparison. Relationships follow the sampled CLI and pipeline code; unsampled subsystem details are represented only where documented.
Main entry points: pipeline.py RAG pipeline · main.py Interactive CLI · hybrid_search.py Hybrid RRF search · vector_store.py FAISS vector store
Components 16
CLI and orchestration
- Interactive CLI
main.py - RAG pipeline
rag/pipeline.py - Runtime configuration
config.py
Document indexing
- PDF and text files
- Document chunking
core/document_processor.py - FAISS vector store
core/vector_store.py - BM25 index
core/bm25_store.py - Persistent indexes
core/vector_store.py
Hybrid retrieval
- Gemini embeddings
core/embeddings.py - Hybrid RRF search
core/hybrid_search.py - Cosine reranker
core/reranker.py
Answer and context
- Query cache
core/cache.py - Conversation memory
core/memory.py - Answer
Other components
- User
- Gemini generation API
Connections 20
- User → Interactive CLI: enters questions
main.py - Interactive CLI → RAG pipeline: starts and routes
main.py - Interactive CLI → PDF and text files: accepts files
main.py - RAG pipeline → Document chunking: loads documents
rag/pipeline.py - Document chunking → PDF and text files: extracts and chunks
core/document_processor.py - RAG pipeline → FAISS vector store: adds chunks
rag/pipeline.py - RAG pipeline → BM25 index: adds chunks
rag/pipeline.py - FAISS vector store → Gemini embeddings: embeds chunks
core/vector_store.py - RAG pipeline → Persistent indexes: saves or loads
rag/pipeline.py - RAG pipeline → Hybrid RRF search: searches query
rag/pipeline.py - Hybrid RRF search → FAISS vector store: retrieves dense
core/hybrid_search.py - Hybrid RRF search → BM25 index: retrieves sparse
core/hybrid_search.py - RAG pipeline → Cosine reranker: reranks candidates
rag/pipeline.py - Cosine reranker → Gemini embeddings: embeds query and docs
core/reranker.py - RAG pipeline → Query cache: checks and stores answers
rag/pipeline.py - RAG pipeline → Conversation memory: formats and updates history
rag/pipeline.py - RAG pipeline → Gemini generation API: generates answer
rag/pipeline.py - Gemini generation API → Answer: returns text
- RAG pipeline → Interactive CLI: returns answer
main.py - Runtime configuration → RAG pipeline: sets runtime options
rag/pipeline.py