Skip to content

Make FuncTool and @function_tool decorated function callable #708

Open
@chiehmin-wei

Description

@chiehmin-wei

Describe the feature

What is the feature you're requesting? How would it work? Please provide examples and details if possible.

I'm using the @function_tool decorator extensively. In some instances, I want to call the underlying function directly, but I'd get a TypeError: FuncTool is not invokable error if I do.

For example, if I do

@function_tool
def add(a, b):
  return a + b

print(add(1, 2)
assert add(1, 2) == 3

This would throw a TypeError.

This would be useful for unit testing the function directly too.

A workaround I have right now is to just have a util function, and then have a decorated version that calls that util function. However, this makes things ugly since I'd have to repeat the docstrings, etc. since that's where LLMs are getting the function descriptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions