Portfolio RAG Assistant
Sole builder — Next.js, API routes, RAG pipeline
A retrieval-augmented assistant with grounded answers and clickable source citations. Try it on the home page.
Architecture
Problem
Most portfolios claim RAG experience. Almost none let a hiring manager verify it live. A working retrieval pipeline that cites sources and refuses out-of-scope questions is the honest proof.
What I built
A RAG pipeline inside this Next.js site: a knowledge base curated from my real repos and CV, embedded with Gemini embeddings, retrieved by cosine similarity (top 6), and answered by Gemini grounded only in the retrieved chunks. Thinking tokens disabled to prevent budget exhaustion on free tier. Input-validated, with a distributed per-IP limit when Redis is configured, and answers refuse gracefully when nothing relevant is found.
Engineering decisions
- 01
Every knowledge chunk carries a sourceUrl, and the API returns sources with each answer — citations are part of the contract, not decoration.
- 02
A minimum-similarity threshold gates generation: below it the assistant says it does not know rather than letting the model improvise.
- 03
The grounding prompt is server-side. The chat input cannot override it.
- 04
Thinking tokens are disabled (thinkingBudget:0) on gemini-2.5-flash to prevent thinking from consuming the entire output budget on the free tier.
- 05
Knowledge-base embeddings are computed once per server instance and cached; only the query is embedded per request.
Outcome
A live, inspectable RAG demo. Open devtools, read the network calls, click the citations. Knowledge base and retrieval code are public in this repo.
