FunctionTool Class

Initialize FunctionTool with a set of functions.

Constructor

FunctionTool(functions: Set[Callable[[...], Any]])

Parameters

Name Description
functions
Required

A set of function objects.

Methods

add_functions

Add more functions into this FunctionTool existing function set. If a function with the same name already exists, it is overwritten.

execute

add_functions

Add more functions into this FunctionTool existing function set. If a function with the same name already exists, it is overwritten.

add_functions(extra_functions: Set[Callable[[...], Any]]) -> None

Parameters

Name Description
extra_functions
Required
Set[Callable[..., Any]]

A set of additional functions to be added to the existing function set. Functions are defined as callables and may have any number of arguments and return types.

execute

execute(tool_call: RequiredFunctionToolCall) -> Any

Parameters

Name Description
tool_call
Required

Attributes

definitions

Get the function definitions.

Returns

Type Description

A list of function definitions.

resources

Get the tool resources for the agent.

Returns

Type Description

An empty ToolResources as FunctionTool doesn't have specific resources.