An Enterprise-grade Retrieval-Augmented Generation (RAG) Engine designed to securely ingest, index, and query confidential documents using state-of-the-art hybrid search (Vector + Sparse) and cross-encoder reranking.
- Advanced Hybrid Search: Combines semantic search (ChromaDB + FastEmbed) and keyword search (BM25) using Reciprocal Rank Fusion (RRF).
- Precision Reranking: Uses
FlashRankcross-encoder to guarantee highly relevant context extraction. - Strict Guardrails: Built-in prompt engineering to prevent hallucinations and strictly restrict the LLM to context-only answers.
- Source Citations: Transparent answers with exact chunk-level metadata citations.
- Streaming UI: A modern, responsive React + Tailwind v4 interface for real-time generative chat.
- Secure & Local Ready: Easy drop-in for open-source local LLMs (e.g., Llama 3) or API providers (Groq/Gemini).
graph TD
subgraph Data Pipeline
Docs[Raw Documents: PDF/TXT] --> Loaders[Multi-Format Loaders]
Loaders --> Chunker[Token-Aware Recursive Splitter]
Chunker --> Dense[FastEmbed BGE-small-en]
Chunker --> Sparse[BM25 Indexer]
Dense --> Chroma[(ChromaDB)]
Sparse --> BM25Store[(Sparse Index)]
end
subgraph Retrieval Engine
Query[User Query] --> HybridSearch[Hybrid Search: RRF]
Chroma --> HybridSearch
BM25Store --> HybridSearch
HybridSearch --> TopK[Top-K Candidates]
TopK --> Reranker[FlashRank Reranker]
end
subgraph Generation & UI
Reranker --> Guardrails[Prompt with Guardrails]
Guardrails --> LLM[LLM Generator]
LLM --> UI[React Frontend]
end
- Docker and Docker Compose installed.
- A valid Groq API Key (or your preferred LLM provider).
Copy the sample environment file and add your credentials:
cp .env.example .env
# Edit .env and insert your GROQ_API_KEYSpin up both the backend API and the frontend application in one command:
docker-compose up --build- Frontend App: Open your browser and navigate to
http://localhost:5173. - Backend API Docs: Open
http://localhost:8000/docsto test endpoints via Swagger UI. - Upload Documents: Use the sidebar in the UI to upload PDF, DOCX, or TXT files.
- Ask Questions: Chat with the RAG engine. It will search your uploaded documents and cite its sources.
/src/api- FastAPI routes and server configuration./src/generation- LLM clients, RAG chains, and prompt guardrails./src/retrieval- Hybrid search engines, BM25 indexers, and Rerankers./src/vectorstores- Persistent vector database (ChromaDB) managers./src/ingestion- Document parsing and chunking logic./frontend- React SPA with Tailwind CSS v4 and Vite./data- Local persistence layer for ChromaDB, BM25 indices, and FlashRank cache.
- Never commit your
.envfile or API Keys. - Do not commit the
/datadirectory as it contains your indexed documents and cache. These are ignored via.gitignoreby default.
Built with ❤️ for Enterprise AI solutions.