fix(anthropic): handle per-level reasoning_effort flags without supports_reasoning - #38618
Conversation
…rts_reasoning When a model has only per-level flags (e.g. supports_minimal_reasoning_effort: true) but no explicit supports_reasoning flag, treat it as implicitly reasoning-capable. This fixes gpt-5-search-api which declares minimal support but was incorrectly degraded to low/minimal floor due to missing explicit supports_reasoning flag. Test: verify per-level flag enables resolution path even without supports_reasoning. Note: This change indirectly causes 20 azure deployments to forward max/xhigh instead of degrading to high when requested, as these models now correctly resolve their supported efforts through declared capability flags. This is intended behavior (avoiding unnecessary degradation) but silent; operators seeing increased latency/cost should check reasoning effort changes in logs. Co-Authored-By: Claude <noreply@anthropic.com>
Greptile SummaryThe PR corrects reasoning-effort capability resolution when per-level flags are present without a top-level
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| litellm/router_utils/reasoning_effort_capability.py | Correctly infers reasoning support from per-level metadata while returning no efforts immediately for an explicit opt-out. |
| tests/test_litellm/router_utils/test_reasoning_effort_capability.py | Adds focused coverage for per-level implicit support and explicit-false precedence without weakening existing assertions. |
Reviews (3): Last reviewed commit: "fix(anthropic): explicit supports_reason..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… flags Greptile P1: the implicit-True branch bypassed the operator's explicit supports_reasoning: false escape hatch when per-level flags were present or inherited through the bare-twin lookup. Return () first on explicit False, then apply the per-level implication only when the flag is unset. Also drops a test comment that restated the test name (P2). Co-Authored-By: Claude <noreply@anthropic.com>
|
@greptileai can you reply here with score & why |
|
bugbot run |
|
Score: 5/5. The change correctly distinguishes explicit |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4603619. Configure here.
|
@greptileai review pls |
|
@greptileai based on the response / comment, can you give me a score now! |
Problem
gpt-5-search-apideclaressupports_minimal_reasoning_effort: truebut has nosupports_reasoningflag. The resolver was treating this as "no reasoning support" and falling back to the chain floor, causingminimalrequests to downgrade tolow.Solution
When a model has any per-level flag set (not None), treat
supports_reasoningas implicitly True and proceed through the flag resolution path. This allows models likegpt-5-search-apito correctly advertise and accept their declared effort levels.Behavior change
20 azure deployments (those with
maxorxhighper-level flags set) will now forward those efforts instead of degrading tohigh. This is intended (avoiding unnecessary degradation) but is a latency/cost change; operators should monitor reasoning effort changes in logs if they see bill increases.Testing
supports_reasoningFixes the regression identified in PR #38492 follow-up review.
Note
Medium Risk
Changes router-advertised reasoning effort levels for map entries with per-level flags but no
supports_reasoning, which can alter forwarded effort (including higher tiers on some Azure deployments) and affect latency/cost.Overview
Fixes incorrect downgrades when a catalog entry sets per-level
supports_*_reasoning_effortflags but omitssupports_reasoning(e.g.gpt-5-search-apiwithsupports_minimal_reasoning_effort: true).resolve_supported_reasoning_effortsnow treats any non-Noneper-level flag as implicit evidence that reasoning is supported, so resolution continues through the flag/opt-in/opt-out path instead of behaving like a mapped non-reasoning model (()) or unknown.supports_reasoning: falseis checked first and still returns no efforts, even if per-level flags are present.Tests cover implicit enablement from a lone per-level flag and that explicit
supports_reasoning: falseoverrides inherited per-level metadata.Reviewed by Cursor Bugbot for commit 4603619. Bugbot is set up for automated code reviews on this repo. Configure here.