-
Notifications
You must be signed in to change notification settings - Fork 839
Fix a couple of issues in M.E.AI.OpenAI clients #6827
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 two issues in the Microsoft.Extensions.AI.OpenAI clients: preventing failures when setting AllowMultipleToolCalls without tools, and handling participant names with invalid characters through sanitization.
- Conditionally set AllowMultipleToolCalls only when tools are present to prevent API failures
- Implement author name sanitization to remove invalid characters for OpenAI participant names
- Add comprehensive test coverage for the participant name sanitization functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
OpenAIChatClient.cs | Adds author name sanitization logic and conditional AllowMultipleToolCalls setting |
OpenAIResponsesChatClient.cs | Moves AllowMultipleToolCalls setting to only apply when tools exist |
OpenAIConversionTests.cs | Updates tests to verify participant name sanitization behavior |
CHANGELOG.md | Documents the bug fixes in the release notes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs
Outdated
Show resolved
Hide resolved
1. Setting AllowMultipleToolCalls if there aren't any tools results in failure. Fix it to only set the property if tools have been added. 2. The chat completion service fails if a participant name containing anything other than a constrained set of characters are included. Fix it with a sanitized value.
f49d03d
to
b039725
Compare
1. Setting AllowMultipleToolCalls if there aren't any tools results in failure. Fix it to only set the property if tools have been added. 2. The chat completion service fails if a participant name containing anything other than a constrained set of characters are included. Fix it with a sanitized value.
Microsoft Reviewers: Open in CodeFlow