Repository navigation
fix(afc): accept whole numbers for Optional[float] tool parameters - #3463
Closed
Sun-Wukhan wants to merge 1 commit into
Closed
Sun-Wukhan wants to merge 1 commit into
Sun-Wukhan wants to merge 1 commit into
Conversation
|
Hi @Sun-Wukhan, Thank you for your contribution and for putting together a clean fix for #3453! Closing this PR as a duplicate of #3461, which was opened earlier for the same issue (#3453) and also covers the non-Union bool guard and end-to-end invoke_function_from_dict_args tests. We really appreciate your continued contributions to the repo—we'll track the fix in #3461. Thanks! |
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 #3453
Automatic function calling rejected whole numbers for
Optional[float]parameters. Whole floats are converted to int before argument conversion, and the Union branch ofconvert_if_exist_pydantic_modelmatched members only with isinstance, so an int value never matched a float member and the call failed with "value 21 cannot be converted to parameter annotation typing.Optional[float]". The non-Union path already has the int to float exception; this adds the same exception to the Union branch, excluding bool.Tests: a new case in
test_convert_if_exist_pydantic_model.pycoveringOptional[float]with an int,float | Nonewith an int,Union[int, float], None, and a fractional value. The file passes with the fix (15 tests) and the new test fails on the unfixed code with the error reported in the issue.