SESSION 11

Session 11 — RAG (Retrieval Augmented Generation)

Chunk documents, embed them, build a vector store, add BM25, and answer questions with Claude.

3 hours6 exercises · 3 phases
What you'll be able to do by the end
  • ✓ Chunk documents three ways: by size, by sentence, and by structure
  • ✓ Turn text into embeddings and compute cosine similarity
  • ✓ Build a vector store and perform semantic search
  • ✓ Implement BM25 keyword search from scratch
  • ✓ Combine semantic and keyword search with Reciprocal Rank Fusion
  • ✓ Build a complete RAG pipeline that answers questions grounded in your documents

Prerequisites

The 3-phase arc

Phase 1 puts documents into a searchable index. Phase 2 adds a second retrieval method and merges them. Phase 3 wires retrieval to Claude for grounded answers.

Phase 1
Index
Phase 2
Retrieve
Phase 3
Generate

Exercises by phase

Phase 1 — Indexing
Chunk documents, generate embeddings, and build a vector store.
Phase 2 — Retrieval
Add keyword search with BM25 and combine both with hybrid retrieval.
Phase 3 — Generation
Wire everything together: retrieve relevant chunks and answer with Claude.

When you finish