Add Google Search and Thinking support to firebase-ai#2
Add Google Search and Thinking support to firebase-ai#2Enterup649 wants to merge 1 commit intomainfrom
Conversation
Introduces ThinkingConfig and updates Tool and GenerationConfig to support Gemini 2.0 features. Includes Google Search grounding and Thinking configuration. Properly handles internal serialization with SerialName annotations. Co-authored-by: Enterup649 <201156730+Enterup649@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Firebase AI Mock Responses Check
|
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for Google Search and Thinking configuration to the firebase-ai module. The changes are generally well-implemented, introducing new configuration classes and updating existing ones to support the new features. I've identified a potential breaking change in the serialization logic for Tool and suggested a fix to maintain API compatibility. I also recommended a small improvement to the new ThinkingConfig class to align it better with Kotlin best practices.
| ) { | ||
| internal fun toInternal() = | ||
| Internal( | ||
| functionDeclarations = functionDeclarations?.map { it.toInternal() }, |
There was a problem hiding this comment.
This change alters the serialization of functionDeclarations. Previously, a null list was sent as an empty array ([]). Now, it will be null and likely omitted from the JSON payload. This is a potential breaking change for the backend API. To maintain API compatibility, the previous behavior of sending an empty list should be preserved.
| functionDeclarations = functionDeclarations?.map { it.toInternal() }, | |
| functionDeclarations = functionDeclarations?.map { it.toInternal() } ?: emptyList(), |
| public class ThinkingConfig( | ||
| public val includeThoughts: Boolean = false, | ||
| ) { |
There was a problem hiding this comment.
For better usability and adherence to Kotlin idioms for value-holding classes, consider converting ThinkingConfig into a data class. This will automatically provide equals(), hashCode(), toString(), and copy() methods, which is useful for a configuration object.
| public class ThinkingConfig( | |
| public val includeThoughts: Boolean = false, | |
| ) { | |
| public data class ThinkingConfig( | |
| public val includeThoughts: Boolean = false, | |
| ) { |
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 1a086c0. |
This submission adds support for Google Search retrieval and Thinking configuration to the
firebase-aimodule.Key changes:
ThinkingConfig.ktto define the thinking configuration.Tool.ktto includegoogleSearchRetrievalsupport.GenerationConfig.ktto includethinkingConfigin the generation parameters.@SerialNamefor correct API mapping.PR created automatically by Jules for task 9528094249912010653 started by @Enterup649