-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[FirebaseAI] sync with quickstart-android #1741
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
[FirebaseAI] sync with quickstart-android #1741
Conversation
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.
Summary of Changes
Hello @YoungHypo, 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 delivers a significant overhaul of the iOS quickstart application's user interface, bringing it into alignment with its Android counterpart. The changes introduce a more structured and modular design, powered by a new Sample
data model that centralizes the configuration and presentation of various generative AI examples. This refactoring enhances the discoverability and organization of the different AI capabilities within the app.
Highlights
- UI Refactoring and Alignment: The primary user interface of the
quickstart-ios
application has been completely refactored to align with thequickstart-android
design. This introduces a modular layout with distinct sections for backend configuration, use case filtering, and sample display. - New Sample Data Model: A new
Sample.swift
file has been introduced withinGenerativeAIUIComponents
to encapsulate predefined examples. EachSample
includes details such as title, description, associated use cases, optional preset conversation history, initial prompts, system instructions, and tools, making it easier to manage and display various AI capabilities. - Sample-Driven Screens: The
ConversationScreen
andImagenScreen
have been updated to be driven by the newSample
data model. Their respective ViewModels (ConversationViewModel
andImagenViewModel
) now accept asampleId
to dynamically configure the generative model with specific tools, system instructions, and initial chat history or prompts based on the selected sample. - New UI Components: Two new SwiftUI views,
FilterChipView
andSampleCardView
, have been added to support the new modular UI.FilterChipView
allows users to filter samples byUseCase
, whileSampleCardView
provides a structured display for each AI sample. - FirebaseAI Integration in UI Components: The
GenerativeAIUIComponents
Swift package now explicitly depends onFirebaseAI
, ensuring that the new UI components can directly leverage Firebase AI functionalities and models.
Using Gemini Code Assist
The 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 /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
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 or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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
The pull request refactors the app's UI and structure to be data-driven by the new Sample
model, aligning the iOS quickstart with the Android version. I've identified a critical issue with navigation logic and some medium-severity issues related to state management and potential data loss in samples.
case .video, .audio, .document: | ||
PhotoReasoningScreen(firebaseService: firebaseService) | ||
case .functionCalling: | ||
FunctionCallingScreen(firebaseService: firebaseService) |
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.
For consistency with other screens and to support samples with pre-defined data, FunctionCallingScreen
should also be initialized with a sampleId
. The "Weather Chat" sample, for instance, has a chatHistory
. Without passing the sampleId
, this history will not be loaded, and the sample won't be presented as intended.
FunctionCallingScreen(firebaseService: firebaseService) | |
FunctionCallingScreen(firebaseService: firebaseService, sampleId: sample.id) |
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.
Need to wait for function calling to change from currency converter to weather query before adding sampleId to it.
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.
Thanks for sending this PR, @YoungHypo!
I left a few comments - most importantly about using system colors to ensure this looks good in light and dark mode.
Thank you for your valuable review, @peterfriese. I’ve made these changes, and the rendering now works for both iOS 26 and iOS 18 in light and dark modes with a consistent style. |
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.
Looking good, just a few nits.
firebaseai/GenerativeAIUIComponents/Sources/GenerativeAIUIComponents/Models/Sample.swift
Outdated
Show resolved
Hide resolved
Updating the target branch, as the current version of the code isn't ready for merging into main yet. |
firebaseai/GenerativeAIUIComponents/Sources/GenerativeAIUIComponents/Models/Sample.swift
Outdated
Show resolved
Hide resolved
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.
See my individual comments. Also, since the PR has some open tasks (see the initial comment), I would recommend either continuing working on the PR, or merging into peterfriese/firebase-ai-quickstart-refresh
.
Thanks for the suggestion @peterfriese! Since this PR has already diverged a lot from the |
3c692b9
into
firebase:peterfriese/firebase-ai-quickstart-refresh
PR description
This PR refactors the UI of quickstart-ios to align with quickstart-android.
The interface now adopts a modular design, divided into three functional areas:
And a new
Sample.swift
encapsulates predefined examples, including Gemini-related parameters, preset conversation history, and system prompts.Use cases
Text
Image
Video
Audio
Document
Function Calling
Demo