Build a chat-with-your-PDFs app
"Talk to my PDFs" is the most common RAG project: upload manuals, papers, contracts or course notes and ask questions in plain English. It uses the same retrieval stack as our RAG guide, but PDFs add their own problems: messy text extraction, scanned pages, tables and the need to cite page numbers.
Uses the picker's RAG / docs Q&A stack, with advice specific to this use case.
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 has PDF loaders and node parsers that keep page numbers as metadata, so every answer can cite the page it came from.
- For complex PDFs (tables, multi-column layouts, charts), LlamaIndex's commercial LlamaParse service turns them into clean Markdown; it includes 10K free credits a month.
- Chroma runs locally for free while you test; move to Supabase (Postgres + pgvector) when you need a hosted database.
- Gemini Flash handles long retrieved context cheaply. If you send whole PDFs to the Gemini API instead of chunks, document tokens are billed at the image token rate.
- Dify's free Sandbox plan includes a knowledge base (50 documents, 50 MB) if you want a no-code version first.
Step-by-step
- Collect 10 representative PDFs and write 10 questions with known answers and page numbers.
- Extract the text and read it. If pages come out empty, they are scanned images and need OCR (or a parser like LlamaParse) before anything else.
- Chunk by page or section, keep the file name and page number as metadata, and embed into a local Chroma collection.
- Answer with the top 4-6 chunks and show citations like "manual.pdf, p. 12" under every answer.
- Check your 10 test questions, tune chunk size and top-k until they pass, then add an upload UI and deploy.
Common pitfalls
- Scanned PDFs have no text layer; plain loaders silently return blank pages.
- Tables and multi-column layouts often extract in the wrong order. Check the extracted text before blaming the model.
- Re-index when a PDF is replaced, or the bot will quote the old version.
- Uploaded PDFs can contain hidden prompt-injection text. Treat document content as untrusted.
- Keep private PDFs behind authentication; never expose the vector store publicly.
FAQ
Can I chat with PDFs without coding?
Yes. Dify (free Sandbox plan, 50 documents) and Voiceflow both offer knowledge bases you can upload PDFs to and chat with, no code needed.
Why does my PDF chatbot give wrong answers?
Usually because the text extraction is bad (scanned pages, tables, columns) or the chunks are too small or too large. Inspect the extracted text and test with questions you know the answers to.
Do I need a vector database?
For a handful of short PDFs you can paste the text straight into a long-context model. Past that, a vector store like Chroma (free, local) keeps costs and latency down.
Try it in the picker: Talk to my PDFs · Chat with my PDF lecture notes · Answer questions from our product manuals
Customise this stack in the picker →Related stacks
- Build a docs Q&A (RAG) app (RAG / docs Q&A)
- Build an AI chatbot (Chatbot)
- Build an AI customer support bot (AI customer support bot)
Last updated 2026-11-22.