-
Notifications
You must be signed in to change notification settings - Fork 2k
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
refactor: create_tool_from_function
+ tool
decorator
#8697
Conversation
Pull Request Test Coverage Report for Build 12695370849Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 12695378991Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 12695708412Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 12707767349Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small comment but more importantly I think we need to clarify and document what parameter inputs types are supported for the function passed to create_tool_from_function
and tool
decorator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍 @tool
decorator is an interesting idea!
Related Issues
Since we are introducing some subclasses of
Tool
(ComponentTool
,OpenAPITool
in the future, ...), theTool.from_function
class method becomes inappropriate. These subclasses would inherit the method, potentially leading to unintended behaviors (e.g.ComponentTool.from_function
makes no sense).To address this, I'm proposing a replacement:
create_tool_from_function
utility function (+ atool
decorator).Proposed Changes:
Tool.from_function
class method with acreate_tool_from_function
utility function.tool
decorator, to simplify programmatic use casesExamples
How did you test it?
CI, new tests
Notes for the reviewer
I also reorganized the code by moving functionalities into separate modules.
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.