Skip to content

feat(anthropic): support Claude Opus 4.7 by omitting deprecated temperature#3

Open
Khurdhula-Harshavardhan wants to merge 1 commit intomainfrom
feat/opus-4-7-support
Open

feat(anthropic): support Claude Opus 4.7 by omitting deprecated temperature#3
Khurdhula-Harshavardhan wants to merge 1 commit intomainfrom
feat/opus-4-7-support

Conversation

@Khurdhula-Harshavardhan
Copy link
Copy Markdown
Contributor

Summary

  • Opus 4.7 deprecated temperature, top_p, and top_k — passing any of them now returns a 400. The current Anthropic provider unconditionally sends temperature=config.temperature, so any run with --model-id claude-opus-4-7 fails immediately.
  • Guard the kwarg by model id: temperature is still passed for every existing model (Opus 4.6, Sonnet 4.6, future Anthropic models without the opus-4-7 substring), and is omitted only when the id contains opus-4-7.
  • Reasoning is unaffected — adaptive thinking is off by default on 4.7 unless the caller passes a thinking field, which this provider does not.

Ref: What's new in Claude Opus 4.7"Starting with Claude Opus 4.7, setting temperature, top_p, or top_k to any non-default value will return a 400 error. The safest migration path is to omit these parameters entirely."

Methodology note

Anthropic's docs also state: "If you were using temperature = 0 for determinism, note that it never guaranteed identical outputs." The within-Anthropic comparison stays roughly apples-to-apples; a one-line README footnote on Opus 4.7's row is recommended when results land.

Test plan

  • SDK-level smoke test against claude-opus-4-7 confirms the model returns valid JSON without sampling params.
  • Verified guard: temperature is still in kwargs for claude-opus-4-6 and claude-sonnet-4-6, and absent for claude-opus-4-7.
  • End-to-end inference run: python -m sob.run --provider anthropic --modality text --model-id claude-opus-4-7 --sample-size 5
  • Full benchmark runs across text / image / audio.
  • Add "claude-opus-4-7": "Claude-Opus-4.7" to data/evaluation/display_names.json after eval summaries land (separate PR or follow-up commit).

🤖 Generated with Claude Code

…rature

Opus 4.7 returns a 400 when temperature/top_p/top_k are set; the safest
migration per Anthropic's docs is to omit them entirely. Guard on the
model id so existing 4.6 / Sonnet 4.6 runs continue to send
temperature=0.0 unchanged.

Ref: https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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