rigging.tool
This module defines handles tool interaction with rigging generation.
ApiTool(fn: t.Callable[..., t.Any], *, _fn_to_call: t.Callable[..., t.Any] | None = None)
#
Source code in rigging/tool/api.py
execute(tool_call: ToolCall) -> Message
async
#
Executes a function call on the tool.
Source code in rigging/tool/api.py
Tool
#
Base class for implementing internally-managed 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/native.py
get_description() -> ToolDescription
#
Creates a full description of the tool for use in prompting