Repository navigation
fix(server): DeepSeek V4.1 tool calls in its own DSML format - #812
Merged
Merged
Conversation
…L format DeepSeek V4.1 spells DSML tags with a leading-space name (<|DSML| calls>, <|DSML| invoke>, </|DSML| parameter>), opens system turns with <|System|> and takes a numeric reasoning effort (encoding/encoding.py in the model repo). The server rendered the V4 format for both models and parsed only the V4 spelling, so every V4.1 tool call was dropped. - ChatFormat::DEEPSEEK41 renders the V4.1 prompt: <|System|>, the "Reasoning Effort: N (range 1-100, ...)" line in thinking mode, the V4.1 tool block with one schema per line, tool results joined into the user turn, and mid-conversation system turns. - parse_tool_calls maps the V4.1 tag spelling onto the V4 one before matching, so both spellings parse. - Tests: the chat and tool reference renders from the model repo match byte for byte, and a V4.1 tool call parses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dusterbloom
added a commit
to dusterbloom/lucebox-hub
that referenced
this pull request
Oct 6, 2026
…nto feat/qwen4exp-strix-halo
dusterbloom
added a commit
to dusterbloom/lucebox-hub
that referenced
this pull request
Oct 6, 2026
dusterbloom
added a commit
to dusterbloom/lucebox-hub
that referenced
this pull request
Oct 6, 2026
dusterbloom
added a commit
to dusterbloom/lucebox-hub
that referenced
this pull request
Oct 6, 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.
Summary
DeepSeek V4.1 Flash writes tool calls in its own DSML spelling, with a leading space in each tag name:
The server rendered the V4 format for V4.1 (
<|DSML|tool_calls>, no<|System|>, V4's reasoning-effort text) and parsed only the V4 spelling. Every V4.1 tool call failed withtool_call parse failed, so agents on V4.1 could not call tools. The V4.1 format comes fromchat_template.jinjaandencoding/encoding.pyin the deepseek-ai/DeepSeek-V4.1-Flash repo ("V4.1 changes relative to V4").Impact
10 tool prompts (two tools, with and without 9K tokens of context), temperature 0, OpenAI tools API, on an R9700 + Ryzen AI Max+ box:
Every call picks the right tool and argument. V4 (
deepseek4) prompts and parsing are unchanged.Implementation
ChatFormat::DEEPSEEK41, chosen for archdeepseek41, renders the V4.1 prompt:<|System|>at the start in thinking mode or when there is a system prompt or tools;Reasoning Effort: N (range 1-100, ...)in thinking mode (low 50, medium 62, high 75, max 100, or a number);<tool_result>blocks joined into the user turn;parse_tool_callsmaps the V4.1 tag spelling onto the V4 one before matching (normalize_dsml_tags), so every existing pattern accepts both.Validation
test_server_unit(4 new cases;DEEPSEEK41added to the prefix-survival test)encoding/testsreference outputs (chat and tools)Notes
🤖 Generated with Claude Code