Skip to content

IAIFunctionProvider

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework

IAIFunctionProvider Interface

Provides pre-built Microsoft.Extensions.AI.AIFunction instances for agent function types. Implemented by the source generator to eliminate reflection-based function discovery.

public interface IAIFunctionProvider

Methods

IAIFunctionProvider.TryGetFunctions(Type, IServiceProvider, IReadOnlyList<AIFunction>) Method

Attempts to retrieve the pre-built Microsoft.Extensions.AI.AIFunction instances for a given function type.

bool TryGetFunctions(System.Type functionType, System.IServiceProvider serviceProvider, out System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.AIFunction>? functions);

Parameters

functionType System.Type

The function class type to look up.

serviceProvider System.IServiceProvider

The service provider used to resolve the function class instance when needed. The provider handles instance creation to avoid reflection-based activation.

functions System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.AIFunction>

When this method returns true, contains the pre-built functions for the type.

Returns

System.Boolean
true if the provider has pre-built functions for functionType; otherwise false.