RAG from First Principles · Part 1

One document through the RAG pipeline

Indexing, then a live query, step by step.

Document → Chunks
refund-policy.pdf
chunk 1
chunk 2
chunk 3
chunk 4
Chunks → Vectors
chunk 1 [0.12, -0.04, 0.88, …]
chunk 2 [-0.31, 0.50, 0.07, …]
chunk 3 [0.64, 0.22, -0.19, …]
Vectors → Vector store
Query → Retrieve nearest chunk
What is our refund window?
chunk 1 · best match
Retrieved chunk + Question → Prompt
Augmented prompt
Context “Refunds are accepted within 30 days of purchase…” (retrieved)
Question What is our refund window?
Prompt → LLM → Grounded answer
Grounded answer
You can request a refund within 30 days of purchase.
Source: refund-policy.pdf · chunk 1

Space play / pause  ·  back  ·  next