HostedAgentBuilderExtensions.WithAITool 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.
Overloads
| Name | Description |
|---|---|
| WithAITool(IHostedAgentBuilder, AITool) |
Adds an AI tool to an agent being configured with the service collection. |
| WithAITool(IHostedAgentBuilder, Func<IServiceProvider,AITool>) |
Adds AI tool to an agent being configured with the service collection. |
WithAITool(IHostedAgentBuilder, AITool)
Adds an AI tool to an agent being configured with the service collection.
public static Microsoft.Agents.AI.Hosting.IHostedAgentBuilder WithAITool(this Microsoft.Agents.AI.Hosting.IHostedAgentBuilder builder, Microsoft.Extensions.AI.AITool tool);
static member WithAITool : Microsoft.Agents.AI.Hosting.IHostedAgentBuilder * Microsoft.Extensions.AI.AITool -> Microsoft.Agents.AI.Hosting.IHostedAgentBuilder
<Extension()>
Public Function WithAITool (builder As IHostedAgentBuilder, tool As AITool) As IHostedAgentBuilder
Parameters
- builder
- IHostedAgentBuilder
The hosted agent builder.
- tool
- AITool
The AI tool to add to the agent.
Returns
The same IHostedAgentBuilder instance so that additional calls can be chained.
Exceptions
Thrown when builder or tool is null.
Applies to
WithAITool(IHostedAgentBuilder, Func<IServiceProvider,AITool>)
Adds AI tool to an agent being configured with the service collection.
public static Microsoft.Agents.AI.Hosting.IHostedAgentBuilder WithAITool(this Microsoft.Agents.AI.Hosting.IHostedAgentBuilder builder, Func<IServiceProvider,Microsoft.Extensions.AI.AITool> factory);
static member WithAITool : Microsoft.Agents.AI.Hosting.IHostedAgentBuilder * Func<IServiceProvider, Microsoft.Extensions.AI.AITool> -> Microsoft.Agents.AI.Hosting.IHostedAgentBuilder
<Extension()>
Public Function WithAITool (builder As IHostedAgentBuilder, factory As Func(Of IServiceProvider, AITool)) As IHostedAgentBuilder
Parameters
- builder
- IHostedAgentBuilder
The hosted agent builder.
- factory
- Func<IServiceProvider,AITool>
A factory function that creates a AI tool using the provided service provider.