Week 3 · Deep dive · ~2 hours

Agents That Read (RAG) — every line, explained

Retrieval turns “meaning” into math you can search. Today you build a tiny vector store with real numpy — chunks, embeddings, cosine similarity, top-k — one line at a time.

👆 Tap a line → plain English 🔎 go deeper → extra detail # dim italics = a comment
Chunk
a small piece of a document
Embedding
text turned into a vector
Similarity
how close two vectors point
Top-k
the k most similar chunks
Run it right here. This week uses real numpy in your browser. Run cells in order, 1 → 5. The first Run downloads Python + numpy once (~15 MB), then it's cached.
The one honest simplification: a real embedding comes from an API and captures meaning (so “grades” matches “grading” even with no shared words). Ours is a bag-of-words count so it runs offline — the retrieval math (cosine similarity, top-k) is exactly the real thing. Swap embed() for an API call and nothing else changes.
↩ Back to Week 3 Week 4 deep dive →