Skip to content

Retrieval-augmented generation (RAG)

Retrieval-augmented generation, or RAG, retrieves external evidence for a request and supplies that evidence to a generative model.

question: What is our enterprise cancellation window?
retrieve: the current enterprise cancellation policy
generate: answer from that passage
cite: link to the policy section

RAG is useful when answers depend on private, current, attributable, or frequently changing information.

  1. Indexing: load, parse, split, embed, and store the source material.
  2. Answering: retrieve, assemble context, generate, and cite.

The distinction matters during debugging. A generation prompt cannot repair missing or stale indexed content.

Continue with the full RAG, end to end chapter.