Repository navigation
fix(deepseek): send the reasoning of a streamed tool call turn back - #1066
Open
skybleak333 wants to merge 1 commit into
Open
skybleak333 wants to merge 1 commit into
skybleak333 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
With thinking on, which is DeepSeek's default, DeepSeek needs the
reasoning_contentof every earlier turn back when the request carriestools: "If your code does not correctly pass backreasoning_content, the API will return a 400 error" (thinking mode guide). #1020 did that forasText(). The stream handler emitted the reasoning deltas asThinkingEvents but didn't keep them, and added the tool call turn asnew AssistantMessage($text, $mappedToolCalls), so a streamed request with tools failed on the request after the first tool call.The stream handler now collects the reasoning of the step, like the OpenRouter and Gemini streams do, and puts it in the assistant message as
reasoning_content, the same wayTextdoes, soMessageMapsends it back.New test: a streamed step with reasoning and a tool call, then the answer; it checks the second request carries the reasoning on the assistant message and fails without the change. The full suite, PHPStan, Pint and Rector pass. This touches
DeepSeek/Handlers/Stream.phplike #1054, in other lines.