feat(providers): centralize typed model capability constraints - #59
Merged
Merged
Conversation
zhanghanduo
force-pushed
the
codex/model-capabilities
branch
from
October 5, 2026 08:16
639e471 to
4e991d8
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tomain.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
ModelCapabilitiesrecords shared byModelProfile.request_capabilitiesand 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.model_capabilitiesoverrides are validated without mutating a registry. Omitted fields inherit, null clears a fact, and empty collections mean unsupported; overridden fields remain identifiable.context_windowremains 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.Validation:
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.