fix: return ContentThinkingDelta from completions provider streaming#301
Merged
Conversation
OpenAICompletionsProvider.stream_content() was returning ContentThinking (the finalized type) instead of ContentThinkingDelta (the streaming fragment type). The TurnAccumulator only recognizes ContentThinkingDelta, so thinking content was silently dropped during streaming for all completions-based providers (DeepSeek, Groq, OpenRouter, etc.). Closes #300
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes streaming “thinking/reasoning” handling for completions-based providers by ensuring streaming chunks emit ContentThinkingDelta (the expected streaming fragment type) instead of ContentThinking (the finalized, non-streaming type), allowing TurnAccumulator to correctly detect and surface thinking blocks during streaming.
Changes:
- Update
OpenAICompletionsProvider.stream_content()to returnContentThinkingDeltawhenreasoning_contentis present. - Update the corresponding unit test to assert
ContentThinkingDeltais produced for reasoning chunks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| chatlas/_provider_openai_completions.py | Emit ContentThinkingDelta for reasoning_content during streaming so downstream streaming logic can recognize thinking chunks. |
| tests/test_provider_openai_completions.py | Adjust test to validate the corrected streaming content type for reasoning chunks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cpsievert
added a commit
that referenced
this pull request
May 12, 2026
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.
Summary
OpenAICompletionsProvider.stream_content()was returningContentThinking(the finalized type for completed turns) instead ofContentThinkingDelta(the streaming fragment type)TurnAccumulatoronly recognizesContentThinkingDeltafor thinking block handling, so thinking content was silently dropped during streamingCloses #300
Test plan
test_stream_content_extracts_reasoning_contentupdated to assertContentThinkingDeltatest_stream_thinking.pypass (verify thinking deltas flow throughTurnAccumulatorcorrectly)test_response_as_turn_extracts_reasoning_contentstill passes (non-streaming path unchanged)