Skip to content

fix(streaming): keep the text of a chunk that has an empty reasoning field - #483

Open
pcbeingused333 wants to merge 1 commit into
posit-dev:mainfrom
pcbeingused333:fix/completions-empty-reasoning-text
Open

pcbeingused333 wants to merge 1 commit into
posit-dev:mainfrom
pcbeingused333:fix/completions-empty-reasoning-text

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

OpenAICompletionsProvider.stream_content() checked reasoning is not None. A chunk that carries text together with an empty reasoning / reasoning_content field ("") therefore returned ContentThinkingDelta("") and the chunk's text was never returned. Streaming from an OpenAI-compatible server that sends an empty reasoning field on every chunk lost the streamed text.

The check is now if reasoning:, so an empty reasoning field falls through to the text. A chunk with only an empty reasoning field still adds nothing. This is the shared stream path for the providers built on OpenAICompletionsProvider.

Test: test_stream_content_empty_reasoning_keeps_text builds real ChatCompletionChunks (no network) and fails on main, passes here. CHANGELOG entry added; no issue number yet.

This change was made with Claude Code.

🤖 Generated with Claude Code

🤖 Generated with Claude Code

…field

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant