Conversation
Streamed thinking deltas carry only a thinking=true marker since 9fe9f9c, so a streaming caller cannot show thinking as it arrives. When the model calls a tool, the per-round aggregated message holding the thinking is consumed by the tool-calling loop, so the thinking text never reaches the caller at all. Expose each delta's text in a thinkingText metadata key, keeping the content null so it is still not aggregated into the assistant message text. Signed-off-by: pengjonas <pengjonas@gmail.com>
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.
Streamed thinking deltas only carry a thinking=true marker since 9fe9f9c, which removed the text to stop it being aggregated into the assistant message. As a result, a streaming caller has no thinking text to show, and when the model calls a tool none reaches the caller at all. The per-round aggregated message holding it is consumed by the tool-calling loop.
This exposes each delta's text in a thinkingText metadata key. The chunk content stays null, so the fix from 9fe9f9c (no spurious TextBlockParam on replay) is kept.
Reproduction: ChatClient streaming, thinkingEnabled(10000), a question that makes Claude Sonnet 4.6 call two tools. 2.0.1 streams 18 thinking chunks with 0 characters of thinking text. With this change it streams the full text, and the answer text is unchanged. 1.1.x streamed thinking text in this scenario.
See spring-projects/spring-ai#6845 for the same problem in Bedrock Converse. Could this be considered for 2.0.x?