AI Gateway 新增信心閾值決策回退功能
AI Gateway adds confidence-based decision fallbacks
AI Gateway 於 Vercel 發布新增信心閾值決策回退功能,允許在主模型回應不符合設定信心條件時自動切換至備援模型。
- 條件設定:可針對 Choice、Score、Boolean 類型問題設定
confidenceBelow或confidenceAbove,並可結合多條件組合。
此功能允許在 AI Gateway 中設定信心閾值,確保不確定回應能自動切換至備援模型,提升決策準確度並同時避免單一模型失效帶來的風險,對於需要高可靠性的應用場景尤為重要;同時支援多條件組合,讓開發者可針對不同問題類型精細調整回退策略。
AI Gateway can now escalate a decision request to a fallback model when the primary model's answer trips a confidence condition you set.
Conditions can be combined, so an escalation can depend on more than one signal. The plain model names you already list in models keep catching outright errors, so existing fallbacks are unaffected. Confidence conditions cover Choice and Score questions. Boolean questions escalate on a probability range instead.
Set the fallback by adding one conditional object to providerOptions.gateway.models. Requests without it keep their existing behavior.
{
"gateway": {
"models": [
{
"model": "openai/gpt-6-astra",
"when": {
"question": "intent",
"confidenceBelow": 0.6
}
}
]
}
}
Escalating an uncertain answer to a fallback model with a confidence condition
Leave out question and the condition checks every question of the matching type, so { "confidenceBelow": 0.6 } escalates when any Choice or Score answer falls below 0.6.
Because a triggered fallback runs a second decision, it bills both stages.
Decision fallbacks are in beta. Learn more in the decision fallbacks documentation.
來源:Vercel Blog · vercel.com