rigging.tool
This module defines handles tool interaction with rigging generation.
SUPPORTED_TOOL_ARGUMENT_TYPES = t.Union[int, float, str, bool]
module-attribute
#
Supported types for tool arguments.
SUPPORTED_TOOL_ARGUMENT_TYPES_LIST = [int, float, str, bool]
module-attribute
#
Supported types for tool arguments as a list.
Tool
#
Base class for implementing tools in the Rigging system.
You should subclass this to define your own tools:
def Hammer(Tool):
name = "Hammer"
description = "A tool for hitting things."
def hit(self, target: Annotated[str, "Target of the hit") -> str:
return f"Hit {target} with a hammer."
chat = await generator.chat(...).using(Hammer()).run()
Note
The name
and description
attributes are required and can be defined
as class attributes or properties. If you define them as properties,
you must also define a getter for them.
Note
All functions on the tool must have type hints for their parameters and
use the Annotated
type hint to provide a description for each parameter.
description: str
instance-attribute
#
Description of the tool
name: str
instance-attribute
#
Name of the tool
execute(call: ToolCall) -> ToolResult
#
Executes a function call on the tool.
Source code in rigging/tool.py
get_description() -> ToolDescription
#
Creates a full description of the tool for use in prompting