Class QuickTools
- Namespace
- GenerativeAI.Tools
- Assembly
- GenerativeAI.Tools.dll
Represents a collection of quick tools that can be used as Google function tools.
public class QuickTools : GoogleFunctionTool, IFunctionTool
- Inheritance
-
QuickTools
- Implements
- Inherited Members
- Extension Methods
Constructors
QuickTools(QuickTool[])
Initializes a new instance of the QuickTools class with an array of QuickTool objects.
public QuickTools(QuickTool[] tools)
Parameters
QuickTools(Delegate[], JsonSerializerOptions?)
Initializes a new instance of the QuickTools class with an array of delegates.
public QuickTools(Delegate[] delegates, JsonSerializerOptions? options = null)
Parameters
delegatesDelegate[]An array of delegates to be converted into QuickTool objects.
optionsJsonSerializerOptionsJSON Serializer context to appropriately parse the arguments, this can be ignored if JsonTypeResolver is set in global settings or not using NativeAOT
Methods
AsTool()
Converts the current instance to a Tool object.
public override Tool AsTool()
Returns
CallAsync(FunctionCall, CancellationToken)
Executes the specified FunctionCall asynchronously and retrieves the resulting FunctionResponse containing any output from the function execution.
public override Task<FunctionResponse?> CallAsync(FunctionCall functionCall, CancellationToken cancellationToken = default)
Parameters
functionCallFunctionCallThe FunctionCall instance containing the name and arguments required for the function execution.
cancellationTokenCancellationTokenToken to monitor for cancellation requests.
Returns
- Task<FunctionResponse>
A task representing the asynchronous operation, which, upon completion, provides a FunctionResponse with the execution results.
IsContainFunction(string)
Determines whether the specified function exists within the current tool's context.
public override bool IsContainFunction(string name)
Parameters
namestringThe name of the function to check for existence.
Returns
- bool
A boolean value indicating whether the function is present.
ToMeaiFunctions()
Converts the tools to Microsoft Extensions AI tool format.
public List<AITool> ToMeaiFunctions()
Returns
- List<AITool>
A read-only collection of AITool objects for Microsoft Extensions AI integration.