Skip to content

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

Merged
pancacake merged 1 commit into
HKUDS:devfrom
odafeng:fix/anthropic-opus-5-effort-family
Jul 26, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
odafeng:fix/anthropic-opus-5-effort-family

Conversation

@odafeng

@odafeng odafeng commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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 <[email protected]>
@pancacake
pancacake merged commit 4a69694 into HKUDS:dev Jul 26, 2026
11 checks passed
pancacake added a commit that referenced this pull request Jul 26, 2026
Maintenance release on top of v1.5.4, with two new ways to bring a model.

- OpenAI Codex is a first-party OAuth provider (#690): browser sign-in
  against your own ChatGPT plan replaces the API-key fields, credentials
  stay in <user-root>/private/openai-codex/ with owner-only permissions,
  and the managed profile is owner-bound so it is never handed out through
  grants or made active over an already-configured LLM.
- Eden AI joins as the 35th LLM binding (#671), an OpenAI-compatible
  gateway addressed as <provider>/<model>.
- Knowledge bases answer from a real document inventory instead of
  guessing from retrieval hits: a per-KB inventory rides the system prompt
  and a new kb_files tool enumerates on demand with glob/substring
  filters, mounted under rag's gate and deniable per partner.
- The rag tool cites the chunks, entities, and reports retrieval actually
  returned (#694) rather than an echo of its own query; the local LightRAG
  pipeline still surfaces nothing to cite.
- GraphRAG indexing runs on a worker thread with its own asyncio loop
  (#695), so UVICORN_LOOP=asyncio is no longer needed, and two config
  faults that broke the first run are fixed (#699).
- Assorted: unique optimistic message ids (#698, a v1.5.4 regression that
  dropped the assistant reply from the visible thread), partner-chat
  manual scrolling respected (#704), claude-opus-5 recognized as
  effort-based (#703), Kimi models omit temperature outright, and
  deeptutor start keeps relaying logs on legacy Windows code pages (#702).
- Typing: narrow the loopback callback server to asyncio.Server and gate
  the msvcrt lock path on sys.platform so it type-checks off Windows.

Release notes: assets/releases/ver1-5-5.md
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.

2 participants