Skip to content

fix(tools): name partial-backed tools after wrapped func, use __call__ doc for instances - #7198

Closed
aslamalkarywk7 wants to merge 4 commits into
google:mainfrom
aslamalkarywk7:fix-functiontool-partial-naming
Closed

aslamalkarywk7 wants to merge 4 commits into
google:mainfrom
aslamalkarywk7:fix-functiontool-partial-naming

Conversation

@aslamalkarywk7

Copy link
Copy Markdown

Fixes #7190

Every functools.partial was advertised (and registered) as 'partial' because partials carry no name, so only the last one survived; and callable instances documented only on call lost their description in the declaration.

This unwraps (nested) partials to the underlying function name, resolves the declaration description through the shared unwrap_callable helper for partials, and falls back to call.doc only for callable instances (partials, types and routines excluded, so an undocumented plain function still yields None and the slot-wrapper Call self as a function. docstring can never leak in).

Verification: new TestPartialAndCallableNaming (6 tests) plus full test_function_tool_declarations.py green (51/51); the existing suite caught one intermediate regression (fallback firing on plain functions) which was fixed before committing.

…_ doc for instances (WIP, awaiting issue approval)

Do not open PR before maintainer approval on #7190.
@aslamalkarywk7

Copy link
Copy Markdown
Author

Hi maintainers — the branch is now updated with main (merge is clean, fix intact in _function_tool_declarations.py + 6 new tests in test_function_tool_declarations.py).

Could you please review when you get a chance? Fixes #7190: partial-backed tools collapsing to 'partial' and callable instances losing call docs.

Note: branch CI workflow files are pinned to their previous version because my current token lacks the workflow scope to push those two files — happy to sync them via the Update branch button if you prefer. Thanks!

@aslamalkarywk7 aslamalkarywk7 closed this by deleting the head repository Sep 28, 2026
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.

FunctionTool declares every functools.partial as partial and drops the __call__ docstring

2 participants