Add Anthropic's Claude Opus 4.7 model support#2354
Add Anthropic's Claude Opus 4.7 model support#2354PeterDaveHello wants to merge 1 commit intoThe-PR-Agent:mainfrom
Conversation
Review Summary by QodoAdd Claude Opus 4.7 model support across providers
WalkthroughsDescription• Add Claude Opus 4.7 model support across multiple providers • Set context length to 1,000,000 tokens for new model • Support Anthropic, Vertex AI, and Bedrock provider variants • Add comprehensive unit tests for all model identifier formats Diagramflowchart LR
A["Claude Opus 4.7<br/>Model Addition"] --> B["Anthropic Provider"]
A --> C["Vertex AI Provider"]
A --> D["Bedrock Provider"]
B --> E["1M Token Context"]
C --> E
D --> E
A --> F["Unit Tests"]
F --> G["6 Model Variants"]
File Changes1. pr_agent/algo/__init__.py
|
Code Review by Qodo
1. Bedrock Opus ID mismatch
|
| 'bedrock/anthropic.claude-opus-4-1-20250805-v1:0': 200000, | ||
| 'bedrock/anthropic.claude-opus-4-6-20260120-v1:0': 200000, | ||
| 'bedrock/anthropic.claude-opus-4-6-v1:0': 200000, | ||
| 'bedrock/anthropic.claude-opus-4-7': 1000000, |
There was a problem hiding this comment.
1. Bedrock opus id mismatch 🐞 Bug ≡ Correctness
The new Bedrock Claude Opus 4.7 MAX_TOKENS keys omit the -v1:0 suffix, while existing Bedrock Claude Opus entries and the repo’s Bedrock configuration docs use -v1:0. Since get_max_tokens() only does exact dictionary lookup, users configuring bedrock/...-v1:0 will hit an exception and PR-Agent will fail for that model string.
Agent Prompt
### Issue description
Bedrock Claude Opus 4.7 was added to `MAX_TOKENS` without the `-v1:0` suffix, but existing Bedrock Claude Opus IDs in `MAX_TOKENS` (and the repo’s Bedrock docs/examples) use `-v1:0`. Because `get_max_tokens()` requires an exact match, using the `...-v1:0` model string will raise and break execution.
### Issue Context
- Prior Bedrock Opus entries are suffixed with `-v1:0`.
- The new Opus 4.7 Bedrock entries are not.
- Tests currently validate only the unsuffixed Opus 4.7 Bedrock strings, so they won’t catch the `-v1:0` variant failing.
### Fix Focus Areas
- pr_agent/algo/__init__.py[151-174]
- tests/unittest/test_get_max_tokens.py[149-181]
### What to change
1. Add `MAX_TOKENS` entries for the expected Bedrock Opus 4.7 IDs that include `-v1:0` (e.g., `bedrock/anthropic.claude-opus-4-7-v1:0`, `bedrock/global.anthropic.claude-opus-4-7-v1:0`, `bedrock/us.anthropic.claude-opus-4-7-v1:0`).
2. Update/extend the unit test to include these `-v1:0` variants (and keep the unsuffixed ones too if you intend to support both spellings).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Reference: