Skip to content

fix(py/tools): make sure description is the first arg of tool decorator #2625

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py/packages/genkit/src/genkit/ai/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def sync_wrapper(*args, **kwargs):

return wrapper

def tool(self, name: str | None = None, description: str | None = None) -> Callable[[Callable], Callable]:
def tool(self, description: str | None = None, name: str | None = None) -> Callable[[Callable], Callable]:
Copy link
Contributor

@yesudeep yesudeep Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure you want that? the description arg is very unlikely to be used since pythonistas would prefer docstrings but the name arg will very likely be used so positionally it makes sense to use name before description... the arg would likely be used only for overrides and explicitly writing description='foo' emphasizes that... it's also consistent with other method signatures. wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, maybe it's fine as is... I was just following the docs that we published and things were broken... but you updated docs sources, so just need to republish.

"""Decorator to register a function as a tool.

Args:
Expand Down
Loading