0.00true
probability the statement is truereads true at 0.50 or more
truth 0.94label trueyour code acts now
Request#
{
"refund": {
"type": "truth",
"instructions": "Refund this automatically?",
"criteria": {
"true": "Charged twice for the same order, or charged for an order that failed",
"false": "Any other billing issue, including requests that need more details first"
}
}
}type"truth"required- The question type.
instructionsstring- The statement to test, or a question that is either true or false.
criteriaobject- Optional.
criteria.truesays what counts as true andcriteria.falsewhat counts as false. Use it when the line between them needs drawing; leave it out when the question is plain.
Response#
{
"refund": { "type": "truth", "truth": 0.94 }
}A Truth answer carries only type and truth, rounded to two decimals. There is no separate confidence field: the distance from 0.50 already says how sure the model is. 0.94 is confidently true, 0.06 confidently false, and 0.50 means the model cannot tell.
True or false#
Across DecisionNode (the playground, the console and these docs) a Truth answer is shown as its number followed by true or false: 0.94 true, 0.03 false, 0.61 true. The label is truth with a 0.50 threshold applied: 0.50 or more reads true, anything below reads false. It is a reading aid, not a field. The API returns only the number.
- What true and false mean is yours to define, in
criteria.trueandcriteria.falseon the request. The model answers against those two descriptions. - Where your code acts is also yours, and it is usually stricter than 0.50. The refund above acts at 0.80, which is why the card at the top of this page marks that point on the gauge.
Choosing a threshold#
Pick the threshold from the cost of each mistake. For refunds, a needless refund costs a little money and a missed one can cost the customer, so refund at 0.80 or more, re-check the unsure middle (0.40 to 0.80) with the full model, and reply without a refund below 0.40.
Where acting wrongly is expensive, as with an agent's tool call, raise the bar to 0.95 and take the safe action below it. Either way your code decides on its own, the moment the answer lands.
REFUND_AT, RECHECK_FROM = 0.8, 0.4
# first call: decide(ticket, model="decisionnode-flash-latest")
p = answers["refund"]["truth"]
if p >= RECHECK_FROM and p < REFUND_AT: # the unsure middle: ask the full model
p = recheck(ticket, model="decisionnode-latest")["refund"]["truth"]
if p >= REFUND_AT:
issue_refund(ticket)
else:
reply(ticket, template="no_refund")