Skip to content

fix(llm): add opus-5 to the Anthropic effort-based family list#703

Open
odafeng wants to merge 1 commit into
HKUDS:devfrom
odafeng:fix/anthropic-opus-5-effort-family
Open

fix(llm): add opus-5 to the Anthropic effort-based family list#703
odafeng wants to merge 1 commit into
HKUDS:devfrom
odafeng:fix/anthropic-opus-5-effort-family

Conversation

@odafeng

@odafeng odafeng commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #701.

Problem

Every turn on claude-opus-5 through the anthropic provider fails with HTTP 400:

invalid_request_error: `temperature` is deprecated for this model.

_EFFORT_BASED_FAMILIES (anthropic_provider.py:28) is matched by substring:

effort_based = any(family in model_name for family in _EFFORT_BASED_FAMILIES)

No listed family is a substring of claude-opus-5, so effort_based is False and the caller's temperature is attached to the request. Opus 5 shipped after the list was last extended — the neighbouring comment already anticipates this ("Extend as new families ship").

The same flag also selects how thinking is expressed, so the miss is not limited to temperature: with an effort level configured, Opus 5 would have been sent thinking: {"type": "enabled", "budget_tokens": N}, the other form that generation rejects. One entry fixes both paths.

Change

  • deeptutor/services/llm/provider_core/anthropic_provider.py — add "opus-5" to _EFFORT_BASED_FAMILIES.
  • tests/services/llm/test_anthropic_provider_fixes.py — add claude-opus-5 to the two model tuples that already assert this behaviour.

The tests were the reason this went unnoticed: test_temperature_omitted_for_effort_based_models and test_effort_based_families_map_real_effort_to_adaptive_thinking cover exactly this contract, but were never extended with the new model. With claude-opus-5 added they fail on dev and pass with the fix, so the regression is genuinely covered rather than just described.

Verification

Without the provider fix (test change only):

FAILED test_temperature_omitted_for_effort_based_models
FAILED test_effort_based_families_map_real_effort_to_adaptive_thinking
2 failed, 6 passed

With both changes:

8 passed

Also exercised end-to-end against the live Anthropic API on a real workspace — deeptutor run chat and the Web UI turn path both return normal replies on claude-opus-5 where they previously returned the 400.

Note on the underlying mechanism

Not part of this PR, but worth flagging: a hardcoded substring list needs an edit for every new model family and fails closed-with-a-400 when it misses one, with no signal until a user hits it in production. The file's own comment names the better fix ("a capability lookup is the longer-term fix"), and this class of bug has recurred on the OpenAI-compatible side too (#141, #54). Happy to look at a capability-driven approach separately if that's a direction you'd want.

Targeting dev per CONTRIBUTING.md.

`claude-opus-5` was missing from `_EFFORT_BASED_FAMILIES`, so the
substring check at `_build_kwargs` resolved `effort_based` to False and
the request carried `temperature`. Opus 5 rejects it outright, making
every turn on that model fail:

    invalid_request_error: `temperature` is deprecated for this model.

The same flag also selects how thinking is expressed, so the miss meant
Opus 5 would have been sent `thinking: {"type": "enabled", ...}` — the
other form that generation rejects — once an effort level was set.

The existing regression tests cover exactly this behaviour but had not
been extended with the new model, which is why the gap went unnoticed;
adding `claude-opus-5` to both model tuples makes them fail without the
one-line fix and pass with it.

Co-Authored-By: Claude Fable 5 <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