Fix ChunkMerger streaming: NoSuchElementException, empty id, reasoning_content#6522
Closed
freshman-wang wants to merge 1 commit into
Closed
Fix ChunkMerger streaming: NoSuchElementException, empty id, reasoning_content#6522freshman-wang wants to merge 1 commit into
freshman-wang wants to merge 1 commit into
Conversation
…g_content - Filter empty string id in mergeDeltas (DashScope sends id="" in continuation chunks) - Guard against empty tcs1 and missing function in mergeDeltas - Pass delta additionalProperties (reasoning_content) to ChatCompletionMessage - Replace Optional.get() with orElse/ifPresent in chunkToChatCompletion Signed-off-by: lingg <244305699@qq.com>
56deb2f to
6281003
Compare
Contributor
|
For review context, this overlaps with #6373 and #6381. #6373 covers the |
6281003 to
1f75959
Compare
Author
|
Closing in favor of #6373 (reasoning_content) and #6381 (empty-id tool-call deltas). After reviewing @jewoodev's comment, I realize this PR overlaps significantly with both. However, there are two
It would be great if #6381 could also cover these |
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.
Problem
Three bugs in ChunkMerger affect streaming tool_calls with OpenAI-compatible providers (DashScope/Qwen, DeepSeek):
Optional.get()without null checks on tool call fieldsid=""in continuation chunks,Optional.of("")passesisPresent(), so fragments are never mergedchunkToChatCompletiononly copiescontent+refusal, drops provider-specific fieldsFix
mergeDeltastcs1+function().orElseGet()delta._additionalProperties()toChatCompletionMessageOptional.get()withorElse("")/ifPresent()Fixes #6484