@mastra/core
Version:
28 lines • 1.4 kB
TypeScript
/**
* Anthropic server-side fallback detection.
*
* When a fallback chain is configured via `providerOptions.anthropic.fallbacks`
* and the primary model's safety classifiers decline a turn, the Anthropic API
* transparently retries the turn on the fallback model and returns that
* model's answer. The substitution is reported via `fallback_message` entries
* in `providerMetadata.anthropic.iterations`, each carrying the model that
* served the retry.
*/
export interface ServerSideFallbackInfo {
/** Id of the fallback model that served the turn, when reported. */
model?: string;
}
/**
* Detect whether a turn was served by an Anthropic server-side fallback model.
* Returns `undefined` when no fallback fired; otherwise returns the fallback
* model id when the provider reported one.
*/
export declare function getServerSideFallbackInfo(providerMetadata: unknown): ServerSideFallbackInfo | undefined;
/**
* Resolve the model id that actually generated a response, accounting for
* Anthropic server-side fallbacks. Prefers the fallback model reported in
* provider metadata over the response's own model id, so tracing/metrics
* attribute the turn to the model that actually served it.
*/
export declare function resolveResponseModelId(providerMetadata: unknown, responseModelId: string | undefined): string | undefined;
//# sourceMappingURL=server-side-fallback.d.ts.map