Fix streaming reasoning conversion to preserve extra fields#11669
Open
shr8769 wants to merge 2 commits into
Open
Fix streaming reasoning conversion to preserve extra fields#11669shr8769 wants to merge 2 commits into
shr8769 wants to merge 2 commits into
Conversation
|
Someone is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
**Root Cause:** OpenAI Responses API v2 sends encrypted_content and other metadata in reasoning items to preserve reasoning context across multi-turn conversations. However, _convert_streaming_chunks_to_chat_message() was discarding all extra fields except id and type, breaking multi-turn reasoning interactions. **Fix Summary:** Modified lines 810-824 of openai_responses.py to aggregate all extra fields from streaming reasoning chunks instead of discarding them. Uses loop + update() to collect all metadata, then setdefault() for id and type to ensure they're always present without overriding existing values. **Regression Test Added:** New test test_convert_streaming_chunks_to_chat_message_preserves_encrypted_content() verifies that encrypted_content, status, and other provider metadata survive the streaming conversion round-trip. **Test Commands Run:** - pytest test/components/generators/chat/test_openai_responses_conversion.py -xvs: ✅ All 14 tests pass - pytest test/components/generators/test_utils.py -k streaming --tb=short -xvs: ✅ All 14 tests pass Fixes deepset-ai#11658
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.
Root Cause:
OpenAI Responses API v2 sends encrypted_content and other metadata in reasoning items to preserve reasoning context across multi-turn conversations. However, _convert_streaming_chunks_to_chat_message() was discarding all extra fields except id and type, breaking multi-turn reasoning interactions.
Fix Summary:
Modified lines 810-824 of openai_responses.py to aggregate all extra fields from streaming reasoning chunks instead of discarding them. Uses loop + update() to collect all metadata, then setdefault() for id and type to ensure they're always present without overriding existing values.
Regression Test Added:
New test test_convert_streaming_chunks_to_chat_message_preserves_encrypted_content() verifies that encrypted_content, status, and other provider metadata survive the streaming conversion round-trip.
Test Commands Run:
Fixes #11658
Related Issues
Proposed Changes:
How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.