Phase 1 · Building with LLMs · Context & retrieval
Retrieval-augmented generation
Answer from your own documents instead of the model's memory.
Open this lesson Create a free account
Why it matters
A model knows the public internet up to its training date. It doesn't know your return policy, this season's prices or what your brand guide says about exclamation marks. Retrieval-augmented generation fixes that without retraining anything: look up the relevant passages, paste them into the prompt, and ask the model to answer from them. It's the most common pattern in business AI, from support bots to "chat with your docs" tools.
What you'll be able to do
- Explain the three steps of RAG: index, retrieve, generate
- Write a grounded prompt that puts retrieved documents before the question
- Tell the model to answer only from the documents and to say when they don't cover the question
- Build a working RAG function that returns an answer and its sources
Before this lesson
Next in this phase: Making RAG good