fix(tools): stop partial tools colliding and send the __call__ docstring - #7191
Open
Om-singhaI wants to merge 1 commit into
Open
Om-singhaI wants to merge 1 commit into
Om-singhaI wants to merge 1 commit into
Conversation
FunctionTool declared every functools.partial as `partial` with the docstring of functools.partial itself, so two partial tools were registered under the same name and only the last one could be called. The name now comes from the wrapped callable, and so does the docstring unless the partial carries its own. A callable object documented only on `__call__` reported that docstring as `tool.description` but sent no description in its declaration, because the JSON schema builder read `func.__doc__` directly. The lookup CallableSpec already did now lives in `get_callable_doc`, and the declaration uses it too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7190
Link to Issue or Description of Change
Solution:
get_callable_nameand a newget_callable_docunwrap partials. The JSON schema declaration now usesget_callable_doc, likeCallableSpec, so it also sends inherited method docstrings.Testing Plan
Unit Tests:
5 new tests fail on main. I didn't run the full suite. 12 related
test_*.pyfiles gave393 passed:callable_utils,llm_request,function_node,node_tool,function_tool*(4 files),build_function_declaration,from_function_with_options,long_running_toolandauthenticated_function_tool.Manual E2E Tests: no live model run. The issue repro now prints the right names and docstrings.
Checklist
Additional context
Follow ups: args bound by keyword still land in the schema, and the legacy builder still reads
func.__doc__.