-
Notifications
You must be signed in to change notification settings - Fork 7.4k
refactor(ai-logic): simplify samples categories #2791
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
Open
thatfiredev
wants to merge
23
commits into
master
Choose a base branch
from
rpf/refactor-categories
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9c68ddd
feat: add Translation sample
thatfiredev 1a49b77
Update Audio summarization to use Gemini 3.1 Flash-Lite
thatfiredev 47d5b7f
remove grounding from the document category
thatfiredev 22198fe
val instead of var
thatfiredev d93fc7f
refactor: new categories :)
thatfiredev 1e5d347
feat: add more Nano Banana samples
thatfiredev 4366caf
reorder a few samples
thatfiredev 0e387cb
Merge branch 'master' of github.com:firebase/quickstart-android into …
thatfiredev 0c74ec6
Merge branch 'master' of github.com:firebase/quickstart-android into …
thatfiredev 9054b2a
reorder some samples
thatfiredev 5752f53
adjust main menu UI padding
thatfiredev e9a0c85
update README.md
thatfiredev db9fb03
Function --> function
thatfiredev b6cf3e8
more padding adjustments
thatfiredev 254f9b7
remove text labels
thatfiredev bb925d6
more padding adjustments
thatfiredev 48fab5c
Merge branch 'master' of github.com:firebase/quickstart-android into …
thatfiredev 052f508
Merge branch 'master' of github.com:firebase/quickstart-android into …
thatfiredev 857c64a
refactor(ai): use gemini-3.5-flash to generate SVGs
thatfiredev 4678967
refactor(ai): remove gemini-2.5-flash example
thatfiredev 665d57a
update screenshot
thatfiredev 5b9ca07
fix SVG generation
thatfiredev 7992c56
address gemini feedback
thatfiredev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...pp/src/main/java/com/google/firebase/quickstart/ai/feature/text/NanoBananaProViewModel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.google.firebase.quickstart.ai.feature.text | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| import com.google.firebase.Firebase | ||
| import com.google.firebase.ai.Chat | ||
| import com.google.firebase.ai.ai | ||
| import com.google.firebase.ai.type.Content | ||
| import com.google.firebase.ai.type.GenerativeBackend | ||
| import com.google.firebase.ai.type.ResponseModality | ||
| import com.google.firebase.ai.type.generationConfig | ||
| import com.google.firebase.quickstart.ai.ui.UiChatMessage | ||
|
|
||
| @Serializable | ||
| object NanoBananaProRoute | ||
|
|
||
| class NanoBananaProViewModel : ChatViewModel() { | ||
|
|
||
| override val initialPrompt: String = """ | ||
| Present a clear, 45° top-down isometric miniature 3D cartoon | ||
| scene of London, featuring its most iconic landmarks and | ||
| architectural elements. Use soft, refined textures with | ||
| realistic PBR materials and gentle, lifelike lighting and shadows. | ||
| Integrate the current weather conditions directly into the city | ||
| environment to create an immersive atmospheric mood. Use a clean, | ||
| minimalistic composition with a soft, solid-colored background. | ||
| At the top-center, place the title "London" in large bold text, | ||
| a prominent weather icon beneath it, then the date (small text) | ||
| and temperature (medium text). All text must be centered with | ||
| consistent spacing, and may subtly overlap the tops of the buildings. | ||
| """.trimIndent() | ||
|
|
||
| private val chat: Chat | ||
|
|
||
| init { | ||
| val generativeModel = Firebase.ai( | ||
| backend = GenerativeBackend.googleAI() | ||
| ).generativeModel( | ||
| modelName = "gemini-3-pro-image-preview", | ||
| generationConfig = generationConfig { | ||
| responseModalities = listOf(ResponseModality.TEXT, ResponseModality.IMAGE) | ||
| } | ||
| ) | ||
| chat = generativeModel.startChat() | ||
| } | ||
|
|
||
| override suspend fun performSendMessage(prompt: Content, currentMessages: List<UiChatMessage>) { | ||
| val response = chat.sendMessage(prompt) | ||
| validateAndDisplayResponse(response, currentMessages) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.