Skip to content

fix(py): improve tool call usage in docs - #320

Merged
huangjeff5 merged 4 commits into
mainfrom
jh-fix-tool-usage
Aug 10, 2026
Merged

fix(py): improve tool call usage in docs#320
huangjeff5 merged 4 commits into
mainfrom
jh-fix-tool-usage

Conversation

@huangjeff5

Copy link
Copy Markdown
Collaborator

Show default tool usage (defaulting to function name / docstring) rather than showing off name/description overrides, which is a secondary use case.

@huangjeff5
huangjeff5 requested a review from chrisraygill August 8, 2026 14:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates several documentation files to simplify the @ai.tool decorator by removing explicit name and description arguments, letting them default to the function name and docstring instead. The review feedback correctly identifies that changing the tool name from camelCase (getWeather) to snake_case (get_weather) in tool-calling.mdx introduces inconsistencies, as subsequent code examples in the same file still reference the old name and will fail at runtime.

Comment thread src/content/docs/docs/tool-calling.mdx
@huangjeff5

Copy link
Copy Markdown
Collaborator Author

@gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation examples to define tools using the @ai.tool() decorator without explicit name and description arguments, defaulting instead to the function name and docstring. A review comment correctly identifies a missed reference in src/content/docs/docs/tool-calling.mdx where webSearch needs to be updated to web_search to prevent a NameError in the example code.

Comment thread src/content/docs/docs/tool-calling.mdx
@huangjeff5

huangjeff5 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

Added a note in tool-calling.mdx clarifying that name and description decorator parameters can still be used to override the default function name and docstring in ec572a5.

@huangjeff5

Copy link
Copy Markdown
Collaborator Author

@gemini review

@huangjeff5

Copy link
Copy Markdown
Collaborator Author

Updated flows.mdx python examples in 5d1a415 to include docstrings and explained that @ai.flow() defaults name to function name and description to the docstring (with optional decorator parameter overrides).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation across multiple files to demonstrate the simplified @ai.tool() decorator syntax, where the tool name defaults to the function name and the description is retrieved from the function's docstring. References to tool names have been updated from camelCase to snake_case to match this new behavior. There are no review comments, so I have no additional feedback to provide.

@huangjeff5
huangjeff5 merged commit dd52449 into main Aug 10, 2026
8 checks passed
@huangjeff5
huangjeff5 deleted the jh-fix-tool-usage branch August 10, 2026 19:28
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.

2 participants