Skip to content

Rag Retrieval Augmented Generation

PART 15 — RAG (Retrieval-Augmented Generation)

RAG is just a database query injected into a prompt string.

Example RAG Payload:

{
  "query": "What is the company refund policy?",
  "retrieved_chunks": [
    "Doc 14: Refunds are allowed within 30 days.",
    "Doc 92: No refunds on digital goods."
  ]
}
Constructed LLM Prompt:
You are a helpful assistant. Use ONLY the context below to answer the user.
<Context>
Doc 14: Refunds are allowed within 30 days.
Doc 92: No refunds on digital goods.
</Context>
User: What is the company refund policy?
The LLM generates: "You can get a refund within 30 days, except for digital goods."