feat(model): add Anthropic adapter with pass-through model selection - #199
Conversation
… selection Introduce a new AnthropicModelAdapter and register it as an independent provider in the default adapter manager and model adapter exports. Allow users to specify Anthropic model names directly via Config.llm.model or ANTHROPIC_MODEL instead of hardcoded alias mapping, so new Anthropic model releases do not require code changes. Add Anthropic provider dependency and coverage: unit tests for adapter behavior and manager resolution, plus CLI provider integration checks. Update docs and OpenSpec artifacts (design, proposal, tasks, feature evidence) and include a concrete client example config for Anthropic usage.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65bfd366b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self._extra: | ||
| params.update(self._extra) |
There was a problem hiding this comment.
Keep normalized max_tokens when merging extra params
generate() computes a validated integer max_tokens first (line 61), but params.update(self._extra) can overwrite it with raw config values. When llm.extra.max_tokens is null or a string (common in templated JSON/YAML), this sends max_tokens=None or a non-integer to Anthropic and the request fails at runtime. This negates _resolve_max_tokens fallback/normalization and can break production calls for otherwise valid configs.
Useful? React with 👍 / 👎.
Handle the review finding on Anthropic max_tokens merge semantics: keep normalized max_tokens from _resolve_max_tokens/options and prevent raw llm.extra.max_tokens from overwriting it during extra-param merge. Add regression tests covering extra.max_tokens=None fallback (2048) and string normalization to int to prevent runtime request failures. Update feature governance evidence for add-anthropic-model-adapter: mark status active, add Intent/Implementation/review links, and normalize Evidence sections to satisfy governance-intent/evidence-truth gate contracts.
|
Addressed the review finding and pushed commit Changes made:
|
Summary
AnthropicModelAdapterand register Anthropic as an independent provider pathConfig.llm.modelorANTHROPIC_MODEL(no hardcoded alias mapping)Scope isolation
Verification
.venv/bin/pytest -q tests/unit/test_anthropic_model_adapter.py tests/unit/test_default_model_adapter_manager.py tests/unit/test_client_cli.py72 passed, 1 warningopenspec validate --changes "add-anthropic-model-adapter"12 passed, 0 failedNotes