Build a docs Q&A (RAG) app
Retrieval-augmented generation (RAG) lets a model answer from your PDFs, notes or wiki. You split documents into chunks, embed them into a vector store, retrieve the most relevant chunks per question, and pass them to the model with the question.
Recommended stack
Model
- Google Gemini 3.8 Flash: Free tier available; paid ~$0.75 in / $3.75 out per 1M until 2026-12-31, then $1.50/$7.50 (verified 2026-11-22)
- Anthropic Claude Sonnet 5.5: ~$2 in / $10 out per 1M tokens (verified 2026-11-22 on anthropic.com/pricing)
Framework
- LlamaIndex: Open source (free); LlamaParse cloud Pay-as-you-go $0/mo with 10K credits included, Pro $500/mo (400K credits) (verified 2026-11-15)
- LangChain / LangGraph: Open source (free); LangSmith Developer $0 (5k traces/mo), Plus $39/seat/mo (verified 2026-11-15)
- Chroma: Open source (free); Chroma Cloud Starter $0 + usage with $5 free credits, Team $250/mo (verified 2026-11-15)
- Supabase (Postgres + pgvector): Free: 500 MB database, 2 active projects, pauses after 1 week idle; Pro from $25/mo (verified 2026-11-15)
Hosting
No-code alternative
- Dify: Open source self-host free; Cloud Sandbox free (200 message credits), Professional $590/yr per workspace (verified 2026-11-15)
Rough monthly cost
$0–30/mo (Supabase/Chroma free tier + embeddings + tokens)Approximate. Tool prices checked 2026-11-15.Difficulty
IntermediateSome links may be affiliate links. Disclosure
Why this stack
- LlamaIndex and LangChain have ready-made loaders, chunkers and retrievers.
- Chroma runs locally for free; Supabase gives you Postgres with pgvector when you need a hosted database.
- Long-context models like Gemini Flash tolerate generous retrieved context cheaply.
Step-by-step
- Load 10 representative documents and write 5 test questions with known answers.
- Index them with LlamaIndex + local Chroma and check the answers.
- Tune chunk size and top-k until the test questions pass, then build a UI.
- Show source citations with every answer.
Common pitfalls
- Bad PDF text extraction is the most common failure. Inspect the extracted text first.
- Re-index when documents change.
- Don't expose private documents through a public endpoint without auth.
Related stacks
- Build an AI chatbot (Chatbot)
- Build a chat-with-your-PDFs app (Chat with your PDFs)
- Build an AI deep research agent (AI deep research agent)
Last updated 2026-11-22.