Answer Feedback
A thumbs up or down under an answer, with a short list of reasons for a thumbs down, and an optional Regenerate.
≈ 603 tokens per use (tool 277 · guidance 266 · typical payload 60)How token costs are estimated
Example: Answer Feedback
What changed in the EU AI Act this year?
When to use
- You finished a substantive answer (research, a plan, a recommendation) and want to know how it landed.
- The host keeps ratings, or you'll use them to improve the next answer in the conversation.
When not to use
- The reply is a line or a confirmation. A rating adds noise.
- You're waiting for a decision. Show the Approval Request or a question instead.
- It would appear under every message. Offer it once per substantive answer.
How it works
Two icon buttons (and a third for Regenerate, when you set regenerate). A thumbs up sends at once. A thumbs down opens a short list of reasons as chips, and Send sends the ones the user ticked, or none. After a rating the row is replaced by a one-line record, like "Thanks. Too long, Out of date.", and focus moves to it.
The reasons are a closed list, so the next turn gets something typed to act on instead of a bare "unhelpful". The defaults are Not accurate, Wrong source, Too long and Out of date; set reasons to what could actually be wrong with this answer (for a sourced answer: wrong source, out of date).
How the agent should use it
- Name the likely failures in
reasons, 2–6 of them, a few words each. - On a down rating, fix what was named (shorten, re-check sources, refresh) and don't ask why again.
- On
regenerate, answer the question afresh, differently from before. Setregenerateonly when a second try is cheap. - Echo
answerId(a message id) so a stored rating points at its answer.
Interaction
| Control | Sends | Notes |
|---|---|---|
| Thumbs up | rate with rating: "up" | Immediately |
| Thumbs down | Opens the reasons | Toggle it to close, or press Escape |
| Send | rate with rating: "down" and reasons (ids) | reasons is empty when none were ticked |
| Regenerate | regenerate | Once. Only shown with regenerate: true |
Each result also carries answerId when you set one.
Installation
npx shadcn@latest add https://your-site.com/r/answer-feedback.json
Usage
import { AnswerFeedback } from "@/components/genui/answer-feedback"
export const catalog = {
rate_answer: AnswerFeedback,
} satisfies GenUICatalogimport { tool } from "ai"
import { answerFeedbackTool } from "@/components/genui/answer-feedback.schema"
const tools = {
// No execute(): the call is completed by the user's rating in the UI.
[answerFeedbackTool.name]: tool({
description: answerFeedbackTool.description,
inputSchema: answerFeedbackTool.inputSchema,
}),
}Schema
| Prop | Type | Notes |
|---|---|---|
answerId | string? | Which answer this rates. Echoed in the result |
reasons | { id, label }[]? | 2–6, labels up to 28 characters. Default: not accurate, wrong source, too long, out of date |
regenerate | boolean | Show Regenerate. Default false |
Host props: status, onResult, result and className.
Source
Assumptions
What an answer is based on (assumptions, unknowns and limits), with a way for the user to correct them so the agent can redo the work.
Lifecycle States
What a generated component looks like when its data is old or incomplete, there's nothing to show, its offer has ended, a newer version replaced it, or the call failed.