feat: add tool decorator#387
feat: add tool decorator#387akihikokuroda wants to merge 9 commits intogenerative-computing:mainfrom
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.
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.
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.
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")
4095165 to
1393dad
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>
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>
Misc PR
Type of PR
Description
Testing