-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Vertex AI] Add anyOf
support to Schema
#14708
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
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback. |
# Conflicts: # FirebaseVertexAI/Sources/Types/Public/Schema.swift # FirebaseVertexAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for the anyOf
schema, enhancing the flexibility of data generation with Vertex AI. The changes include modifications to the DataType
enum, Schema
class, and the addition of a new integration test. Overall, the implementation appears well-structured and addresses the intended functionality.
Summary of Findings
- Documentation Clarity: The documentation for the
anyOf
schema could be enhanced to explicitly state the behavior when multiple sub-schemas are valid against the generated data. Clarifying the selection process or prioritization would improve user understanding. - Error Handling: The
anyOf
function includes a fatalError if the schemas array is empty. While this prevents invalid configurations, consider providing a more graceful error handling mechanism, such as throwing an exception, to allow for more flexible error management in client code. - Test Coverage: The integration test covers the basic functionality of the
anyOf
schema. Expanding the test suite to include edge cases, such as nestedanyOf
schemas or combinations with other schema constraints, would improve the robustness of the implementation.
Merge Readiness
The pull request is well-structured and introduces a valuable feature. However, addressing the documentation clarity and error handling concerns would enhance the overall quality and usability of the code. While the integration test provides a good starting point, expanding the test suite to cover edge cases would further improve the robustness of the implementation. I am unable to approve this pull request, and recommend that another reviewer does so after the suggestions have been addressed. I recommend that the pull request not be merged until the high severity issues are addressed (at a minimum).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still test failures to resolve.
# Conflicts: # FirebaseVertexAI/Tests/TestApp/Tests/Utilities/InstanceConfig.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great set of unit tests. Thanks!
Added support for
Schema.anyOf(...)
, which is aSchema
representing a value that must conform to any (one or more) of the provided sub-schemas. See #14647 for context.