fix: address review — remove redundant guard, add regression tests
- Drop the now-subsumed `normalized.startswith("qwen")` guard
(token-prefix matching already covers the bare case)
- Add test_qwen_prefixed_alias_reasoning_detection covering:
prefixed Qwen 3+ (al-/sn-), bare Qwen 3+, and Qwen 2.x exclusion
This commit is contained in:
1 parent
041e311f1e
commit
90250adfb7
2 files changed
+41
-3
No files matched your search
+4
-3
@@ -3316,11 +3316,12 @@ def _candidate_supports_reasoning(candidate: str) -> bool:
|
||||
if major >= 4 or (major == 3 and minor >= 7):
|
||||
return True
|
||||
return False
|
||||
if any(token.startswith("qwen") for token in tokens) or normalized.startswith("qwen"):
|
||||
if any(token.startswith("qwen") for token in tokens):
|
||||
# Restrict to Qwen 3+ (exclude Qwen 2/2.5)
|
||||
# Use token-prefix matching (position-independent) so prefixed ids like
|
||||
# Token-prefix matching (position-independent) so prefixed ids like
|
||||
# "al-qwen3-8-max-preview" (tokens: ["al","qwen3","8",...]) still match,
|
||||
# even though "qwen" is not a standalone token.
|
||||
# even though "qwen" is not a standalone token. The bare
|
||||
# normalized.startswith("qwen") case is subsumed by this check.
|
||||
match = re.search(r"qwen.*?(\d+)(?:\D+(\d+))?", normalized)
|
||||
if match:
|
||||
major = int(match.group(1))
|
||||
|
||||
@@ -514,3 +514,40 @@ def test_datestamped_claude3_not_reasoning_capable_heuristic():
|
||||
f"{model} must remain reasoning-capable"
|
||||
)
|
||||
|
||||
|
||||
def test_qwen_prefixed_alias_reasoning_detection():
|
||||
"""Prefixed Qwen IDs (e.g. New-API aliases) must still be detected.
|
||||
|
||||
Regression: "al-qwen3.8-max-preview" normalizes to tokens
|
||||
["al", "qwen3", "8", ...] where "qwen" is NOT a standalone token,
|
||||
so the old exact-membership check silently failed.
|
||||
"""
|
||||
# Prefixed Qwen 3+ → reasoning-capable
|
||||
for model in (
|
||||
"al-qwen3.8-max-preview",
|
||||
"al-qwen3.7-max",
|
||||
"al-qwen3.7-plus",
|
||||
"al-qwen3.6-flash",
|
||||
"sn-qwen3-235b-a22b",
|
||||
):
|
||||
assert cfg._candidate_supports_reasoning(model) is True, (
|
||||
f"{model} must be reasoning-capable (prefixed Qwen 3+)"
|
||||
)
|
||||
# Bare Qwen 3+ → still works
|
||||
for model in (
|
||||
"qwen3-235b-a22b",
|
||||
"qwen3-32b",
|
||||
):
|
||||
assert cfg._candidate_supports_reasoning(model) is True, (
|
||||
f"{model} must be reasoning-capable (bare Qwen 3+)"
|
||||
)
|
||||
# Qwen 2.x → excluded regardless of prefix
|
||||
for model in (
|
||||
"al-qwen2.5-72b-instruct",
|
||||
"qwen2.5-7b-instruct",
|
||||
"qwen2-72b",
|
||||
):
|
||||
assert cfg._candidate_supports_reasoning(model) is False, (
|
||||
f"{model} must NOT be reasoning-capable (Qwen 2.x excluded)"
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user