Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add tool decorator for turning a function into a FunctionTool #1592

Open
1 of 2 tasks
lightaime opened this issue Feb 12, 2025 · 1 comment
Open
1 of 2 tasks
Labels
enhancement New feature or request

Comments

@lightaime
Copy link
Member

Required prerequisites

Motivation

Add tool decorator for turning a function into a FunctionTool

Solution

No response

Alternatives

No response

Additional context

No response

@lightaime lightaime added the enhancement New feature or request label Feb 12, 2025
@Wendong-Fan
Copy link
Member

hey @lightaime , in ChatAgent now we support pass Callable to the tool list and we will covert it into FunctionTool internally, do we still need to add this decorator?

    def _initialize_tools(
        self, tools: List[Union[FunctionTool, Callable]]
    ) -> List[FunctionTool]:
        r"""Helper method to initialize tools as FunctionTool instances."""
        from camel.toolkits import FunctionTool

        func_tools = []
        for tool in tools:
            if not isinstance(tool, FunctionTool):
                tool = FunctionTool(tool)
            func_tools.append(tool)
        return func_tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants