agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
130 lines (129 loc) • 7.08 kB
TypeScript
/**
* anthropicModels — what each Claude model takes on the Anthropic wire: ONE
* table of thinking, tool-choice and documented replay-prefix facts.
*
* Pattern: declaration + shared family lookup with explicit matching policies.
* Role: Outer ring. The facts the adapters declare and send from:
* - `thinking` — which thinking request the model takes (`'adaptive'`,
* `'budget'` or `'none'`; translated by `anthropicThinkingWire.ts`);
* - `forcedToolChoice` — whether it takes `tool_choice: { type: 'tool' }`
* (the `'tool-forced'` output strategy and the constrained pick send one);
* - `nativeOutputSchema` — whether it takes `output_config.format` (the
* `'native'` output strategy sends one).
*
* A model is added here, and nowhere else.
*
* The facts, from Anthropic's documentation (fetched 2026-10-09):
* - thinking per model — see `anthropicThinkingWire.ts` (unchanged from the
* 9.141.0 table);
* - Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 reject forced tools:
* https://platform.claude.com/docs/en/build-with-claude/thinking ("Response
* prefill and forced tool use"); Haiku 5.5 accepts them:
* https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide.
* - Prefix binding is documented for Fable 5.1, Opus 5.5, Sonnet 5.5 and
* Haiku 5.5, not inferred for other families:
* https://platform.claude.com/docs/en/build-with-claude/preserved-thinking.
* - Structured outputs (`output_config.format`) — fetched 2026-10-14 — list
* Fable 5.1, Mythos 5.1, Fable 5, Mythos 5, Mythos Preview, Opus 5.5, Opus 5,
* Opus 4.8, 4.7, 4.6, Sonnet 5.5, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.5,
* Haiku 5.5 and Haiku 4.5; the families before them are not listed:
* https://platform.claude.com/docs/en/build-with-claude/structured-outputs.
*
* @example
* anthropicModelFacts('claude-opus-5-5');
* // { thinking: 'adaptive', forcedToolChoice: false, thinkingPrefixBinding: true,
* // nativeOutputSchema: true }
* anthropicModelFacts('us.anthropic.claude-haiku-4-5-20251001-v1:0');
* // { thinking: 'budget', forcedToolChoice: true, nativeOutputSchema: true }
* anthropicModelFacts('claude-opus-6'); // undefined — not in the table
*/
import type { ThinkingMode } from '../../thinking/types.js';
/** What one Claude model family takes on the wire. */
export interface AnthropicModelFacts {
/** The thinking request it takes. */
readonly thinking: ThinkingMode;
/** Whether it takes a forced tool choice (`tool_choice: { type: 'tool' | 'any' }`). */
readonly forcedToolChoice: boolean;
/** This family documents preserved-thinking prefix checking. */
readonly thinkingPrefixBinding?: true;
/**
* Whether it takes a structured-output format (`output_config.format`, the
* `'native'` output strategy) — the models the structured-outputs page lists.
*/
readonly nativeOutputSchema: boolean;
}
/**
* The facts per Claude model family, keyed by the family id (the model id
* without a date, version or platform prefix — matching is
* {@link anthropicModelFamily}'s). The ONE table.
*/
export declare const ANTHROPIC_MODELS: Readonly<Record<string, AnthropicModelFacts>>;
/** The thinking column of {@link ANTHROPIC_MODELS}, family → mode. */
export declare const ANTHROPIC_THINKING_MODES: Readonly<Record<string, ThinkingMode>>;
/**
* The table family a Claude model id names, or `undefined` when none does.
*
* Accepts complete Claude API, Bedrock foundation/system-profile and Vertex
* model identifiers. Application profiles, deployment names and router aliases
* are opaque: a Claude-looking substring is not evidence of the served model.
* This recognizes a family, not its availability in a particular region.
*/
export declare function anthropicModelFamily(model: string): string | undefined;
/** The table's facts for a model id, or `undefined` for an id it does not know. */
export declare function anthropicModelFacts(model: string): AnthropicModelFacts | undefined;
/**
* The thinking mode a Claude model id takes on the Anthropic Messages wire.
*
* An id no family matches answers `'adaptive'` — what every Claude model since
* 4.7 takes (they reject a budget), so a model released after this table
* thinks instead of failing with a 400.
*
* The cost of that default, named: an id that does not say which model it
* serves — an application-inference-profile ARN, a gateway alias, a
* deployment name — is read as adaptive too, and a budget-only model behind
* it (Claude 4.5 and earlier) refuses adaptive. The adapters take a
* `thinkingMode` option for exactly that (`anthropicThinkingWire.ts` ·
* `thinkingModeWith`).
*
* Historical dotted and decorated aliases retain their existing thinking
* lookup. That compatibility behavior is not a hard fact about the model
* behind an opaque deployment and does not control forced-tool refusals.
*
* @example
* anthropicThinkingMode('claude-opus-5-5'); // 'adaptive'
* anthropicThinkingMode('us.anthropic.claude-sonnet-4-5-20250929-v1:0'); // 'budget'
* anthropicThinkingMode('claude-3-5-haiku@20241022'); // 'none'
* anthropicThinkingMode('claude-opus-6'); // 'adaptive' — unknown
*/
export declare function anthropicThinkingMode(model: string): ThinkingMode;
/**
* Whether a Claude model id takes a forced tool choice. An id the table does
* not know is NOT refused: the newest models disagree (Haiku 5.5 takes one,
* Opus 5.5 does not), so the table makes no claim it cannot source, and the
* API's own 400 names `tool_choice` until the model has a row.
*
* @example
* anthropicTakesForcedToolChoice('claude-opus-5-5'); // false
* anthropicTakesForcedToolChoice('anthropic.claude-haiku-5-5'); // true
*/
export declare function anthropicTakesForcedToolChoice(model: string): boolean;
/**
* Whether a Claude model id takes a structured-output format
* (`output_config.format`, the `'native'` output strategy).
*
* THE UNKNOWN-ID POLICY, named: an id the table does not know answers `true`,
* by the thinking table's precedent (`anthropicThinkingMode` reads an unknown
* id as the newest generation's `'adaptive'`). Every Claude model since 4.5
* takes the format, so a model released after this table is a model that
* takes it, and refusing it would block the newest model by default. The
* cost: an id that hides an older model (a router alias) is not refused here,
* and the API's own 400 names `output_config` until the model has a row. A
* family the table DOES know and the page does not list is refused before
* anything is sent.
*
* @example
* anthropicTakesNativeOutputSchema('claude-haiku-4-5-20251001'); // true
* anthropicTakesNativeOutputSchema('claude-opus-4-1'); // false
* anthropicTakesNativeOutputSchema('claude-opus-6'); // true — unknown, newest
*/
export declare function anthropicTakesNativeOutputSchema(model: string): boolean;