Method AsAIFunction
- Namespace
- IntentSharp.Extensions.AI
- Assembly
- IntentSharp.Extensions.AI.dll
AsAIFunction(IntentRuntime, string, string?, ILogger?)
A tool that runs the named intent through RunAsync(string, object?, CancellationToken).
public static AIFunction AsAIFunction(this IntentRuntime runtime, string name, string? toolName = null, ILogger? logger = null)
Parameters
runtimeIntentRuntimeThe intent runtime.
namestringThe intent name. Must exist when the tool is created.
toolNamestringThe tool name to use instead of the one derived from
name(see ToToolName(string)): 1 to MaxToolNameLength characters fromA-Z a-z 0-9 _ -.loggerILoggerOptional logger for exceptions the tool answers with
success: false(logged atWarning).
Returns
- AIFunction
Exceptions
- ArgumentNullException
runtimeornameis null.- ArgumentException
nameis empty or white space,toolNameis not a valid tool name, or the tool name derived fromnameis longer than MaxToolNameLength characters.- IntentNotFoundException
The runtime's catalog has no intent with that name.
AsAIFunction(IIntentInvoker, string, string?, ILogger?)
A tool that runs the named intent.
public static AIFunction AsAIFunction(this IIntentInvoker invoker, string name, string? toolName = null, ILogger? logger = null)
Parameters
invokerIIntentInvokerThe intent runner.
namestringThe intent name. Must exist when the tool is created: whatever Describe(string) throws for an unknown name propagates.
toolNamestringThe tool name to use instead of the one derived from
name(see ToToolName(string)): 1 to MaxToolNameLength characters fromA-Z a-z 0-9 _ -.loggerILoggerOptional logger for exceptions the tool answers with
success: false(logged atWarning).
Returns
- AIFunction
Exceptions
- ArgumentNullException
invokerornameis null.- ArgumentException
nameis empty or white space,toolNameis not a valid tool name, or the tool name derived fromnameis longer than MaxToolNameLength characters.