Repository navigation
Conversation
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
Keep documented tool parameters named
raises,returns, oryieldsfrom being mistaken for docstring section headers.On current main, an entry such as
raises: Whether to raise on HTTP errorsinsideArgs:ends the section early. Both that parameter and later parameters lose their descriptions in the generated tool schema, including the actualClient.chat(tools=[func])/ async request payload.The parser now uses the function's exact parameter names, the
Args:indentation, and nonempty inline description text to recognize parameter entries. Real section headers, including previously accepted over-indented bare headers, still end the section. The public callable-conversion API is unchanged; the private parser's new argument is optional and adds no dependency.Verification
raisesdescription empty.git diff --check, and Python 3.8 AST syntax check passed.Tests ran with a clean environment, private-home/external-network denial and process resource limits. No Ollama server, model, or cloud calls were used in tests. The full Hatch multi-Python/OS matrix and Python 3.8 runtime were not run; lockfiles and dependency declarations are unchanged.
Scope and adjacent work
Bare empty-description entries and flat header-named entries retain their existing ambiguous behavior. A deeper lowercase inline header whose exact name is also a real parameter is interpreted as parameter documentation; this is the intentional ambiguity resolution, not a claim of identical behavior for every possible docstring.
This does not implement the separate raw-section/dictionary-key collision in #765/#766 or colon-containing continuation support in #747. Those PRs touch the same parser, so whichever lands later may need a rebase. The default-parameter/schema work in other open PRs is also unchanged.
AI assistance: Claude prepared and refined the proposal. Codex independently reproduced the base failure, found the first proposal's compatibility regression, integrated the refined change, and ran the checks above.