Repository navigation
fix(afc): accept whole numbers for Optional[float] tool parameters - #3463
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! |
Thank you! Trying to get a good win with you guys aha. |
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.