What is retrieval-augmented generation (RAG)?
RAG is a pattern where relevant documents are retrieved at query time and given to an LLM as context, so it answers from real sources instead of its trained memory. The loop: chunk your documents, embed them into vectors, store them, embed the user's query, retrieve the closest chunks, and generate an answer grounded in them. It's how you build assistants over private or fast-changing knowledge without retraining the model, and it reduces hallucination when done well.
📘 Learn this properly: RAG in One Lesson (Answer From Your Own Data) →