π Step 9: AI/LLM#260 / 291
Retrieval-Augmented Generation
Retrieval-Augmented Generation (RAG)
πOne-line summary
A pattern where the model retrieves external documents and answers using them as context.
π‘Easy explanation
An approach where the AI searches relevant docs first, drops them into context, and answers with them. An "open-book exam" pattern.
β¨Example
βQuestion
πRetrieve docs
πInject context
π¬Answer with citations
β‘Vibe coding prompt examples
>_
Design a basic RAG pipeline that indexes the internal wiki into a vector DB and answers queries β chunking, embedding, retrieval, answering.
>_
Write a system prompt + post-processing logic that requires citations on every RAG answer.
>_
When RAG quality is bad, what do you check, in order? Write a step-by-step diagnosis checklist (chunk size, embedding model, reranker, etc.).
Try these prompts in your AI coding assistant!