Answer Feedback
Use this guide to send ratings of Wren AI answers from your own application. Every rating is attached to the exact answer it is about, so the people who review answer quality can see which answers missed and why.
Only in Essential Cloud plan and above. Also available on the Self-Hosted Version.
You don't need this API. Tell the assistant an answer is wrong and it reports it for you. See Rating an answer.
Get the answer ID
Every API answer comes with its own answer ID, returned in the id field of the response. For example, the id in this generate_sql response is the answer ID:
{
"id": "1fbc0d64-1c58-45b2-a990-9183bbbcf913",
"sql": "SELECT * FROM \"olist_customers_dataset\"",
"threadId": "9c537507-9cec-46ed-b877-07bfa6322bed"
}
Use the answer ID, not the threadId: one thread can hold many answers.
Send a rating
Send the rating from your backend, not from the browser, because the request needs your API key.
curl -X POST 'https://cloud.getwren.ai/api/v2/answers/1fbc0d64-1c58-45b2-a990-9183bbbcf913/feedback' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"rating": "down",
"topics": ["INCORRECT_DATA_RETRIEVED"],
"comment": "The total includes refunded orders.",
"correction": "Exclude orders with status refunded."
}'
The response includes a feedbackId. Keep it if you may need to update this rating later.
| Field | Required | Description |
|---|---|---|
rating | ✓ | up or down. |
topics | Reasons for the rating, from the feedback topics below. | |
comment | What the user says is wrong, in their own words. | |
correction | What the user says the right answer is. | |
feedbackId | Set it to update an earlier rating instead of creating a new one. |
Update a rating
Send the same request again with the feedbackId from the first response. The new values replace the earlier rating.
curl -X POST 'https://cloud.getwren.ai/api/v2/answers/1fbc0d64-1c58-45b2-a990-9183bbbcf913/feedback' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"feedbackId": "8a6f3d1e-2b47-4c09-9e1a-5d7c0b4f6a21",
"rating": "up"
}'
A rating can't be withdrawn.
Feedback topics
topics accepts these values. In the Wren AI web app, the reasons offered depend on the kind of answer, shown in the last column.
| Value | Label in Wren AI | Offered for |
|---|---|---|
SQL_GENERATION_FAILED | SQL generation failed | Text, Agentic |
INCORRECT_DATA_RETRIEVED | Incorrect data retrieved | Text, Agentic |
INCORRECT_AI_SUMMARY | Incorrect AI summary | Text |
FAILED_TO_ADHERE_INSTRUCTIONS | Failed to follow instructions | Text, Agentic |
FAILED_TO_ADHERE_SUMMARY_INSTRUCTIONS | Failed to follow summary instructions | Text |
FAILED_TO_ADHERE_SQL_PAIRS | Failed to follow question-SQL pairs | Text, Agentic |
INCORRECT_CHART_DATA | Incorrect chart data | Chart, Agentic |
INCORRECT_CHART_TYPE | Wrong chart type | Chart, Agentic |
CHART_GENERATION_FAILED | Chart generation failed | Chart |
DID_NOT_FOLLOW_CHART_INSTRUCTIONS | Did not follow chart instructions | Chart |
MISUNDERSTOOD_QUESTION | Misunderstood the question | Agentic |
ASKED_UNNECESSARY_CLARIFICATIONS | Asked unnecessary clarifications | Agentic |
SHOULD_HAVE_ASKED_CLARIFICATION | Should have asked for clarification | Agentic |
WRONG_FILE_FORMAT | Wrong file format | Agentic |
INCORRECT_FILE_CONTENT | Incorrect file content | Agentic |
DOWNLOAD_FAILED | Download failed | Agentic |
INCORRECT_OR_HALLUCINATED_ANSWER | Incorrect or hallucinated answer | Agentic |
INCOMPLETE_ANSWER | Incomplete answer | Agentic |
WRONG_APPROACH_OR_PLAN | Wrong approach or plan | Agentic |
TOO_MANY_STEPS | Too many steps | Agentic |
SKILL_MEMORY_ISSUE | Skill or memory issue | Agentic |
OTHER | Other | Text, Chart, Agentic |
Text means an answer without a chart, Chart an answer with a chart, and Agentic an answer from an Agentic project.
Current limits
- Ratings sent through the API don't appear in Thread tracing yet.
- There is no endpoint to read ratings back. If your application needs to show a user's earlier rating, store it on your side.