Prompt Engineering
Intermediate

Retrieval-Augmented Generation

Use retrieved documents to ground answers in current product, codebase, and company knowledge.

40 min
3 sections
rag
retrieval
grounding
1
2
3

01. Use RAG for private or changing knowledge

Section 1 of 3

A model cannot reliably know your latest architecture, runbooks, customer contracts, internal APIs, or incident history. Retrieval-augmented generation fetches relevant context at request time and asks the model to answer from that context.

text
RAG answer prompt:
Answer the user's question using only the provided sources.
If the sources do not contain the answer, say what is missing.
Include source IDs for claims that affect implementation.

<source id="runbook-api-rollback">
...
</source>

<source id="incident-2026-06-18">
...
</source>
Back to Course