AgentSkillsProviderBuilder.UseSource 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 |
|---|---|
| UseSource(AgentSkillsSource) |
Adds a custom skill source. |
| UseSource(Func<ILoggerFactory,AgentSkillsSource>) |
Adds a custom skill source created by a factory that receives the builder's logger factory at build time. Use this overload when the source needs logging and should not require the caller to pass an ILoggerFactory explicitly. |
UseSource(AgentSkillsSource)
Adds a custom skill source.
public Microsoft.Agents.AI.AgentSkillsProviderBuilder UseSource(Microsoft.Agents.AI.AgentSkillsSource source);
member this.UseSource : Microsoft.Agents.AI.AgentSkillsSource -> Microsoft.Agents.AI.AgentSkillsProviderBuilder
Public Function UseSource (source As AgentSkillsSource) As AgentSkillsProviderBuilder
Parameters
- source
- AgentSkillsSource
The custom skill source.
Returns
This builder instance for chaining.
Remarks
The provider returned by Build() takes ownership of source and disposes it when the provider is disposed. Because the same instance is reused on every Build() call, do not build more than one provider from a builder that captures a shared source; otherwise disposing one provider would dispose the source out from under the others. To build multiple providers, use the UseSource(Func<ILoggerFactory,AgentSkillsSource>) overload, which creates a fresh source per build, or pass the source directly to an AgentSkillsProvider constructor with ownsSource: false to retain ownership.
Applies to
UseSource(Func<ILoggerFactory,AgentSkillsSource>)
Adds a custom skill source created by a factory that receives the builder's logger factory at build time. Use this overload when the source needs logging and should not require the caller to pass an ILoggerFactory explicitly.
public Microsoft.Agents.AI.AgentSkillsProviderBuilder UseSource(Func<Microsoft.Extensions.Logging.ILoggerFactory?,Microsoft.Agents.AI.AgentSkillsSource> factory);
member this.UseSource : Func<Microsoft.Extensions.Logging.ILoggerFactory, Microsoft.Agents.AI.AgentSkillsSource> -> Microsoft.Agents.AI.AgentSkillsProviderBuilder
Public Function UseSource (factory As Func(Of ILoggerFactory, AgentSkillsSource)) As AgentSkillsProviderBuilder
Parameters
- factory
- Func<ILoggerFactory,AgentSkillsSource>
A factory that creates the skill source given an optional logger factory.
Returns
This builder instance for chaining.