-
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 |
Follow on to #15262 now that urlContext tool support has been added
Summary of Changes
This pull request refines the
isEmpty
logic within theCandidate
struct of the Firebase AI SDK. It specifically updates theisEmpty
computed property to account forurlContextMetadata
, preventingCandidate
objects 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
isEmpty
computed property in theCandidate
struct has been updated to includeurlContextMetadata
in its evaluation, ensuring that candidates with this metadata are no longer considered empty.Candidate.isEmpty
property, specifically covering scenarios whereurlContextMetadata
is present or absent.GenerateContentResponseTests.swift
now uses@testable import FirebaseAI
to allow access to internal types for comprehensive testing.Changelog
isEmpty
computed property in theCandidate
struct to includeurlContextMetadata
in its check.@testable import FirebaseAI
to enable testing of internal types.testCandidateIsEmpty_allEmpty_isTrue
andtestCandidateIsEmpty_withURLContextMetadata_isFalse
) to thoroughly validate the updatedCandidate.isEmpty
logic.Activity
try XCTUnwrap
for robust URL handling in tests.