Brain labPlay → read → next · ~8 min

Tutorials · Chapter C (3/4) · ~8 min

RAG — look it up, then answer

Play → read → next

RAG makes the AI fetch relevant notes first, then write an answer from them.

Playground

RAG: look it up, then answer

Ask with RAG on, then toggle RAG off to catch guessing.

School rulesPhones stay in bags during class.
Cookie recipeBake cookies at 180°C for 12 minutes.
Store hoursWe open 9am–8pm every day.

Recap

What you just did

You compared closed-book guessing with RAG: retrieve relevant docs, then generate an answer grounded in them.

Teach

How it works

Retrieval-Augmented Generation means:

  1. Retrieve — find chunks that match the question (often via embeddings)
  2. Augment — put those chunks into the prompt as open-book material
  3. Generate — write the answer using that material

When a policy changes, you update the docs — you don’t always retrain the whole model.

Use it

When you'd use this

  • Company FAQ / employee handbook bots
  • Personal note Q&A
  • Product docs that change every sprint

Watch out

Watch out

If retrieval pulls the wrong chunk, the answer can sound right and still be wrong. Bad backpack → bad trip.

Try next

Try this next

Ask a question with RAG off (pure guess) vs on (with a short note attached). Spot where the facts come from.