[auto-detect] match Ring-2.6/Ling XML kv tool-call format via vocab signature (#25366)

This commit is contained in:
Xinyuan Tong
2026-05-20 23:34:52 -07:00
committed by GitHub
parent 45cadc215f
commit 40faf44f7a
2 changed files with 37 additions and 0 deletions
@@ -199,6 +199,16 @@ def _is_glm45(ctx):
)
def _is_xml_kv_tool_call(ctx):
# Structural signature for the GLM-4.5 / GLM-4.6 style tool-call format
# (`<tool_call>name<arg_key>k</arg_key>\n<arg_value>v</arg_value>...</tool_call>`).
# Matches any model whose tokenizer carries `<arg_key>` and `<arg_value>` as
# added tokens — e.g., inclusionAI/Ring-2.6, which borrows GLM's tool-call
# format but doesn't share the `[gMASK]<sop>` / `enable_thinking` family
# signature checked by `_is_glm45`.
return ctx.has_vocab("<arg_key>") and ctx.has_vocab("<arg_value>")
def _is_mimo(ctx):
return ctx.reasoning_config == ReasoningToggleConfig(
toggle_param="enable_thinking", default_enabled=False
@@ -268,6 +278,9 @@ TOOL_CALL_PARSER_RULES = (
DetectionRule(name="interns1", value="interns1", predicate=_is_interns1),
DetectionRule(name="mistral", value="mistral", predicate=_is_mistral),
DetectionRule(name="glm45", value="glm45", predicate=_is_glm45),
DetectionRule(
name="xml_kv_tool_call", value="glm45", predicate=_is_xml_kv_tool_call
),
DetectionRule(name="mimo", value="mimo", predicate=_is_mimo),
DetectionRule(name="qwen", value="qwen", predicate=_is_qwen3),
DetectionRule(name="deepseek_v3", value="deepseekv3", predicate=_is_deepseek_v3),