Skip to content

feat: add tool decorator#387

Open
akihikokuroda wants to merge 9 commits intogenerative-computing:mainfrom
akihikokuroda:issue382
Open

feat: add tool decorator#387
akihikokuroda wants to merge 9 commits intogenerative-computing:mainfrom
akihikokuroda:issue382

Conversation

@akihikokuroda
Copy link
Member

@akihikokuroda akihikokuroda commented Jan 30, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

@mergify
Copy link

mergify bot commented Jan 30, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@github-actions
Copy link
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

Comment on lines 210 to 212
# Extract MelleaTool from decorated functions
if hasattr(tool_instance, "_mellea_tool"):
tool_instance = tool_instance._mellea_tool
Copy link
Contributor

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?

@akihikokuroda
Copy link
Member Author

@jakelorocco Thanks for review. I think all comments are addressed.

Copy link
Contributor

@jakelorocco jakelorocco left a 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!

Comment on lines 94 to 95
@overload
def tool(func: Callable) -> MelleaTool: ...
Copy link
Contributor

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")

@akihikokuroda akihikokuroda force-pushed the issue382 branch 3 times, most recently from 4095165 to 1393dad Compare February 5, 2026 23:09
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add decorators for mellea tools

2 participants