What you'll learn: By the end of this lesson you will be able to explain why the goal of an AI interface is calibrated trust rather than maximum trust, model an answer as segments with citations and sources, render citation markers and a sources list that a keyboard and a screen reader can use, say what a citation does and does not prove, choose how to show uncertainty and failure, and design a feedback control that is accessible, honest about what it does and easy to ignore.
Picture two research assistants. The first hands you a confident paragraph and says "trust me". The second hands you the same paragraph with a footnote on each claim, a page number, and a note on the one sentence they were unsure about. You may well use both answers. Only the second lets you check, and so only the second lets you decide how much to rely on it. An AI answer is a paragraph from an assistant that sounds equally confident when it is right and when it is wrong. The interface is where the footnotes either appear or do not.
The running example is the product question assistant of a grocery marketplace (the front end of the ShopStream marketplace used in this course). A shopper asks "does this oat milk contain nuts?" and gets an answer drawn from the product page and the store's allergen policy. The page has three jobs: show where each claim came from, be honest when it does not know, and collect feedback without nagging. The tool-calling side of the same chat is in the lesson Tool Calls and Generative UI, and the architecture around the model in AI-Powered Front-End Architecture (both named as plain text).
The core idea
- Aim for calibrated trust. Google's People + AI Guidebook says users should have "the appropriate level of trust given what the system can and cannot do". Too little means they ignore a useful tool; too much means they act on its mistakes.
- A citation is a pointer the interface must make checkable. It tells the user where text came from. It does not by itself prove the claim follows from the text, so the page shows the source next to the claim.
- Feedback is a feature with a contract. The user should know what is collected, get an acknowledgement, and be told what will happen next.
Calibrating trust
The Microsoft Research guidelines for human-AI interaction (18 guidelines, validated in a study published at CHI 2019) include several that bear on this page: make clear what the system can do (G1) and how well it can do it (G2), make clear why it did what it did (G11), support efficient correction (G9), scope services when in doubt (G10), encourage granular feedback (G15), and convey the consequences of user actions (G16).
The PAIR guidebook adds three cautions that matter for design:
- The best explanation is often partial. Full explanations are usually impractical; show enough to let the user judge.
- Confidence displays can mislead. Show confidence only when it changes decisions; a categorical display (High, Medium, Low) needs defined cutoffs and a stated action for each; the guide calls numeric confidence "risky" because it presumes a baseline understanding of probability.
- Stakes change the amount of explanation. The guidebook says to explain more in high-stakes situations. An allergen question is one.
Admitting a possible error costs some trust in that answer. PAIR's reasoning is that it protects long-term reliance on the product.
Citations in the UI
What providers return
Citations arrive as structured data, not as prose. Anthropic's citations feature, for documents you provide, returns citation objects such as char_location (with cited_text, document_index, document_title, start_char_index, end_char_index), page_location (page numbers, 1-indexed) and content_block_location. Its web search tool always includes citations with a url, a title and cited_text of up to 150 characters. OpenAI's web search returns url_citation annotations with a url, a title and start_index and end_index.
Illustration 1: the minimal example
One answer segment with one citation, in the shape Anthropic documents for a plain text document (the product values are illustrative):
{
"type": "text",
"text": "This oat drink is made without nuts.",
"citations": [
{
"type": "char_location",
"cited_text": "Ingredients: oats, water, rapeseed oil, salt.",
"document_index": 0,
"document_title": "Oat drink 1 L, product page",
"start_char_index": 120,
"end_char_index": 165
}
]
}
The front end gets a sentence, the exact quoted text, which document it came from and where. That is enough to render a marker, a quote preview and a link.
Figure 1. From retrieval to a checkable answer
How to read this: the accent box is the front end's own model of an answer. The markers, the sources list and the feedback control all read from it, so they cannot disagree.
Figure 2. The data the UI keeps
How to read this: store the quoted text with the citation. The source can change later; the quote is what the model was shown.
Showing them
- Markers are controls. A numbered marker next to a claim should be a link or button with a name that says more than "1", such as "Source 1: Oat drink 1 L, product page". Keep the sources list in the page as ordinary content.
- Show the quote. Put
cited_textin the sources list so the user can compare it with the claim without leaving the page. - Display is not optional where the provider says so. Anthropic says that when API outputs are displayed directly to end users, citations must be included to the original source. OpenAI says to show inline citations as "prominent, clickable links" when an interface displays web results or information from them. Read the current terms for your provider.
- Streaming changes the order. In Anthropic's streaming format each citation arrives as a
citations_deltathat adds one citation to the current text block, so a marker can appear after its text. Reserve space for markers or add them without moving what the reader is reading.
What a citation does and does not prove
Anthropic's documentation says that because the API extracts cited_text itself, citations are "guaranteed to contain valid pointers to the provided documents". That is a statement about the pointer: the quoted text exists in the document you supplied. Whether the sentence the model wrote follows from that quote is a separate question the pointer cannot answer. That is why the quote sits beside the claim, and why a high-stakes answer should be easy to check, not merely decorated with markers. (This distinction is this lesson's reasoning from the documentation, not a provider statement.)
Illustration 2: the realistic example
The shopper's question has two parts, and the page answers them differently (the product data is illustrative):
- "Does it contain nuts?" Answer: "No nuts are listed in the ingredients [1]." The quote shows the ingredients line. A second line says "Made in a facility that also handles nuts [2]", quoting the allergen policy. Both markers are keyboard-focusable and open the same sources list.
- "Is it organic?" The retrieved pages say nothing. The page shows "I could not find this in the product pages. Check the label or ask support." with no marker, rather than a confident guess. This follows guideline G10, scope services when in doubt, and PAIR's advice to return control to the user when the system fails.
Uncertainty and failure
PAIR describes three kinds of error: system errors, user errors, and context errors, where the system "makes incorrect assumptions about what the user wants". It says messages about limitations should inform the user "as specifically as possible", and that a good path forward includes feedback options and handing control back to the user.
Figure 3. What the answer area shows
a relevant source?"} A -->|"no"| N["Say nothing was found
+ where to look next"] A -->|"yes"| C["Answer + markers
+ sources list with quotes"] C --> H{"High-stakes topic?"} H -->|"yes"| W["Add: check the quoted source"] H -->|"no"| D["Done"]
How to read this: the decision is made before the answer is drawn, and the "nothing found" branch is a designed state, not an error. The policy itself (which topics are high stakes) is a product decision.
Do not turn the model's wording into a number. If you show confidence, use a small set of levels with a stated action each, as PAIR suggests, and test the display with real users before launch.
Feedback
PAIR distinguishes implicit feedback (collected from behaviour; users should be told and given a chance to opt out) from explicit feedback (ratings, thumbs, free text). Its cautions read like a checklist: do not collect data silently; do not just say thank you, show how the feedback helps; do not promise improvements on a timeline you cannot meet; do not interrupt more than you must. Guideline G15 asks for granular feedback and G16 for conveying consequences.
Figure 4. Giving feedback on one answer
How to read this: the reasons are optional and appear after the first press. The last message says what happens next; the wording must match what actually happens.
For the control itself, MDN says aria-pressed turns a button into a toggle button, and warns: "Do not change the contents of the label on a toggle when the state changes". Keep "Helpful" and "Not helpful" as fixed labels and let aria-pressed carry the state. The acknowledgement is a status message: WCAG 4.1.3 says status messages should be exposed through role or properties so assistive technology can present them "without receiving focus". The lesson Accessible Forms and Dynamic Content covers live regions.
Illustration 3: a failure
The shopper presses thumbs down, the request fails, and the control still shows the thumb as pressed with no message. The shopper believes feedback was recorded. The control must show a failed state ("Could not send. Try again") and keep the choice, as in the loading and error states of Error, Loading and Empty States. A feedback button that lies is worse than none.
Trade-offs
| Choice | Gain | Cost |
|---|---|---|
| Inline markers on every claim | Claims are checkable | Visual noise; layout shifts while streaming |
| Sources list only | Clean answer text | Harder to tell which claim a source supports |
| Show the quote in the list | Fast comparison | More space, more content to maintain |
| Categorical confidence | Clear actions per level | Needs cutoffs you can defend |
| Numeric confidence | Looks precise | PAIR calls it risky; easy to misread |
| Thumbs plus optional reason | Cheap and granular | Low response rates; reasons need triage |
| Prompting for feedback on every answer | More data | Interrupts; trains users to dismiss it |
Build it
This lesson has no lab. There is nothing to run and no output was captured. As a paper exercise, take one real answer from your product, write its segments, citations and sources as the JSON of Illustration 1, and draw the sources list by hand for a keyboard-only user. Then check the markup against the name, role and value rules in the semantic HTML and ARIA lesson linked below.
In practice: the product question assistant
This is a realistic scenario, not a case history. It is a composite built from common production patterns. It describes no specific company or product, and every number in it is an illustrative assumption.
The situation
The assistant answers product questions in a side panel. Answers are fluent paragraphs with no sources, and a thumbs-up and thumbs-down pair appears under every answer. Support receives complaints about allergen answers that "sounded sure" and nobody can tell where a claim came from. The thumbs data is not read by anyone.
Starting architecture
Figure 5. Fluent text and an unread thumb
How to read this: the warning boxes lose information. The answer shows no origin, and the rating has no answer id, reason or owner.
Options considered
| Option | What it fixes | What it costs | Risk |
|---|---|---|---|
| Add a disclaimer line | Sets expectations | One sentence | Ignored; fixes nothing about checking |
| Citations plus a "nothing found" state | Claims become checkable | Retrieval returns structured sources; a sources list | Users trust a marker without reading the quote |
| Citations plus granular feedback with an owner | Closes the loop | A triage process | Reasons pile up unread |
The decision
| Field | Decision record |
|---|---|
| Context | Fluent answers without origin; allergen questions are high stakes; feedback is unowned. |
| Decision | Keep citations with the quote in a sources list; a designed "nothing found" state; a "check the quoted source" line on allergen topics; thumbs as toggle buttons with optional reasons and a status message; an owner reviews reasons weekly. |
| Consequences, good | Claims can be checked; unknown is visible; feedback reaches someone. |
| Consequences, bad | More UI to build and maintain; more retrieval work; a weekly review. |
| Revisit when | Retrieval coverage changes, reasons show a pattern, or the provider's citation format changes. |
Rollout and verification
- Ship the data model first: answer, segments, citations with
cited_text, sources. - Test the states: answer with sources, nothing found, failed feedback.
- Check with a keyboard and a screen reader that each marker has a meaningful name and that the status message is announced without moving focus.
- Read twenty answers by hand and check each quote against its claim.
The 2 a.m. failure
The catalogue team updates product pages overnight. Stored citations point at character offsets in the old page text, and the sources list shows a quote that no longer appears on the page. Shoppers think the answer is wrong.
First three checks: (1) compare the stored cited_text with the current page; (2) check whether the UI re-reads the source by offset instead of showing the stored quote; (3) see whether the source link still resolves. Mitigation: show the stored quote with the date it was taken, and mark a changed source. Follow-up: store a source version with each citation.
Architect's notes
- Store the quote with the citation. It is what the model saw, whatever the source does later.
- Design "nothing found" and "failed to send" as states. They happen daily.
- Put the check next to the claim. A footnote people never open does not calibrate anything.
- Say what feedback does. If nobody reads it, do not imply someone does.
Common mistakes
- Treating a valid citation as proof that the claim follows from the quote.
- Markers that are only a digit, with no accessible name.
- A thumb that changes its label when pressed.
- Numeric confidence with no basis.
- A feedback control that shows success when the request failed.
- Asking for feedback on every answer.
Key takeaways
- Design for calibrated trust: enough information to judge, not maximum confidence.
- An answer is segments, citations and sources; keep the quote with each citation.
- A citation proves where text came from, not that the claim follows; put the quote next to the claim.
- "Nothing found" and "could not send" are designed states.
- Feedback needs a clear contract: what is collected, a real acknowledgement, a stated next step.
- Toggle buttons keep a fixed label and expose state; acknowledgements are status messages.
Practice exercises
Exercise 1: Starter (30 min). Write the JSON for an answer with two segments and three citations to two sources, using the field names from Illustration 1.
Exercise 2: Intermediate (2 hours). Mock the sources list as plain HTML for a keyboard-only user. Name each marker, and say where focus goes when it is activated.
Exercise 3: Advanced (half day). Write a one-page feedback contract: what is collected, who reads it, what the user is told, and how the user opts out. Compare it with PAIR's cautions and list what you would change.
Related reading
In this course:
- Error, Loading and Empty States: designed states for "nothing" and "failed".
- Accessible Forms and Dynamic Content: status messages and focus.
- Semantic HTML, ARIA and Accessible Names: names for markers and buttons.
Planned in this module, named as plain text: AI-Powered Front-End Architecture, Tool Calls and Generative UI, Prompt Injection and Output Safety in the UI.
Official documentation
- People + AI Guidebook: Explainability and Trust, Feedback and Control and Errors and Graceful Failure: calibrated trust, feedback types, error kinds.
- Microsoft Research: Guidelines for Human-AI Interaction: the 18 guidelines.
- Anthropic: Citations and Web search tool: citation objects, display note.
- OpenAI: Web search:
url_citationannotations and display requirement. - MDN: aria-pressed: toggle buttons.
- WCAG 2.2: Understanding Status Messages: announcements without focus.