Intermediate

Build a RAG Pipeline from Scratch

Build a working retrieval-augmented generation pipeline using ChromaDB for vector storage, a free local sentence-transformers embedding model, and the Claude API for generation — entirely open-source except for the final generation call.

~4.5h
0 / 7 steps
🚀
Intro

What you're building

Prerequisites: Python 3.9+, comfort with the command line, an Anthropic API key. No GPU required.

Retrieval-Augmented Generation (RAG) gives a language model access to a knowledge base at query time so it can ground its answers in real documents rather than relying only on what it memorized during training. The pipeline has two phases: an indexing phase (load documents, split into chunks, embed each chunk, store the embeddings) that runs once or periodically, and a retrieval phase (embed the incoming question, search for the closest chunks, hand them to the LLM) that runs on every query.

You'll build this with three free, open-source components — Python's text splitting, the sentence-transformers library for embeddings (runs locally, no API key needed), and ChromaDB as the vector store — and use the Claude API only for the final generation step, which keeps the indexing phase completely free to experiment with.

🔨

Install dependencies and prepare documents

🔨

Chunk your documents

🔨

Embed chunks and store them in ChromaDB

🔨

Retrieve and generate

🎯
Secret Mission

Secret Mission: Diagnose a retrieval failure

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock