Skip to main content

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"
}
FieldTypeRequiredDescription
request_idstringyesThe request_id returned by /v1/ask.
ratingstringyesgood or bad.
commentstringnoUp 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​

HTTPcodeWhen
404request_not_foundThe request_id does not exist, belongs to another tenant, or is not a successful answer given to an API key.
422invalid_feedbackrating other than good/bad, or a comment that is too long or contains control characters.
422invalid_requestInvalid 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.