Skip to content

feat(providers): centralize typed model capability constraints - #59

Merged
zhanghanduo merged 3 commits into
mainfrom
codex/model-capabilities
Oct 5, 2026
Merged

zhanghanduo merged 3 commits into
mainfrom
codex/model-capabilities

Conversation

@zhanghanduo

@zhanghanduo zhanghanduo commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #58. Base: feat/surface-anthropic-stop-details; this diff contains only the capability-table follow-up. Merge #58 first, then rebase/retarget this PR to main.

Native model request constraints were split between profiles, direct clients, and auxiliary builders. For example, a Sonnet 4.5 profile defaulted to unsupported adaptive thinking, and an auxiliary Opus 5.5 profile could silently turn explicit disabled thinking into an omitted field. Known unsupported effort was also dropped inconsistently.

Add immutable ModelCapabilities records shared by ModelProfile.request_capabilities and Anthropic construction. Records describe thinking modes, required thinking, effort, sampling, tool-choice modes, signature binding, and token maxima, with source URLs and a verification date. Initial verified entries cover Fable 5.1, Opus 5.5, and legacy 4.5 models/aliases.

  • Exact native model IDs and documented Bedrock forms resolve to verified facts. Unknown versions, proxy aliases, and other protocols stay unknown rather than inheriting guessed restrictions.
  • Per-deployment model_capabilities overrides are validated without mutating a registry. Omitted fields inherit, null clears a fact, and empty collections mean unsupported; overridden fields remain identifiable.
  • Native builders choose compatible thinking defaults. Direct, profile, auxiliary, and per-call paths reject known unsupported thinking, effort, and output limits before API calls. Existing unknown-model behavior and legacy budget adjustment remain compatible.
  • context_window remains the host's operational budget. Endpoint catalogs, credentials, routing, pricing, protocol conversion, and retry logic retain their existing owners; no discovery/background sync service is introduced.
  • CI runs for stacked PR bases and checks capability/auxiliary behavior at the SDK floor. Add an independent release fragment without changing package versions.

Validation:

  • Python 3.12 / locked Anthropic SDK 1.11.0: 1862 passed, 1 skipped (optional tokenizer contract runs separately in CI).
  • SDK 0.69.0 compatibility suite: 194 passed.
  • Ruff, strict Pyright, unconsumed-fields, whitespace checks, and source/wheel build passed.
  • Independent review verified auxiliary disabled intent, legacy effort handling, immutable overrides, exact-ID matching, and profile/client consistency.

Limitations: sampling, tool-choice, and signature-binding facts are exposed for host use; this PR wires thinking, effort, and output-limit validation. It does not add forced tool-choice support or fetch Models API metadata automatically.

@zhanghanduo
zhanghanduo force-pushed the codex/model-capabilities branch from 639e471 to 4e991d8 Compare October 5, 2026 08:16
Base automatically changed from feat/surface-anthropic-stop-details to main October 5, 2026 08:18
zhanghanduo and others added 2 commits October 5, 2026 16:25
Follow-up to 4e991d8 (centralize typed model capability constraints).

- ModelProfile gains `model_capabilities`, the same override mapping the
  client config uses, and `request_capabilities` resolves with it. Before,
  the profile ignored deployment overrides, so it could disagree with the
  client built from the same config.
- New `normalize_thinking_mode` is used by both `protocol_client` and the
  auxiliary builder: off/none/false all mean disabled, blank means unset,
  anything else raises. Previously `off` was disabled on the aux path but
  an "unknown thinking_type" error on the main path.
- `_build_kwargs` only re-validates the per-call output limit; thinking and
  effort are fixed and already validated at construction.
- Deduplicate the Opus 4.5 record, accept us-gov/jp/au Bedrock prefixes,
  and fix the resolver docstring (there is no protocol-default layer).
- Changelog spells out the behavior changes for existing configs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Document on ModelCapabilities (and in the boundary doc) which fields
  validate_request enforces and which are descriptive until an adapter
  consumes them, so hosts do not assume e.g. tool_choice_modes is applied.
- Tests: normalize_thinking_mode spellings, unknown and non-string values;
  the shared Opus 4.5 record; all documented Bedrock prefixes plus forms
  that must stay unknown (unlisted prefix, ARN, Bedrock ID over the native
  protocol); per-call max_tokens checked against a deployment override and
  the record maximum; ModelProfile precedence of an explicit record over
  the override mapping, malformed overrides failing like the client, and
  overrides on non-native protocols; descriptive fields being overridable
  without affecting request validation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@zhanghanduo
zhanghanduo merged commit a2dba87 into main Oct 5, 2026
5 checks passed
@zhanghanduo
zhanghanduo deleted the codex/model-capabilities branch October 5, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant