Rate an answer: POST /v1/feedback
Records whether the answer of a /v1/ask was right. The administrator sees the ratings in the panel's History and can turn a good answer into an example, which then guides the next questions.
Request
{
"request_id": "req_0f3c9a7d2b6e4f1a8c5d0e9b7a6f3c21",
"rating": "good",
"comment": "That was exactly it"
}
| Field | Type | Required | Description |
|---|---|---|---|
request_id | string | yes | The request_id returned by /v1/ask. |
rating | string | yes | good or bad. |
comment | string | no | Up to 500 characters, without control characters. It is stored and shown as plain text and is never sent to the LLM. |
Response 204
No body. Sending the rating again for the same request_id replaces the previous one.
Errors
| HTTP | code | When |
|---|---|---|
| 404 | request_not_found | The request_id does not exist, belongs to another tenant, or is not a successful answer given to an API key. |
| 422 | invalid_feedback | rating other than good/bad, or a comment that is too long or contains control characters. |
| 422 | invalid_request | Invalid body or request_id outside the req_ + 32 hexadecimal characters format. |
Example
curl -sS -X POST "https://app.datafala.com.br/v1/feedback" \
-H "Authorization: Bearer $DATAFALA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"request_id": "req_0f3c9a7d2b6e4f1a8c5d0e9b7a6f3c21", "rating": "bad", "comment": "Cancelled orders should have been excluded"}'
A good practice is to show 👍 / 👎 next to the result on your screen and send the feedback when the user clicks.