Skip to content
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

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

Closed
wants to merge 2 commits into from

Conversation

pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Apr 3, 2025

this should still be valid

    @ai.tool('Use it to get the weather')
    def get_weather(input:WeatherToolInput) -> str:
        return f'Weather in {input.location} is 23°'

Checklist (if applicable):

@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants