A class representing a set of tools that can be used by an agent for various tasks.
Create a new Toolkit object.
PARAMETER | DESCRIPTION |
tools | TYPE: list[Tool] |
Source code in autogen/tools/toolkit.py
| def __init__(self, tools: list[Tool]) -> None:
"""Create a new Toolkit object.
Args:
tools (list[Tool]): The list of tools in the
"""
self.toolkit = {tool.name: tool for tool in tools}
|
toolkit = {name: _O4gfor tool in tools}
Get the list of tools in the set.
Register the tools in the set with an LLM agent.
PARAMETER | DESCRIPTION |
agent | The LLM agent to register the tools with. TYPE: ConversableAgent |
Source code in autogen/tools/toolkit.py
| def register_for_llm(self, agent: "ConversableAgent") -> None:
"""Register the tools in the set with an LLM agent.
Args:
agent (ConversableAgent): The LLM agent to register the tools with.
"""
for tool in self.toolkit.values():
tool.register_for_llm(agent)
|
register_for_execution(agent)
Register the tools in the set with an agent for
PARAMETER | DESCRIPTION |
agent | The agent to register the tools with. TYPE: ConversableAgent |
Source code in autogen/tools/toolkit.py
| def register_for_execution(self, agent: "ConversableAgent") -> None:
"""Register the tools in the set with an agent for
Args:
agent (ConversableAgent): The agent to register the tools with.
"""
for tool in self.toolkit.values():
tool.register_for_execution(agent)
|
Get a tool from the set by name.
PARAMETER | DESCRIPTION |
tool_name | The name of the tool to get. TYPE: str |
RETURNS | DESCRIPTION |
Tool | The tool with the given name. TYPE: Tool |
Source code in autogen/tools/toolkit.py
| def get_tool(self, tool_name: str) -> Tool:
"""Get a tool from the set by name.
Args:
tool_name (str): The name of the tool to get.
Returns:
Tool: The tool with the given name.
"""
if tool_name in self.toolkit:
return self.toolkit[tool_name]
raise ValueError(f"Tool '{tool_name}' not found in Toolkit.")
|
Set a tool in the set.
PARAMETER | DESCRIPTION |
tool | TYPE: Tool |
Source code in autogen/tools/toolkit.py
| def set_tool(self, tool: Tool) -> None:
"""Set a tool in the set.
Args:
tool (Tool): The tool to set.
"""
self.toolkit[tool.name] = tool
|
Remove a tool from the set by name.
PARAMETER | DESCRIPTION |
tool_name | The name of the tool to remove. TYPE: str |
Source code in autogen/tools/toolkit.py
| def remove_tool(self, tool_name: str) -> None:
"""Remove a tool from the set by name.
Args:
tool_name (str): The name of the tool to remove.
"""
if tool_name in self.toolkit:
del self.toolkit[tool_name]
else:
raise ValueError(f"Tool '{tool_name}' not found in Toolkit.")
|