ChatBot.tools

Configure tools for this chatbot with unified API for custom and built-in tools.

USAGE

ChatBot.tools(tools)

This method provides a single, consistent way to add any combination of: - Built-in Tool Box tools (by string name) - Custom tools (by passing TalkBoxTool objects) - Tools from Python files (by file/directory path) - All Tool Box tools (with “all” shortcut)

Parameters

tools : Union[list[str], list[TalkBoxTool], str]

Tools to add to this chatbot. Can be: - List of string names for built-in Tool Box tools: [“calculate”, “web_search”] - List of TalkBoxTool objects for custom tools: [my_custom_tool, another_tool] - Mixed list: [“calculate”, my_custom_tool, “web_search”, “my_tools.py”] - String “all” to load all built-in Tool Box tools - Python file path: “my_tools.py” to load all tools from file - Directory path: “./tools/” to load all tools from directory

Returns

ChatBot

The chatbot instance with tools configured for method chaining

Examples


>>> # Add specific built-in tools
>>> bot = ChatBot().tools(["calculate", "text_stats", "validate_email"])
>>> # Add custom tools
>>> bot = ChatBot().tools([my_custom_tool, another_custom_tool])
>>> # Mix built-in and custom tools
>>> bot = ChatBot().tools(["calculate", my_custom_tool, "web_search"])
>>> # Load all built-in tools
>>> bot = ChatBot().tools("all")
>>> # Load tools from Python file
>>> bot = ChatBot().tools("my_business_tools.py")
>>> # Load tools from directory
>>> bot = ChatBot().tools("./company_tools/")
>>> # Mix file loading with other tools
>>> bot = ChatBot().tools(["calculate", "my_tools.py", my_custom_tool])
>>> # Chaining - add more tools later
>>> bot = ChatBot().tools(["calculate"]).tools([my_custom_tool])