What it does
Long PDFs are painful to search by hand. This app embeds a document set, retrieves the closest chunks for a question, and asks an LLM to answer only from that context.
1Embed
The PDF set is split into chunks and embedded once, when the app starts.
2Retrieve
A question pulls back the chunks closest to it.
3Answer from context
The LLM is asked to answer only from those chunks.
4Scale out
One index over a fixed folder serves a shared corpus; per-user uploads move to per-session indexes or a vector database.
Design choices
- The index is built once at startup over
data/, which keeps answers fast for a shared corpus - Per-user uploads move to session-scoped indexes or an external vector database
- Embeddings are built at startup rather than per request, so cold starts on serverless hosts are the cost to plan around
What it demonstrates
- End-to-end RAG without hiding the architecture
- Separating retrieval from generation so models/corpus can swap independently
- Shipping a working UI, not only a notebook