Function: buildPolicyAwareFallbackChain()
buildPolicyAwareFallbackChain(
tier,excludeProvider?,call?):FallbackProviderEntry[]
Defined in: packages/agentos/src/api/generateText.ts:2439
Build a policy-tier-aware fallback chain, for callers that pass
policyTier: 'mature' | 'private-adult': a refusal or an outage of the
primary walks to an uncensored model before the availability legs.
Mature and private-adult: the tier's catalog ladder
(the catalog's getFallbackLadder; private-adult keeps the
models that permit erotic) as OpenRouter legs in the uncensored
group, llama-3.1-8b left out, then the buildFallbackChain suffix.
Every entry is tagged origin: 'policy-default', which lets the walk drop
the leg naming the failed first model, keep two standing uncensored legs,
and pass over Claude legs after a refusal. Safe, standard and an absent
tier get buildFallbackChain unchanged and untagged.
Each leg pins cache: false. A missing key drops its legs instead of
throwing, so a partial deploy still gets a shorter usable chain.
Parameters
tier
The call's content tier.
"safe" | "standard" | "mature" | "private-adult" | undefined
excludeProvider?
string
Provider to leave out of the availability suffix (typically the failed primary's). The ladder legs ignore it: another model on the same provider is a valid rescue, and the walk drops the exact failed model.
call?
The call the chain rescues, passed to buildFallbackChain.
toolChoice?
string | Record<string, unknown>