Add MiniCPM5 tool call parser for XML-style function calls (#25600)

Co-authored-by: zhangtao <zhangtao2@modelbest.cn>
This commit is contained in:
zhangtao2-1
2026-05-22 23:09:40 +08:00
committed by GitHub
co-authored by zhangtao
parent f5ed2687ec
commit 6baa859a86
5 changed files with 645 additions and 0 deletions
@@ -219,6 +219,12 @@ def _is_minimax(ctx):
return ctx.has_text("<minimax:tool_call>")
def _is_minicpm5(ctx):
if ctx.has_vocab("<function") and ctx.has_vocab("<param"):
return True
return ctx.has_pattern(r"<function\s+name=") and ctx.has_pattern(r"<param\s+name=")
def _is_qwen3(ctx):
return ctx.reasoning_config == ReasoningToggleConfig(
toggle_param="enable_thinking", default_enabled=True
@@ -278,6 +284,7 @@ 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="minicpm5", value="minicpm5", predicate=_is_minicpm5),
DetectionRule(
name="xml_kv_tool_call", value="glm45", predicate=_is_xml_kv_tool_call
),