Answer feedback
POST /v1/generation/feedback records your feedback on one answer: what went wrong, in one of
seven categories, with a comment if you want one.
Request
Send it with a management keyManagement keyThe key that runs your account through the API: the balance, the usage history, your keys, guardrails, observability. It never calls a model.More on API keys →, read from OPENDUNES_MANAGEMENT_KEY. An API keyAPI keyThe key you create and send with every request that calls a model.More on API keys → gets a 401. The
API keys guide shows how the two kinds of key differ. The feedback is recorded
against the request its handle names; Receipt reads the same
request back.
A customer asks Souk Bot the price of a kaftan, and the answer quotes last season's. Yacine
takes the handle from that answer's X-Generation-Id header and reports it as
incorrect_response.
| Field | Needed | You send |
|---|---|---|
generation_id | yes | the receipt handle the answer carried in its X-Generation-Id header |
category | yes | latency, incoherence, incorrect_response, formatting, billing, api_error or other |
comment | no | what happened, in your words, up to 1 000 characters |
You send feedback only on your own account's requests: any other handle is a 404. The handle in each sample is an example of the shape; put the one your answer carried in its place.
import json
import os
import urllib.request
MANAGEMENT_KEY = os.environ["OPENDUNES_MANAGEMENT_KEY"]
ADDRESS = "https://opendunes.com/v1/generation/feedback"
GENERATION_ID = "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG"
feedback = {
"generation_id": GENERATION_ID,
"category": "incorrect_response",
"comment": "Quoted last season's price for the kaftan.",
}
request = urllib.request.Request(
ADDRESS,
data=json.dumps(feedback).encode(),
headers={
"Authorization": "Bearer " + MANAGEMENT_KEY,
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request) as response:
print(json.load(response)["data"]["success"])Response
200 OK.
| Field | Holds |
|---|---|
data | the outcome |
success | in data: true when the feedback was recorded |
What it cost
Free. Sending feedback is never charged.
Errors
error.code carries the status, and error.message says why.
| Status | When |
|---|---|
| 400 | generation_id or category is missing, category is not one of the seven, or comment passes 1 000 characters |
| 401 | the key is missing, wrong, revoked or expired, or it is an API key |
| 404 | no request of your account carries this handle |
Last modified on