RAG Document Chatbot
- Role
- Generative AI / RAG Project
- Timeline
- Academic Project (PDC)
- Status
- Completed - deployed
- Category
- Generative AI / RAG
A Streamlit-based retrieval-augmented generation chatbot that answers questions using context retrieved from an indexed PDF source document.
This Streamlit application implements a retrieval-augmented generation (RAG) pipeline that allows users to ask natural-language questions about a source PDF document. The system chunks and indexes the document using LangChain, retrieves relevant passages for each query using HuggingFace embeddings and a vector index, then passes the retrieved context to Groq's LLM to generate a grounded answer.
The problem
Large language models answer questions from parametric memory, which means they can hallucinate information and cannot answer questions about documents they have never seen. RAG addresses this by retrieving the relevant passages first and conditioning the model's response on those passages, keeping answers grounded in the actual document content.
Approach
Document ingestion
The source document (reflexion.pdf) is loaded using LangChain's PyPDFLoader. The document is split into overlapping chunks using RecursiveCharacterTextSplitter to preserve context across chunk boundaries.
Embedding and indexing
Chunks are embedded using HuggingFace Embeddings (via LangChain's HuggingFaceEmbeddings). VectorstoreIndexCreator builds an in-memory vector index from these embeddings.
Retrieval and generation
At query time, a RetrievalQA chain retrieves the most relevant document chunks and passes them as context to ChatGroq, the LangChain integration for Groq's LLM API. The model generates an answer grounded in the retrieved passages. Answers are constrained to what is recoverable from the document, reducing unsupported claims.
Interface
The application is built with Streamlit and styled with a dark custom CSS theme and a branded logo. It is deployed on Vercel.
Stack
Framework
RAG Pipeline
LLM
Embeddings
Document Processing
Deployment
What it changes
- End-to-end RAG pipeline: PDF ingestion → chunking → embedding → retrieval → grounded generation.
- Answers grounded in the indexed source document rather than parametric model memory.
- Deployed and publicly accessible at pdc-rag-chatbot.vercel.app.
- Dark-themed Streamlit interface with branded presentation.
The LLM and answer quality depend on the content of the indexed PDF (reflexion.pdf) and the Groq model in use. Questions outside the scope of the document may produce incomplete or inaccurate answers.