-
Notifications
You must be signed in to change notification settings - Fork 834
Fix handling of multiple responses messages #6627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with handling multiple response messages from the OpenAI Response API. The fix addresses a bug where multiple response messages with different IDs were being merged into a single message instead of being treated as separate messages.
- Adds logic to detect when a new message with a different ID should create a separate ChatMessage instance
- Removes a redundant property assignment that was adding the message ID to AdditionalProperties
- Includes comprehensive test coverage for the multiple response messages scenario
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponseChatClient.cs | Adds logic to create new ChatMessage instances when processing multiple response messages with different IDs |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs | Adds test case to verify correct handling of multiple output messages in non-streaming scenarios |
Fixes #6626
Microsoft Reviewers: Open in CodeFlow