Table of Contents

Class GoogleFunctionTool

Namespace
GenerativeAI.Core
Assembly
GenerativeAI.dll

Interface for defining tools that support function calls within the model's execution context. A tool is a component that can perform external actions or provide additional functionality beyond the intrinsic scope of the model.

public abstract class GoogleFunctionTool : IFunctionTool
Inheritance
GoogleFunctionTool
Implements
Derived
Inherited Members
Extension Methods

Remarks

Use an implementation from Google_GenerativeAI.Tools

Methods

AsTool()

Converts the current instance to a Tool object.

public abstract 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 abstract 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 abstract 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.