UCSC RAG
A retrieval-augmented chat system over course material that no public index can reach.
Retrieval
ChromaDB
Orchestration
LangChain
Serving
FastAPI
Generation
Gemini
The problem
Course material — slide decks, lecture notes, handouts — sits behind logins and never reaches a public index, so no general-purpose model has ever seen it. Questions about a specific course get answered from generic knowledge, confidently and often wrongly.
RAG is the right shape for this: keep the material in a private index, retrieve against it, and make the model answer from the retrieved passages rather than from memory.
End-to-end flow — question, retrieved passages, cited answer
Screen capture of a real query with the sources panel open
Architecture
- Ingest — document parsing and chunking, tuned so slide-deck structure survives the split
- ChromaDB — embedding store for the course corpus
- LangChain — retrieval and prompt orchestration
- Gemini — generation, constrained to the retrieved context
- FastAPI — chat endpoint and session handling
What mattered
Chunking dominated answer quality far more than the choice of generator. Slide decks in particular punish naive fixed-size splitting — a chunk that severs a slide from its heading loses the only context that made it findable.
Grounding has to be visible. Showing the retrieved passages next to the answer is what makes the system trustworthy enough to actually use for study, because a wrong answer becomes immediately checkable rather than plausible.
Retrieval inspector — query beside the chunks it pulled