Repository navigation
[II] Parse legacy direct DeepSeek V4 DSML tool calls - #417
Open
voipmonitor wants to merge 3 commits into
Open
voipmonitor wants to merge 3 commits into
voipmonitor wants to merge 3 commits into
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Aug 17, 2026
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resulting behavior
The DeepSeek V4 parser accepts both fullwidth
|DSML|markers and the legacy ASCII|DSML|spelling. A direct<|DSML|invoke ...>block is emitted as a structured tool call even when the optional outertool_callswrapper is absent.The streaming parser preserves marker fragments across deltas, supports multiple direct invokes, and returns to ordinary assistant content after a direct invoke closes. Wrapped DSML calls retain their existing parallel-call state transitions.
Technical reason
DeepSeek V4 can emit the legacy direct form even when the prompt requests the canonical wrapped representation. Treating the legacy marker as assistant text leaks protocol markup and prevents clients from receiving
tool_calls.The parser registers the legacy terminal set and uses distinct direct-invoke states so the closing marker can return to content without changing wrapped-call behavior.
Compatibility
The change is parser-only. It does not alter prompts, schemas, token sampling, speculative decoding, or canonical fullwidth DSML output.
This pull request supersedes #399. The parser behavior is equivalent, while its compatibility tests live in
test_deepseek_v4_legacy_dsml.py; this keeps the patch mergeable with the Infernal Invocation strict-tool regression stack.Validation
ruff check: pass.dev/infernal-invocationplus the required open Infernal Invocation PR set is conflict-free.