Skip to main content
Tools allow models to call functions during generation.

@ai.tool() Decorator

Defines a tool.

Parameters

str | None
Tool name (defaults to function name)
str | None
Tool description (defaults to function docstring)

Using Tools

Tool Context

Tool Response

Example: Complete Tool