← Back to Projects

Basic RAG Chatbot

beginnerPhase 03 · RAGChromaDBLangChain

Upload a PDF, chunk it, embed it, and chat with it. The 'hello world' of RAG — but done properly.

What you'll learn

  • Loading and chunking documents
  • Creating embeddings and storing them in a vector database
  • Retrieval + generation pipeline
  • Basic prompt engineering for grounded answers

Architecture

PDF upload → text extraction (PyPDF2/pdfplumber)
  → chunking (recursive, 500 tokens, 50 overlap)
  → embedding (OpenAI text-embedding-3-small or open-source)
  → store in ChromaDB
  → query: embed question → retrieve top-k → LLM generates answer with context

Steps

  1. Build a simple UI (Streamlit or Gradio) with a file upload widget
  2. Extract text from the PDF, split into chunks using recursive character splitter
  3. Embed all chunks, store in ChromaDB with metadata (page number, filename)
  4. On user query: embed the question, retrieve top-5 chunks
  5. Construct a prompt: "Answer based on: chunks. Question: query"
  6. Stream the LLM response
  7. Add a "sources" section that shows which chunks were used

← Back to the roadmap