-
Notifications
You must be signed in to change notification settings - Fork 77
feat: add tool decorator #387
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
base: main
Are you sure you want to change the base?
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
mellea/backends/tools.py
Outdated
| # Extract MelleaTool from decorated functions | ||
| if hasattr(tool_instance, "_mellea_tool"): | ||
| tool_instance = tool_instance._mellea_tool |
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.
Shouldn't we be able to pass in the decorated function directly since it's typed as a MelleaTool and has all the same properties?
97edda8 to
cb4bad7
Compare
|
@jakelorocco Thanks for review. I think all comments are addressed. |
cb4bad7 to
5ef0aa8
Compare
6f88ce1 to
5ebc020
Compare
jakelorocco
left a comment
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.
Sorry, I think I missed this in the last review or the overloading changed it. I think after this change we should be good. Thank you!
mellea/backends/tools.py
Outdated
| @overload | ||
| def tool(func: Callable) -> MelleaTool: ... |
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.
Can we add , *, name: str | None = None to this function definition so that you can still change the tool name when you call it on a function directly:
def new_tool(): ...
differently_named_tool = tool(new_tool, name="different_name")
1393dad to
d9f5250
Compare
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
f81c899 to
35fb99a
Compare
Misc PR
Type of PR
Description
Testing