Confidence-gated routing
TypeSafe’s pattern page: use confidence as a second axis. The Choice tells you the intent. Confidence tells you whether your code is allowed to obey it.
Voice banking example (theirs)
A voice command is classified into intents such as check_balance, approve_transfer, or other.
Their illustrated policy:
- Confidence below 0.6 (any intent) → support agent.
check_balanceat ≥ 0.6 → show the balance (recoverable mistake).approve_transferabove 0.85 → approve.approve_transferbetween 0.6 and 0.85 → ask the user to confirm.- Other intents → human.
The confidence page uses a similar story with a 0.5 floor and 0.9 for transfers. The spread is the lesson: numbers are domain-specific illustrations, not shipped defaults.
Implementing it
action = response.answers["intent"]
if action.confidence < 0.6:
route_to_support_agent(account_id)
elif action.choice == "check_balance":
show_balance(account_id)
elif action.choice == "approve_transfer":
if action.confidence > 0.85:
approve_transfer(account_id)
else:
ask_user_to_confirm("Just to confirm: you would like to approve this transfer?")
else:
route_to_support_agent(account_id)
That snippet is adapted from the official pattern page. Tune thresholds on labeled traffic. For Nouls, gate on the probability (or its distance from 0.5), not on a missing confidence field.
Sources
Public TypeSafe or adjacent documentation only. No private claims.