fix: add claude-opus-4-7 to NO_SUPPORT_TEMPERATURE_MODELS (#2400)#2448
fix: add claude-opus-4-7 to NO_SUPPORT_TEMPERATURE_MODELS (#2400)#2448raywcm wants to merge 1 commit into
Conversation
Code Review by Qodo
Context used 1. No tests for claude-opus-4-7
|
PR Summary by QodoFix: skip temperature for Claude Opus 4-7 model IDs and add Bedrock v1:0 max tokens WalkthroughsDescription• Add Claude Opus 4-7 model variants to the no-temperature allowlist to avoid Anthropic 400s. • Register Bedrock Opus 4-7 v1:0 in MAX_TOKENS to prevent get_max_tokens() crashes. Diagramgraph TD
Cfg["pr_agent/algo/__init__.py (model caps)"] --> H(["LiteLLMAIHandler"] ) --> P{{"LLM provider APIs"}}
H -->|"omit temperature"| P
subgraph Legend
direction LR
_cfg["Config/constants"] ~~~ _svc(["Handler/service"]) ~~~ _ext{{"External API"}}
end
High-Level AssessmentThe following are alternative approaches to this PR: 1. Prefix/regex-based model family matching
2. Provider capability discovery (via SDK / LiteLLM metadata)
Recommendation: The explicit enumeration is appropriate for a targeted hotfix and matches the existing pattern used for Opus 4-8. If Opus model variants continue proliferating, consider augmenting with a conservative prefix-based matcher specifically for known providers (e.g., Bedrock 'bedrock/claude-opus-4-7') to reduce future churn while keeping the explicit list as an override/escape hatch. File ChangesBug fix (1)
|
Fixes #2400
Description
When using Claude Opus 4-7 models (via Anthropic, Vertex AI, or Bedrock), PR-Agent sends the
temperatureparameter which Anthropic has deprecated for these models, causing every command to fail with a 400 error:Changes Made
Added all Claude Opus 4-7 model variants to
NO_SUPPORT_TEMPERATURE_MODELSinpr_agent/algo/__init__.py:claude-opus-4-7vertex_ai/claude-opus-4-7anthropic/claude-opus-4-7bedrock/anthropic.claude-opus-4-7bedrock/anthropic.claude-opus-4-7-v1:0bedrock/us.anthropic.claude-opus-4-7bedrock/global.anthropic.claude-opus-4-7Added
bedrock/anthropic.claude-opus-4-7-v1:0toMAX_TOKENS(same token limit as the non--v1:0variant) so thatget_max_tokens()does not crash when this model ID is configured.The fix follows the existing pattern used for the Claude Opus 4-8 variants already in
NO_SUPPORT_TEMPERATURE_MODELS. TheLiteLLMAIHandleralready skips sending thetemperatureparameter for any model in this list.