-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[AI] Update empty parts check for urlContextMetadata #15355
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 by creating a comment 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. |
Generated by 🚫 Danger |
|
/gemini review |
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 correctly updates the Candidate.isEmpty check to also consider urlContextMetadata. The logic is sound, and the change is accompanied by new unit tests that validate the updated behavior. The code quality is good. I have one minor suggestion to improve the robustness of the new test case.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini summary |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Follow on to #15262 now that urlContext tool support has been added
Summary of Changes
This pull request refines the
isEmptylogic within theCandidatestruct of the Firebase AI SDK. It specifically updates theisEmptycomputed property to account forurlContextMetadata, preventingCandidateobjects from being incorrectly identified as empty when they contain relevant URL context information. This change ensures more accurate content generation responses and is accompanied by new unit tests to validate the updated behavior.Highlights
isEmptycomputed property in theCandidatestruct has been updated to includeurlContextMetadatain its evaluation, ensuring that candidates with this metadata are no longer considered empty.Candidate.isEmptyproperty, specifically covering scenarios whereurlContextMetadatais present or absent.GenerateContentResponseTests.swiftnow uses@testable import FirebaseAIto allow access to internal types for comprehensive testing.Changelog
isEmptycomputed property in theCandidatestruct to includeurlContextMetadatain its check.@testable import FirebaseAIto enable testing of internal types.testCandidateIsEmpty_allEmpty_isTrueandtestCandidateIsEmpty_withURLContextMetadata_isFalse) to thoroughly validate the updatedCandidate.isEmptylogic.Activity
try XCTUnwrapfor robust URL handling in tests.