LLM Application Development
Intermediate
4.5

Add Citations to RAG Answers

Make answers trustworthy by showing their sources.

0h 25m
1 lesson
1.2K students

What You'll Learn

Learning objectives will be added soon.

Tutorial Content

Why citations matter

A grounded answer users can verify beats a confident one they can't. Citations also make hallucinations obvious.

The technique

Attach an id to each retrieved chunk and instruct the model to cite them:

Use the sources below. Cite them inline like [1], [2].
[1] {chunk_1}
[2] {chunk_2}
Question: {q}

Then render each citation as a link back to the source. Bonus: check that every cited id actually appears in your retrieved set — a cheap guard against fabricated references.

Your Progress

Sign in to track your progress

Tags

RAG
Evaluation