You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
convert_function_to_tool: undocumented parameter named args gets the whole Args section as its description #765
When a function passed as a tool has a parameter named args that the docstring does not document, the generated tool schema uses the raw text of the docstring's Args: section as that parameter's description.
_parse_docstring stores the raw section under the args key of the same dictionary that convert_function_to_tool uses to look up descriptions by parameter name.
Steps to reproduce
fromollama._utilsimportconvert_function_to_tooldefrun_command(command: str, args: list) ->str:
""" Run a shell command. Args: command: The executable to run """tool=convert_function_to_tool(run_command)
print(repr(tool.function.parameters.properties['args'].description))
Expected behavior
'', as for any other undocumented parameter.
Actual behavior
'command: The executable to run\n\n'. The model sees another parameter's documentation as the description of args.
The same collision gives a parameter named _ the text of the Returns: section.
Environment
ollama-python main (35d9667), Python 3.9, pydantic 2.13.
Activity