fix(llm): read a dated Claude snapshot's version without its date (#1585)

- claude-sonnet-4-20250514 no longer receives the effort setting it rejects, and claude-opus-4-5-20251101 now receives it
This commit is contained in:
Yijia-Xiao
2026-10-27 08:00:30 +00:00
parent 347974a000
commit ae0424745e
2 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -28,6 +28,8 @@ class TestEffortGate:
"claude-haiku-4-5", "claude-haiku-5-0", "claude-haiku-4-7-preview",
# Sonnet 4.5 (and earlier) 400 on effort — only Sonnet 4.6+ supports it.
"claude-sonnet-4-5", "claude-sonnet-4-0",
# A dated snapshot's date is not its minor version (#1585).
"claude-sonnet-4-20250514", "claude-opus-4-20250514", "claude-sonnet-4-5-20250929",
],
)
def test_unsupported_models_do_not_receive_effort(self, monkeypatch, model):
@@ -39,7 +41,7 @@ class TestEffortGate:
"model",
[
"claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7",
"claude-sonnet-4-6",
"claude-sonnet-4-6", "claude-opus-4-5-20251101",
],
)
def test_current_opus_and_sonnet_receive_effort(self, monkeypatch, model):
@@ -15,12 +15,13 @@ _PASSTHROUGH_KWARGS = (
# Sonnet 4.6+, and the Claude 5 family (Sonnet 5, Opus 5.5, Fable 5). Sonnet 4.5 and any
# Haiku version 400 with ``"This model does not support the effort parameter"``
# (#831). Versions may be dotted (``opus-4-8``) or single-number (``sonnet-5``,
# ``fable-5``); the per-family minimum below is forward-compatible.
# ``fable-5``), and a snapshot carries its date (``sonnet-4-20250514``), which is
# not a minor version; the per-family minimum below is forward-compatible.
_EFFORT_EXACT = {
"claude-mythos-preview", # non-standard preview name; effort-capable
"claude-mythos-5", # Fable 5 twin (Project Glasswing); effort-capable
}
_EFFORT_MODEL = re.compile(r"^claude-(opus|sonnet|fable)-(\d+)(?:-(\d+))?$")
_EFFORT_MODEL = re.compile(r"^claude-(opus|sonnet|fable)-(\d+)(?:-(\d{1,2}))?(?:-\d{8})?$")
_EFFORT_MIN_VERSION = {"opus": (4, 5), "sonnet": (4, 6), "fable": (5, 0)}