From c241c7a2b015f8168d1c75e80cee15e45c18ba94 Mon Sep 17 00:00:00 2001 From: Reid <61492567+reidliu41@users.noreply.github.com> Date: Fri, 10 Jul 2026 18:03:58 +0800 Subject: [PATCH] [Rust Frontend] Add roundtrip fixtures for more chat parsers (#47883) Co-authored-by: Bugen Zhao Signed-off-by: reidliu41 Signed-off-by: Bugen Zhao --- rust/src/chat/tests/roundtrip.rs | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/rust/src/chat/tests/roundtrip.rs b/rust/src/chat/tests/roundtrip.rs index b1670814ef..83cf9002be 100644 --- a/rust/src/chat/tests/roundtrip.rs +++ b/rust/src/chat/tests/roundtrip.rs @@ -117,6 +117,19 @@ impl RoundtripCase { } } + /// MiniMax M3 invoke format with `` reasoning tags. + fn minimax_m3() -> Self { + Self { + model_id: "MiniMaxAI/MiniMax-M3", + assistant_stop_suffix: "[e~[\n", + tool_call_parser: ParserSelection::Auto, + reasoning_parser: ParserSelection::Auto, + thinking_behavior: ThinkingBehavior::Always { value: true }, + json_fmt: compact_json_fmt(), + sort_json_keys: false, + } + } + /// DeepSeek V4 DSML tool-call format. fn deepseek_v4() -> Self { Self { @@ -143,6 +156,19 @@ impl RoundtripCase { } } + /// GLM-4.5 XML-like argument format with `` reasoning tags. + fn glm45() -> Self { + Self { + model_id: "zai-org/GLM-4.5", + assistant_stop_suffix: "", + tool_call_parser: ParserSelection::Auto, + reasoning_parser: ParserSelection::Auto, + thinking_behavior: ThinkingBehavior::Toggleable { default: true }, + json_fmt: compact_json_fmt(), + sort_json_keys: false, + } + } + /// GLM-4.7 XML-like argument format with `` reasoning tags. fn glm47() -> Self { Self { @@ -209,6 +235,19 @@ impl RoundtripCase { } } + /// Nemotron V3 with `` / `` reasoning tags. + fn nemotron_v3() -> Self { + Self { + model_id: "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16", + assistant_stop_suffix: "<|im_end|>\n", + tool_call_parser: ParserSelection::Auto, + reasoning_parser: ParserSelection::Auto, + thinking_behavior: ThinkingBehavior::Always { value: true }, + json_fmt: compact_json_fmt(), + sort_json_keys: false, + } + } + /// GPT-OSS Harmony token-id renderer and native Harmony output processor. fn gpt_oss() -> Self { Self { @@ -247,11 +286,14 @@ roundtrip_tests! { qwen3 => [reasoning_and_content, tool_call_mix], qwen35 => [reasoning_and_content, tool_call_mix], minimax_m25 => [reasoning_and_content, tool_call_mix], + minimax_m3 => [reasoning_and_content, tool_call_mix], deepseek_v4 => [reasoning_and_content, tool_call_mix], deepseek_v32 => [tool_call_mix], + glm45 => [reasoning_and_content, tool_call_mix], glm47 => [reasoning_and_content, tool_call_mix], seed_oss => [reasoning_and_content], step3p5 => [reasoning_and_content], + nemotron_v3 => [reasoning_and_content], gemma4 => [tool_call_mix], // Gemma4 strips reasoning in history if there's no tool call kimi_k25 => [tool_call_mix], // Kimi K2.5 strips reasoning in history gpt_oss => [tool_call_mix], // Harmony strips reasoning in history if there's no tool call