8000 fix: Use inspect.cleandoc on function docstrings in generate_function… · Sofoo1992/adk-python@f7cb666 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7cb666

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Use inspect.cleandoc on function docstrings in generate_function_declaration.
This creates proper indent of the doc. PiperOrigin-RevId: 766285907
1 parent 11b504c commit f7cb666

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/google/adk/tools/function_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def __init__(self, func: Callable[..., Any]):
4646

4747
# Get documentation (prioritize direct __doc__ if available)
4848
if hasattr(func, '__doc__') and func.__doc__:
49-
doc = func.__doc__
49+
doc = inspect.cleandoc(func.__doc__)
5050
elif (
5151
hasattr(func, '__call__')
5252
and hasattr(func.__call__, '__doc__')
5353
and func.__call__.__doc__
5454
):
5555
# For callable objects, try to get docstring from __call__ method
56-
doc = func.__call__.__doc__
56+
doc = inspect.cleandoc(func.__call__.__doc__)
5757

5858
super().__init__(name=name, description=doc)
5959
self.func = func

0 commit comments

Comments
 (0)
0