Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions litellm/router_utils/reasoning_effort_capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,23 @@ def resolve_supported_reasoning_efforts(
unset flag as () would let one custom deployment empty every level its mapped siblings agree
on. deployment_is_mapped is that provenance, and an operator who wants either answer for an
off-map deployment gets it by setting supports_reasoning explicitly.

If no explicit supports_reasoning flag is set but at least one per-level flag (e.g.
supports_minimal_reasoning_effort) is present, treat supports_reasoning as implicitly True,
since the per-level flags are evidence the model supports reasoning.
"""
supports_reasoning: Final = model_info.get("supports_reasoning")
flags: Final = _declared_effort_flags(model_info)
has_per_level_flag: Final = any(value is not None for value in flags.values())

if supports_reasoning is not True:
return () if supports_reasoning is False or deployment_is_mapped else None
if not has_per_level_flag:
return () if supports_reasoning is False or deployment_is_mapped else None
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

declared: Final = declared_reasoning_efforts(model_info)
if declared is not None:
return declared

flags: Final = _declared_effort_flags(model_info)
if all(value is None for value in flags.values()):
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ def test_opt_in_flag_set_false_stays_excluded(self):
)
assert resolved == ("none", "minimal", "low", "medium", "high")

def test_per_level_flag_without_supports_reasoning_treats_as_implicit_true(self):
# A model with only a per-level flag (e.g. supports_minimal_reasoning_effort) but no
# explicit supports_reasoning should be treated as reasoning-capable, since the per-level
# flag is evidence of reasoning support.
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
resolved = resolve_supported_reasoning_efforts(
{
"supports_minimal_reasoning_effort": True,
},
deployment_is_mapped=True,
)
assert resolved == ("none", "minimal", "low", "medium", "high")


class TestBareModelNameFallback:
def test_a_prefixed_entry_inherits_the_flags_of_its_unprefixed_twin(self):
Expand Down
Loading