Skip to content

Add DeepSeek DSML inline tool-call recovery - #181

Merged
setoelkahfi merged 1 commit into
developmentfrom
fix/dsml-inline-tool-calls
Oct 7, 2026
Merged

setoelkahfi merged 1 commit into
developmentfrom
fix/dsml-inline-tool-calls

Conversation

@setoelkahfi

Copy link
Copy Markdown
Collaborator

Summary

  • Recovers DeepSeek-family tool calls emitted as literal <|DSML|tool_calls> text instead of structured tool_calls fields, matching the existing GLM XML and Kimi K3 recovery paths.
  • Adds streaming support, including markers split across chunk boundaries (even inside the 3-byte | character), prose-mention detection, and malformed/unterminated block handling.

Test plan

  • cargo fmt -- --check
  • cargo clippy --tests -- -D warnings
  • cargo test --locked

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>

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@setoelkahfi setoelkahfi self-assigned this Oct 7, 2026
@setoelkahfi
setoelkahfi requested a review from paydii October 7, 2026 07:31
@setoelkahfi
setoelkahfi merged commit fb7d28e into development Oct 7, 2026
9 checks passed
@setoelkahfi
setoelkahfi deleted the fix/dsml-inline-tool-calls branch October 7, 2026 19:30
@setoelkahfi

Copy link
Copy Markdown
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants