Open WHALEEYE opened 1 month ago
Part of the refactoring:
AllToolKit
class to have all tools in once place: https://github.com/camel-ai/camel/issues/947 @ZackYule ToolKit
: https://github.com/camel-ai/camel/pull/603, https://github.com/camel-ai/camel/issues/948 @Wendong-Fan OpenAIFunction
: https://github.com/camel-ai/camel/issues/949 @Zhangzeyu97 @Wendong-Fan I have a couple of detail questions regarding the Toolkits refactoring that might be worth consideringļ¼
Q1: Would it make sense to replace BaseToolkit classes that donāt require any configuration with functional tools instead? This way, we could avoid exposing classes without actual tool methods in the ToolManager, streamlining the structure.
Q2: I think it might be better if the tool list returned by ToolManager is List[str] when intended for user interaction, and list[OpenAIFunction] when used by the agent. Since list_toolkits is primarily for users, it seems reasonable for it to return List[str]. As for search_toolkits, should it be designed for user use or for the agent?
Below are the current ways we use tools, and I believe it would be helpful to consider unifying these approaches while also supporting developers in customizing their own tools.
Thereās also one more point to consider: the OpenAPIToolkit
doesnāt currently support the management approach used by toolkits_manager
.
Perhaps it would be a good idea to revisit and discuss these details again. @lightaime @yiyiyi0817 @zhiyu-01
toolkit_manager
No configuration needed
tools_list = [
*SEARCH_FUNCS,
*MathToolkit().get_tools(),
]
Configuration needed
toolkit = GithubToolkit(repo_name=repo_name)
tools_list = [
*SEARCH_FUNCS,
*WEATHER_FUNCS,
*toolkit.get_tools(),
]
toolkits_manager
No configuration needed
tools_list = manager.get_toolkits(names=manager.search_toolkits('weather'))
Configuration needed
camel_github_toolkit = GithubToolkit(repo_name='camel-ai/camel')
tools_list = manager.register_tool([camel_github_toolkit, ])
Custom tools
def div(a: int, b: int) -> float:
r"""Divides two numbers.
Args:
a (int): The dividend in the division.
b (int): The divisor in the division.
Returns:
float: The quotient of the division.
Raises:
ValueError: If the divisor is zero.
"""
if b == 0:
raise ValueError("Division by zero is not allowed.")
return a / b
tools_list = manager.register_tool([div, ])
Required prerequisites
Motivation
The current style of toolkits is quite chaotic, we need to make it more standardized to ensure the code quality and also for the ease of adding future tools.
Solution
No response
Alternatives
No response
Additional context
No response