Repository navigation
Add DeepSeek DSML inline tool-call recovery - #181
Conversation
DeepSeek-family endpoints can emit tool calls as literal <|DSML|tool_calls> text instead of structured tool_calls fields. This adds a recovery path for that format, matching the existing GLM XML and Kimi K3 paths: a scanner gate for prose mentions, block parsing for invoke/parameter elements, and streaming support including markers split across chunk boundaries. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
This change adds support for recovering DeepSeek-family DSML inline tool calls, matching the recovery logic for GLM XML and Kimi K3 formats. It introduces new constants for DSML markers, parsing functions for DSML blocks and parameters, and integrates DSML detection and extraction into the StreamScanner, including streaming support with chunk boundary handling. The test suite is expanded with comprehensive cases for DSML, covering multiple invokes, string and JSON parameter typing, schema fallback, malformed/unterminated blocks, unknown tools, prose-mention detection, and streaming edge cases. All previous findings appear addressed, and the new logic is well-covered by tests.
Automated review by siGit Code Review · commit c0f0e1c · see the review dashboard
Summary
<|DSML|tool_calls>text instead of structuredtool_callsfields, matching the existing GLM XML and Kimi K3 recovery paths.|character), prose-mention detection, and malformed/unterminated block handling.Test plan
cargo fmt -- --checkcargo clippy --tests -- -D warningscargo test --locked