Skip to content
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 function_utils to parse object/array json schemas properly #715

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RazCrimson
Copy link

The existing code tries to handle arrays and objects in anyOf fields of JSON Schema's for tools by picking the last possible non nullable choice in anyOf. But the context of the field is not updated to reflect the selected choice leading to a borked conversion to protobuf that fails with 400 errors.

This fix is just to update the context for arrays and objects.

Please correct me if it is intentional, but there is already a testcase which is supposed to cover this, but it is buggy as it sets an items field within an items definition for an array, which should not be possible according to the JSON Schema spec. The faulty setting made this bug slip through the tests

@lkuligin
Copy link
Collaborator

thanks for the change, please, fix linting errors.

I'm not sure it's a bug, we probably have it intentianally since old models didn't support AnyOf fields. But anyways, it shouldn't prevent us from fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants