Repository navigation
utils: fix description of tool parameters named args - #766
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
convert_function_to_tool stored the raw Args section of a docstring under the 'args' key of the parsed result, the same key used to look up a parameter named args. An undocumented args parameter received the whole Args section as its description.
This branch has not been deployed
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.
Summary
convert_function_to_toolgives an undocumented parameter namedargsthe whole rawArgs:section of the docstring as its description._parse_docstringstores the rawArgs:section under theargskey of its result dictionary.convert_function_to_toollooks up each parameter's description by name in that same dictionary, so a parameter namedargsreads the section text instead of its own entry. TheReturns:,Yields:andRaises:text collides the same way with a parameter named_.Before this change, the
argsproperty is sent to the model with the description'command: The executable to run\n\n'. After this change, it is'', the same as any other undocumented parameter.Changes
Args:lines in a local list instead of in the result dictionary, and stop storing theReturns:/Yields:/Raises:text, which nothing reads.test_function_with_parameter_named_argstotests/test_utils.py.Testing
pytest tests/test_utils.py::test_function_with_parameter_named_argsfails without the fix and passes with it.pytest ollama tests: 123 passed.hatch fmt --check -fandhatch fmt --check -lpass.Fixes #765
This touches the same loop in
_parse_docstringas #747, which fixes a different bug (continuation lines with colons). Whichever merges second needs a small rebase.