PersistentAgentsClientExtensions.AsAITool(ToolDefinition) 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 ToolDefinition.
public static Microsoft.Extensions.AI.AITool AsAITool(this Azure.AI.Agents.Persistent.ToolDefinition tool);
static member AsAITool : Azure.AI.Agents.Persistent.ToolDefinition -> Microsoft.Extensions.AI.AITool
<Extension()>
Public Function AsAITool (tool As ToolDefinition) As AITool
Parameters
- tool
- ToolDefinition
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(PersistentAgentsClient, String, String, Boolean) (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, 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 ToolDefinition to any of those types, it simply wraps it as-is: the IChatClient returned by AsIChatClient(PersistentAgentsClient, String, String, Boolean) will be able to unwrap the ToolDefinition when it processes the list of tools.