Skip to content

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

Open
aslamalkarywk7 wants to merge 1 commit into
google:mainfrom
aslamalkarywk7:fix-functiontool-partial-naming
Open

aslamalkarywk7 wants to merge 1 commit 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 google#7190.
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