Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Sep 16, 2025

For someone that knows they're using an OpenAI Responses IChatClient, they can Add a ResponseTool directly into ChatOptions.Tools, rather than needing to go through RawRepresentationFactory.

Microsoft Reviewers: Open in CodeFlow

For someone that knows they're using an OpenAI Responses IChatClient, they can Add a ResponseTool directly into ChatOptions.Tools, rather than needing to go through RawRepresentationFactory.
@stephentoub stephentoub requested a review from a team as a code owner September 16, 2025 18:25
@stephentoub stephentoub requested review from Copilot and removed request for a team September 16, 2025 18:25
@stephentoub
Copy link
Member Author

@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Sep 16, 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 adds convenience extension methods to enable direct use of OpenAI ResponseTool objects with the Microsoft.Extensions.AI framework. It introduces methods to add ResponseTool instances to IList collections and wrap them as AITool objects.

Key changes:

  • Added IList<AITool>.Add(ResponseTool) extension method for direct addition of ResponseTool to tool collections
  • Added ResponseTool.AsAITool() extension method to wrap ResponseTool instances as AITool objects
  • Added internal ResponseToolAITool wrapper class to bridge ResponseTool and AITool types

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MicrosoftExtensionsAIResponsesExtensions.cs Added extension methods for ResponseTool to AITool conversion
OpenAIResponsesChatClient.cs Added internal ResponseToolAITool wrapper class and handling logic
OpenAIConversionTests.cs Added unit tests for the new extension methods
OpenAIResponseClientTests.cs Updated existing test to verify both raw and wrapped tool usage
CHANGELOG.md files Updated changelog entries to document the new functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@stephentoub stephentoub merged commit cdb9ce4 into dotnet:main Sep 17, 2025
7 checks passed
@stephentoub stephentoub deleted the asaitool branch September 17, 2025 13:56
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