Basic

Citing what was used

An answer with no source is an answer no one can check. Retrieval already knows which chunks it used, so the citation is nearly free, and requiring it changes what a wrong answer costs a team.

What you will see

The instruction that makes a missing passage produce 'I do not know' instead of a guess.

About 1 min of reading

Try It

Build a marked prompt.

1

Mark the passages

ctx = '[1] We ship within two business days.\n[2] Damaged items get a full refund within 30 days.' print(ctx)

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Two marked passages - the marks are what the answer will reference.
2

The instruction

print('Answer using only the passages. Cite the number. If none answer, say you do not know.')

Before you run it, say out loud what it will print. Then open the answer.

What it prints
The instruction that makes a missing passage produce 'I do not know' instead of a guess.

Data Flow

Retrieved ids become citations.
1 Mark each chunk in the prompt
↓
2 Ask the model to reference marks
↓
3 Map marks back to sources
↓
4 Show the source with the answer
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

ctx = '[1] We ship within two business days.\n[2] Damaged items get a full refund within 30 days.' sets nothing on screen
print(ctx) Two marked passages - the marks are what the answer will reference.
Why this works
Cite the passage, not the file

A link to a file lets a reader land anywhere; a link to the passage lets them check the claim. The chunk id and its position give the second one, and that is what makes the answer reviewable.

Keep the answer short

A long answer hides which sentence came from which passage. Short answers with a citation each are checkable sentence by sentence, which is the point of the whole feature.

Examples

Pass the ids through

The retrieved chunks have ids. Put them in the prompt with a marker, ask the model to reference the marker, and map the marker back to the document. That round trip is the whole citation.

No source means say so

If nothing relevant was retrieved, the answer should be 'I do not have this' rather than a plausible guess. That instruction is what turns a silent fabrication into a visible gap.

Check the citation

Open the cited passage and read it against the answer. A citation that does not support the answer is a retrieval bug, and finding it is faster than finding the same bug in the answer's prose.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Keyword search beside it
Previous Lesson
Keyword search beside it
Next Lesson
Checking a retrieval system
Checking a retrieval system →