← Back to work
Lab build: a "chat with your docs" RAG that scores 27/27 retrieval hit@1 and runs live at $0/query
A portfolio lab build: a grounded 'chat with your data' RAG you drop into an existing Next.js app: 27/27 hit@1 on a 27-question eval, a 1.77s median answer at $0/query on the free Gemini path (or Claude Haiku 4.5 at $0.0035/query), with clickable citations and an honest 'I don't know'.

- Role
- Solo build (Claude Code)
- Stack
- Next.js · TypeScript · Gemini (free-tier gen + embeddings) · Claude Haiku 4.5 (optional paid) · Vercel
- 27/27 hit@1Retrieval accuracy (27-question eval)
- 1.77s · $0Median answer, end-to-end (live: free Gemini)
- 3.1s · $0.0035Median answer (Claude Haiku 4.5, paid path)
The problem
Teams want 'chat with your data' inside their existing app, but bolt-on chatbots hallucinate, cite nothing, and usually demand a vector database and extra infra to stand up.
The approach
- Built it as a single React component that drops into an ordinary Next.js 16 app. Swap the corpus, re-skin, ship.
- Embed the corpus once at build time into a small JSON index; at runtime each question is one embedding + a cosine top-k scan + one grounded generation, all in a single Route Handler. No vector DB, no Docker.
- Grounded every answer in the retrieved chunks and cited each claim inline with clickable [n] chips that scroll to the exact source passage; out-of-scope questions are answered honestly instead of guessed.
- Added an eval harness (npm run eval) that scores retrieval hit@1 / hit@5 over a 27-question golden set and exits non-zero if hit@5 drops below 80%.
The results
A cheap-to-run, serverless RAG feature (streamed, cited, and honest about what it doesn't know) that deploys free on Vercel and is guarded by a repeatable retrieval eval.
Have a process like this eating your team's time?
Book a 15-minute fit call →