Force reasoning mode for GLM-5.3 chat templates (#39227)
Co-authored-by: Brayden Zhong <b8zhong@uwaterloo.ca> Co-authored-by: Mohammad Angkad <mohammad.angkad@radixark.ai> Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com> Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
This commit is contained in:
co-authored by
Brayden Zhong
Mohammad Angkad
Xinyuan Tong
Xinyuan Tong
parent
ebd37705e4
commit
6c514ab025
@@ -168,6 +168,13 @@ REASONING_MODE_RULES = (
|
||||
and not ctx.has_text("thinking")
|
||||
),
|
||||
),
|
||||
DetectionRule(
|
||||
name="glm53_always_think",
|
||||
value=ReasoningToggleConfig(special_case="always"),
|
||||
# GLM-5.3's generation prompt opens <think>, so the output carries no
|
||||
# opening tag; lambda because _is_glm53 is defined below.
|
||||
predicate=lambda ctx: _is_glm53(ctx),
|
||||
),
|
||||
DetectionRule(
|
||||
name="mistral_reasoning_effort",
|
||||
value=ReasoningToggleConfig(special_case="mistral"),
|
||||
|
||||
@@ -116,6 +116,13 @@ class TestTemplateManagerReasoningDetection(unittest.TestCase):
|
||||
"glm47",
|
||||
)
|
||||
|
||||
def test_glm53_effort_template_forces_reasoning(self):
|
||||
vocab = ["<tool_call>", "<arg_key>", "<arg_value>", "<|user|>", "<|endoftext|>"]
|
||||
force, config, _ = self._detect(_glm53_template("+"), vocab)
|
||||
|
||||
self.assertTrue(force)
|
||||
self.assertEqual(config, ReasoningToggleConfig(special_case="always"))
|
||||
|
||||
def test_interns1_detects_enable_thinking_default_true(self):
|
||||
template = """
|
||||
{% set default_thinking_sys %}...<think>...</think>{% endset %}
|
||||
|
||||
Reference in New Issue
Block a user