MicrosoftExtensionsAIResponsesExtensions.AsAITool(ResponseTool) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an AITool to represent a raw ResponseTool.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::AI::AITool ^ AsAITool(OpenAI::Responses::ResponseTool ^ tool);
public static Microsoft.Extensions.AI.AITool AsAITool(this OpenAI.Responses.ResponseTool tool);
static member AsAITool : OpenAI.Responses.ResponseTool -> Microsoft.Extensions.AI.AITool
<Extension()>
Public Function AsAITool (tool As ResponseTool) As AITool
Parameters
- tool
- ResponseTool
The tool to wrap as an AITool.
Returns
The tool wrapped as an AITool.
Remarks
The returned tool is only suitable for use with the IChatClient returned by AsIChatClient(OpenAIResponseClient) (or IChatClients that delegate to such an instance). It is likely to be ignored by any other IChatClient implementation.
When a tool has a corresponding AITool-derived type already defined in Microsoft.Extensions.AI, such as AIFunction, HostedWebSearchTool, HostedMcpServerTool, or HostedFileSearchTool, those types should be preferred instead of this method, as they are more portable, capable of being respected by any IChatClient implementation. This method does not attempt to map the supplied ResponseTool to any of those types, it simply wraps it as-is: the IChatClient returned by AsIChatClient(OpenAIResponseClient) will be able to unwrap the ResponseTool when it processes the list of tools.