Repository navigation
docs: document DeepSeek V4/V4.1 behavior for tool_choice required - #686
Conversation
|
A case file has been opened for 686. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe new required-mode prose in
Walkthrough
Merge Risk: Low · up to
|
Both docs/api.md and docs/core-design.md stated unconditionally that tool_choice: "required" adds a prompt instruction to call a tool. In Helios, only the Jinja-template and TMLv0 prompt encoders receive the server-appended system instruction (when PromptEncoder::renders_tool_choice returns false in helios/src/server/request.rs). The native DeepSeek V4 and V4.1 prompt encoders return true from renders_tool_choice and handle required mode in their own syntax: in thinking mode, helios/src/frontend/deepseek.rs converts ToolChoice::Required to ToolChoice::Auto so reasoning opens in <think> with no added instruction; in non-thinking mode, the native DeepSeek template opens the DSML tool-call block at the end of the prompt. Updating both specifications aligns the documentation with the implemented runtime behavior without adding runtime complexity. Updated the required-mode descriptions in docs/api.md and docs/core-design.md. Before this change, docs/api.md stated that required mode adds an instruction to call a tool to the prompt, and docs/core-design.md stated that tool_choice=required adds a prompt instruction and requires a completed call to a declared tool. After this change, docs/api.md specifies that Jinja-template and TMLv0 prompt encoders add a system instruction to call a tool to the prompt, while the native DeepSeek V4 and V4.1 prompt encoders add none—rendering required mode identically to "auto" in thinking mode so reasoning starts in <think> and opening the DSML tool-call block at the end of the prompt in non-thinking mode—and that completion validates at least one completed call to a declared tool in all modes. docs/core-design.md now matches that split and links to the conversation and tool semantics section of docs/api.md. No runtime code, wire schemas, or compatibility contracts changed. Expected result: callers and contributors reading either docs/api.md or docs/core-design.md receive a consistent, accurate specification of prompt rendering and completion enforcement for tool_choice: "required" across Jinja-template, TMLv0, and native DeepSeek V4/V4.1 prompt encoders. Verified every documented behavior directly against the checked-out source and tests: PromptEncoder::renders_tool_choice (helios/src/frontend/mod.rs), template_inputs (helios/src/server/request.rs), template_messages (helios/src/server/inference.rs), conversation (helios/src/frontend/deepseek.rs), Encoder::finish (helios/src/server/protocol/encode.rs), and the integration tests required_tools_in_chat_mode_start_inside_the_dsml_envelope and required_and_named_tools_keep_the_thinking_prompt (helios/tests/deepseek_requests.rs). Material limitation: because this commit edits only documentation files (docs/api.md and docs/core-design.md), no compilation, unit test execution, or GPU run was performed on this branch. Signed-off-by: Joshua Cartu <jcartu@users.noreply.github.com> Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
6a2cacc to
9ca1f72
Compare
|
@flare-autobot Addressed both review items in
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergePR #686 cleanly resolves both items from the prior review at head
Walkthrough
Merge Risk: Low · up to
|
Fixes #445
Why
Both
docs/api.mdanddocs/core-design.mdstated unconditionally thattool_choice: "required"adds a prompt instruction to call a tool. In Helios, only the Jinja-template and TMLv0 prompt encoders receive the server-appended system instruction (PromptEncoder::renders_tool_choicereturnsfalseinhelios/src/server/request.rs). The native DeepSeek V4 and V4.1 prompt encoders returntruefromrenders_tool_choiceand handle required mode in their own syntax: in thinking mode,helios/src/frontend/deepseek.rspassesToolChoice::Autoso reasoning starts in<think>with no added prompt instruction; in non-thinking mode, the native DeepSeek template opens the DSML tool-call block at the end of the prompt. Updating both specifications aligns the docs with the implemented runtime behavior without adding runtime branches.What changed
Updated the required-mode descriptions in
docs/api.mdanddocs/core-design.md:docs/api.mdstated that required mode adds an instruction to call a tool to the prompt without distinguishing prompt encoders, anddocs/core-design.mdstated unconditionally thattool_choice=requiredadds a prompt instruction and requires a completed call to a declared tool.docs/api.mdstates that Jinja-template and TMLv0 prompt encoders add a system instruction to call a tool to the prompt, while the native DeepSeek V4 and V4.1 prompt encoders add none—rendering required mode identically to"auto"in thinking mode (so reasoning starts in<think>) and opening the DSML tool-call block at the end of the prompt in non-thinking mode—and that completion validates at least one completed call to a declared tool across all modes.docs/core-design.mdnow matches that split and links todocs/api.md#conversation-and-tool-semantics.No runtime code, wire schemas, or compatibility contracts changed.
Expected result
Callers and contributors reading either
docs/api.mdordocs/core-design.mdreceive a consistent, accurate specification of prompt rendering and completion validation fortool_choice: "required"across Jinja-template, TMLv0, and native DeepSeek V4/V4.1 prompt encoders.Evidence and limitations
Verified each statement directly against the implementation and tests:
PromptEncoder::renders_tool_choice(helios/src/frontend/mod.rs)template_inputs(helios/src/server/request.rs) andtemplate_messages(helios/src/server/inference.rs)conversation(helios/src/frontend/deepseek.rs)Encoder::finish(helios/src/server/protocol/encode.rs)required_tools_in_chat_mode_start_inside_the_dsml_envelopeandrequired_and_named_tools_keep_the_thinking_prompt(helios/tests/deepseek_requests.rs)Limitation: this is a documentation-only change; no build, test suite, or GPU execution was run on this branch.
Discord: jcartu