Table of Contents

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

tools QuickTool[]

An array of QuickTool objects to initialize the tool collection.

QuickTools(Delegate[], JsonSerializerOptions?)

Initializes a new instance of the QuickTools class with an array of delegates.

public QuickTools(Delegate[] delegates, JsonSerializerOptions? options = null)

Parameters

delegates Delegate[]

An array of delegates to be converted into QuickTool objects.

options JsonSerializerOptions

JSON 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

Tool

A Tool representation of the current instance.

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

functionCall FunctionCall

The FunctionCall instance containing the name and arguments required for the function execution.

cancellationToken CancellationToken

Token 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

name string

The 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.