mirror of
https://github.com/usestrix/strix.git
synced 2026-10-13 03:57:59 +00:00
fix(models): reasoning support follows the model, not the route
model_supports_reasoning only consulted LiteLLM's map under the exact route name, so openai/glm-5.3 (mapped only as zai/... and openrouter/...) silently dropped STRIX_REASONING_EFFORT. Fall back to any provider's entry for the same bare model name.
This commit is contained in:
parent
da75077c89
commit
110b40e05a
2 changed files with 25 additions and 1 deletions
|
|
@ -837,7 +837,17 @@ def model_supports_reasoning(model_name: str) -> bool:
|
|||
entry = litellm.model_cost.get(name)
|
||||
if entry is None and "/" in name:
|
||||
entry = litellm.model_cost.get(name.rsplit("/", 1)[1])
|
||||
return bool(entry and entry.get("supports_reasoning"))
|
||||
if entry is not None:
|
||||
return bool(entry.get("supports_reasoning"))
|
||||
# Reasoning is a property of the model, not of the route: a model only
|
||||
# mapped under other providers (``zai/glm-5.3`` for ``openai/glm-5.3``)
|
||||
# still reasons through an OpenAI-compatible gateway.
|
||||
bare_name = name.rsplit("/", 1)[-1]
|
||||
return any(
|
||||
bool(candidate.get("supports_reasoning"))
|
||||
for key, candidate in litellm.model_cost.items()
|
||||
if key.endswith(f"/{bare_name}") and isinstance(candidate, dict)
|
||||
)
|
||||
|
||||
|
||||
def is_recommended_or_frontier_model(model_name: str) -> bool:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from strix.config.models import (
|
|||
_NonStreamingModel,
|
||||
_TurnGuardModel,
|
||||
is_recommended_or_frontier_model,
|
||||
model_supports_reasoning,
|
||||
request_timeout_extra_args,
|
||||
routes_through_litellm,
|
||||
supports_strict_tool_schemas,
|
||||
|
|
@ -23,6 +24,19 @@ def test_recommended_models_are_accepted(model_name: str) -> None:
|
|||
assert is_recommended_or_frontier_model(model_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model_name",
|
||||
["openai/glm-5.3", "glm-5.3", "hosted_vllm/glm-5.3", "openai/kimi-k3", "openai/qwen3.8-max"],
|
||||
)
|
||||
def test_reasoning_support_follows_the_model_not_the_route(model_name: str) -> None:
|
||||
assert model_supports_reasoning(model_name)
|
||||
|
||||
|
||||
def test_reasoning_support_rejects_unknown_models() -> None:
|
||||
assert not model_supports_reasoning("openai/no-such-model-xyz")
|
||||
assert not model_supports_reasoning("openai/gpt-4.1")
|
||||
|
||||
|
||||
def test_request_timeout_extra_args_positive() -> None:
|
||||
assert request_timeout_extra_args(300) == {"timeout": 300}
|
||||
assert request_timeout_extra_args(10) == {"timeout": 10}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue