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-10-14)
- Anthropic Claude Sonnet 5.5: ~$2 in / $10 out per 1M tokens (verified 2026-10-14 via third-party price trackers)
Framework
- LlamaIndex: Open source (free); cloud tiers (not verified - check site)
- LangChain / LangGraph: Open source (free); LangSmith paid tiers (not verified - check site)
- Chroma: Open source (free); hosted cloud (not verified - check site)
- Supabase (Postgres + pgvector): Free tier + paid plans (not verified - check site)
Hosting
No-code alternative
- Dify: Open source self-host; cloud tiers (not verified - check site)
Rough monthly cost
$0–30/mo (Supabase/Chroma free tier + embeddings + tokens)ApproximateDifficulty
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.