Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Sep 19, 2025

  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

@stephentoub stephentoub requested a review from a team as a code owner September 19, 2025 19:37
@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 19:37
@stephentoub stephentoub enabled auto-merge (squash) September 19, 2025 19:37
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Sep 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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.

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.
@stephentoub stephentoub merged commit fe1cc44 into dotnet:main Sep 24, 2025
6 checks passed
@stephentoub stephentoub deleted the openaifixes branch September 24, 2025 12:35
jeffhandley pushed a commit that referenced this pull request Sep 24, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants