Skip to main content
FastAPI

RAG Document Q&A

Private document Q&A with hybrid retrieval, citation overlay, and multi-turn conversation.

RAG Document Q&A — ProjectsHub
9%
Retrieval Gain
<2s
Answer Latency
500+
Docs Supported
4.9★
User Rating
Overview

What is this project?

Upload any set of PDFs or text documents and ask questions in plain English. The system chunks documents using a recursive character splitter, embeds each chunk with OpenAI text-embedding-3-small, and stores vectors in a FAISS index on disk. At query time, a custom LangChain RetrievalQA chain performs MMR (Maximum Marginal Relevance) retrieval followed by a cross-encoder re-ranking step to surface the most relevant context before passing it to GPT-4. A conversation buffer memory window enables multi-turn follow-up questions that reference prior answers.

Key innovations: a hybrid sparse-dense retrieval step (BM25 + FAISS) that outperforms pure dense retrieval by 9% on domain-specific corpora, and a citation overlay that highlights the exact document passage used to generate each answer — critical for legal and compliance use cases where auditability matters.

Process

Build Timeline

Phase 01 Oct 2025
Ingestion & Embedding Pipeline
Built PDF loader, recursive character chunker, and OpenAI embedding pipeline. Benchmarked chunk sizes from 256 to 1024 tokens on retrieval quality.
Phase 02 Oct 2025
Hybrid Retrieval & Re-ranking
Implemented BM25 sparse retrieval, merged with FAISS dense results, and added cross-encoder re-ranking step — lifting retrieval precision by 9%.
Phase 03 Nov 2025
LangChain Chain & Conversation Memory
Wired custom RetrievalQA chain with conversation buffer window memory for multi-turn Q&A and built citation passage highlighting logic.
Phase 04 Nov 2025
Streamlit UI & FastAPI Deployment
Built Streamlit frontend with chat UI, deployed FastAPI backend on Railway, and added role-based document access control.
Get This Project

What's Included

₹5,999
one-time payment · lifetime access
  • Full source code (FastAPI backend + Streamlit UI)
  • Pre-built FAISS index on a sample legal corpus
  • Docker Compose deployment setup
  • LangChain custom chain explanation notebook
  • 90-minute video walkthrough
  • 60-day email support