DocumentBot RAG System
Anyone working with a large document collection runs into the same wall: keyword search doesn't understand what you're actually asking, and reading through everything manually doesn't scale. DocumentBot was built to solve that directly: upload documents, ask questions in natural language, get answers with citations back to the specific source chunks — and ask a follow-up without repeating context.
Document ingestion and chunking — PDF, DOCX, and TXT uploads processed asynchronously, split into 500-token chunks with 50-token overlap using tiktoken, so a chunk boundary doesn't sever the context a question depends on.
Embedding and vector storage — chunks embedded with LLaMA Text Embed v2 (1024-dimensional) and stored in Pinecone, partitioned by namespace. Retrieval and reranking — top 6 candidates matched by cosine similarity, reranked with BGE-Reranker-v2-m3 down to the top 3 most relevant.
Answer generation — Gemini 2.5 Flash generates the answer from the reranked chunks plus the last 5 messages of conversation history, returning source citations with similarity scores. Frontend — React + TypeScript with drag-and-drop upload, real-time job status tracking, and a dashboard surfacing upload stats and chat analytics.
Reranking alone moved retrieval relevance from 85% to 92% at top-3 — a direct, measured before/after comparison.
The retrieval step is where most RAG systems actually win or lose — not the language model doing the final write-up. Reranking retrieved chunks before generation is what took this from "usually finds the right chunk" to "reliably finds the right chunk."