-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
genai: Fix handling of optional arrays in tool input #661
base: main
Are you sure you want to change the base?
genai: Fix handling of optional arrays in tool input #661
Conversation
Hey @Shahar-Y, I saw your PR before and it's similar but not the same, tried your code and didn't work in my case. Here, arrays are handled and they have |
@piotr-rudnik could you rebase and fix linter errors, please? |
2a723c2
to
b91d11d
Compare
@lkuligin Hey, branch got rebased, looks like all checks are passing. |
b91d11d
to
07a2256
Compare
There still were failing ruff checks, amended files to previous commit and force pushed new version |
07a2256
to
2e06e4b
Compare
@piotr-rudnik linter is still failing |
Hey, im getting the same error for ChatGroq too, i think this issue can be found in all basechatmodels |
PR Description
This code fixes handling of optional arrays in pydantic models provided as tool inputs like this:
Optional parameters are handled by setting
nullable
field in gemini API. Current code works for every type, except for arrays, becauseitems
field, that contains information about type of values inside the array, is present inanyOf
field as one of the possibilities, where it's ignored.Also added log where user is warned that only only type can be used inside array. Before, last defined type was used.
This is an edge case where user could be trying to use an array with multiple types which is not supported by genai, but can be useful for finding bugs
Type
🐛 Bug Fix
✅ Test
Testing(optional)