Skip to content
AgenticAIWiki
  1. Learn
  2. Part 6
  3. 32. Designing AI products
  4. 32.2

Lesson 32.2 · 2 of 6 · 5 min read · Reviewed 24 Nov 2026

Showing uncertainty and sources

By the end, you can

  • Show uncertainty and sources in AI interfaces.
  • Help users judge when to trust an answer.

Trust cues

Cue Good practice
Sources Inline citations that open the exact passage (7.2)
Scope “I answer questions about your account and our policies.”
Not knowing “I couldn’t find this in the policy. Contact billing.”
Freshness “Based on documents updated 3 Nov 2026.”
AI disclosure Make clear the answer is AI-generated

Showing uncertainty

  • Prefer words over numbers unless you have calibrated scores. “I’m not sure; two policies seem to conflict” is honest and useful.
  • Show alternatives when the question is ambiguous: “Did you mean the EU or the US plan?”
  • Mark partial answers: “I found the price but not the delivery date.”

Design the ‘no answer’ path

A system that says “I don’t know” and points somewhere useful earns more trust than one that always answers. Make sure the prompt allows it (chapter 7) and the UI presents it well, not as an error.

Check it works

Test with real users: can they tell good answers from bad ones? Do they click citationsCitations: References in an answer that point to the exact source passages supporting each claim.? Track how often users correct or report answers.

Key points

  • Users need cues to decide how much to trust an answer: sources, confidence and scope.
  • Show citations next to the claims they support, and make them easy to open.
  • Say clearly when the system doesn't know, or when an answer is outside what it covers.
  • Avoid fake precision: an invented confidence percentage misleads more than it helps.
Hands-on labRuns in the Playground

Render an answer with citation markers

Turn cited answer blocks into text with numbered markers, a source list and a flag for claims with no source.

You will have: A render() function and the rendered answer with three sources and one flagged sentence.

Steps

  1. Give each distinct source a number the first time it appears.
  2. Add markers like [1] after each cited sentence.
  3. Flag sentences with no citation when citations are required.
  4. Run it and read the result as a user would.

Done when

  • Three sources are listed, numbered 1 to 3.
  • The uncited sentence ends with (no source).
  • The script prints uncited sentences: 1.

Open in the Playground No API key needed.

Starter code (Python)
# Render an answer with numbered citation markers and a source list, and flag claims with no source.
answer = [
    {"text": "Refunds are available within 30 days of delivery.", "citations": [{"doc": "Refund policy", "quote": "within 30 days of delivery"}]},
    {"text": "Opened items can be returned if they are unused.", "citations": [{"doc": "Returns guide", "quote": "unused opened items"}]},
    {"text": "Most refunds arrive in about a week.", "citations": []},
    {"text": "Sale items are final.", "citations": [{"doc": "Refund policy", "quote": "Sale items are final sale"}]},
]
REQUIRE_CITATIONS = True


def render(blocks):
    sources, lines, uncited = [], [], 0
    for b in blocks:
        marks = ""
        # TODO: give each distinct (doc, quote) a number and add markers like [1] after the sentence
        # TODO: if a sentence has no citations and REQUIRE_CITATIONS is on, add " (no source)" and count it
        lines.append(b["text"] + marks)
    out = " ".join(lines) + "\n\nSources:\n" + "\n".join(f"[{i + 1}] {d}: \"{q}\"" for i, (d, q) in enumerate(sources))
    return out, uncited


text, uncited = render(answer)
print(text)
print("uncited sentences:", uncited)
Show a solution
# Render an answer with numbered citation markers and a source list, and flag claims with no source.
answer = [
    {"text": "Refunds are available within 30 days of delivery.", "citations": [{"doc": "Refund policy", "quote": "within 30 days of delivery"}]},
    {"text": "Opened items can be returned if they are unused.", "citations": [{"doc": "Returns guide", "quote": "unused opened items"}]},
    {"text": "Most refunds arrive in about a week.", "citations": []},
    {"text": "Sale items are final.", "citations": [{"doc": "Refund policy", "quote": "Sale items are final sale"}]},
]
REQUIRE_CITATIONS = True


def render(blocks):
    sources, lines, uncited = [], [], 0
    for b in blocks:
        marks = ""
        for c in b["citations"]:
            key = (c["doc"], c["quote"])
            if key not in sources:
                sources.append(key)
            marks += f"[{sources.index(key) + 1}]"
        if not b["citations"] and REQUIRE_CITATIONS:
            marks = " (no source)"
            uncited += 1
        lines.append(b["text"] + marks)
    out = " ".join(lines) + "\n\nSources:\n" + "\n".join(f"[{i + 1}] {d}: \"{q}\"" for i, (d, q) in enumerate(sources))
    return out, uncited


text, uncited = render(answer)
print(text)
print("uncited sentences:", uncited)
Quick checkWhich design best helps users check an AI answer about company policy?
How sure are you?
Pick an answer and how sure you are