Reading the response
Python
r = c.ask(state, questions)
r["team"] # one answer
r["team"].choice # fields by name; r["team"].raw is the JSON object
r.values # {"team": "billing", "amount": 89.0, "done": True, ...} every answer as a plain value
r.certainty # {"team": 0.94, "amount": 0.99, "done": 0.97, ...} how sure, per answer
r.cost_usd # what this request cost, in US dollars
r.balance_usd # your balance after it
r.usage # tokens: input_tokens, output_tokens, cost
r.timing # Timing(client_ms=..., server_ms=...)
r.model # "simo-1-pro"
r.request_id # quote it to supportFields per answer type
Every answer has .result (its value in the natural type) and .certainty (in [0, 1]), so code can treat all types alike:
| Type | Fields | .result |
.certainty |
|---|---|---|---|
| noul | noul |
noul >= 0.5 |
max(noul, 1 - noul) |
| choice | choice, probabilities, confidence, args |
the option | its probability |
| score | score, probabilities, legend, confidence |
the expected level | confidence |
| fill | value, parsed, valid, confidence, check, tokens |
parsed, else value |
confidence |
| extract | value / values, valid, confidence, check, tokens |
values or value |
confidence |
| locate | coordinates, center, image_size, valid, confidence |
center |
confidence |
To group answers by type, use r.nouls, r.choices, r.scores, r.fills and r.extracts.
Act on probabilities
Decisions are calibrated: when one says 0.8 it is right about 80% of the time. Act above a high threshold, escalate in the middle, refuse or ask a person below:
Python
p = r["refund"].noul
if p > 0.95: auto_refund()
elif p > 0.6: ask_a_person()
else: reply_no_refund()For a Choice, look at the probability of the chosen option, or at the whole distribution when two options are close:
Python
a = r["team"]
if a.probabilities[a.choice] < 0.8:
route_to_triage_queue()The raw JSON
Over HTTP, answers sit under answers, keyed by question id. See Response format for the complete shape.
JSON
{
"model": "simo-1-pro",
"answers": {
"refund": {"type": "noul", "noul": 0.991},
"team": {"type": "choice", "choice": "billing",
"probabilities": {"billing": 0.962, "shipping": 0.021, "tech": 0.017}, "confidence": 0.962}
},
"usage": {"input_tokens": 212, "output_tokens": 0, "cost": 0.00000636}
}