Prhub

#47619 [Rust Frontend] Add DeepSeek V3.2 roundtrip fixture

原始 PR 作者 reidliu41 合并时间 2026-07-07 10:47 文件变更 1 提交数 1 评论 5 代码增减 +14 / -0

执行摘要

添加 DeepSeek V3.2 往返测试 fixture

提供 DeepSeek V3.2 在 Rust chat 前端的 roundtrip 测试覆盖,确保 DSML tool-call 路径正常工作。

值得合并,测试覆盖简单且聚焦,有助于确保 Rust 前端对 DeepSeek V3.2 DSML tool-call 路径的支持。

讨论亮点

BugenZhao 询问为何只启用 tool_call_mix 而不启用 reasoning_and_content。reidliu41 解释:reasoning_and_content fixture 会测试 thinking-disabled 和 default-thinking 路径,这些路径会生成纯文本 assistant 消息,而 DeepSeek V3.2 专用渲染器要求最后一个用户消息后必须是推理或 tool call 消息,否则会拒绝。因此 reasoning_and_content 无法直接使用。BugenZhao 同意专注于 tool-call roundtrip。

实现拆解

  1. 新增 RoundtripCase::deepseek_v32 方法:在 rust/src/chat/tests/roundtrip.rs 中,添加 fn deepseek_v32(),配置模型 ID 为 deepseek-ai/DeepSeek-V3.2-Exp,设置 assistant_stop_suffix"<|end▁of▁sentence|>",使用 Auto 解析器和 Toggleable 思考行为(默认关闭),与 DeepSeek V4 配置类似。
  2. 注册测试宏:在 roundtrip_tests! 宏中增加 deepseek_v32 => [tool_call_mix] 条目,仅启用 tool_call_mix fixture,不启用 reasoning_and_content fixture。
文件 模块 状态 重要度
rust/src/chat/tests/roundtrip.rs 往返测试 modified 4.37

关键符号

deepseek_v32

关键源码片段

rust/src/chat/tests/roundtrip.rs test-coverage

新增 DeepSeek V3.2 测试用例定义和注册,是本次唯一变更的文件。

rust/src/chat/tests/roundtrip.rs// 新增 RoundtripCase 方法,配置 DeepSeek V3.2 模型和解析器
/// DeepSeek V3.2 DSML tool-call format.
fn deepseek_v32() -> Self {
    Self {
        model_id: "deepseek-ai/DeepSeek-V3.2-Exp",
        assistant_stop_suffix: "<|end▁of▁sentence|>",
        tool_call_parser: ParserSelection::Auto,
        reasoning_parser: ParserSelection::Auto,
        thinking_behavior: ThinkingBehavior::Toggleable { default: false },
        json_fmt: compact_json_fmt(),
        sort_json_keys: false,
    }
}// 在 roundtrip_tests! 宏中注册,仅启用 tool_call_mix fixture
roundtrip_tests! {
    // ... 其他用例 ...
    deepseek_v32 => [tool_call_mix], // 仅 tool_call_mix,原因见讨论
    // ...
}

评论区精华

是否启用 `reasoning_and_content` fixture 设计

BugenZhao 询问为何只启用 `tool_call_mix` 而不启用 `reasoning_and_content`。reidliu41 解释:`reasoning_and_content` fixture 包含 thinking-disabled 路径,会生成纯文本消息,而 DeepSeek V3.2 渲染器要求最后一条消息必须是推理或 tool call,导致失败。

结论:仅启用 `tool_call_mix` fixture,该 fixture 也覆盖了推理内容场景。 · 已解决

风险与影响

风险极低:仅新增测试用例,不涉及生产代码变更。但需注意,如果 DeepSeek V3.2 模型或渲染器行为将来发生变化,此 fixture 可能变得不准确或需要调整。

影响范围很小,仅限于 Rust chat 前端的 roundtrip 测试集,增加 DeepSeek V3.2 的 tool-call 往返测试覆盖,提高测试信心。

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论