diff --git a/samples/gemini-chatbot/README.md b/samples/gemini-chatbot/README.md index 0e04655a..caf00047 100644 --- a/samples/gemini-chatbot/README.md +++ b/samples/gemini-chatbot/README.md @@ -18,7 +18,7 @@ Here is the key snippet of code that calls the generative model: ```kotlin private val generativeModel by lazy { - Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel("gemini-3-pro-image-preview") + Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel("gemini-2.5-flash") } private val chat = generativeModel.startChat() diff --git a/samples/gemini-image-chat/README.md b/samples/gemini-image-chat/README.md index b268e289..0c919dd2 100644 --- a/samples/gemini-image-chat/README.md +++ b/samples/gemini-image-chat/README.md @@ -4,7 +4,7 @@ This sample is part of the [AI Sample Catalog](../../). To build and run this sa ## Description -This sample demonstrates a chat bot using `Gemini 2.5 Flash Image` (a.k.a [Nano Banana](https://developers.googleblog.com/en/introducing-gemini-2-5-flash-image/)) that can understand both text and images and generate images and text in return. Users can send a message that includes an image, and the generative model will respond based on the multimodal input. This showcases how to build powerful, interactive image generation chat experiences with the Gemini API. +This sample demonstrates a chat bot using `Gemini 3 Pro Image` (a.k.a [Nano Banana Pro](https://deepmind.google/models/gemini-image/pro/)) that can understand both text and images and generate images and text in return. Users can send a message that includes an image, and the generative model will respond based on the multimodal input. This showcases how to build powerful, interactive image generation chat experiences with the Gemini API.
@@ -12,7 +12,30 @@ This sample demonstrates a chat bot using `Gemini 2.5 Flash Image` (a.k.a [Nano
## How it works
-The application uses the Firebase AI SDK (see [How to run](../../#how-to-run)) for Android to interact with the `Gemini 2.5 Flash Image` model. The core logic is in the `GeminiImageChatViewModel.kt` file. When a user sends a message with an image, a `content` block is created that includes both the text and the `Bitmap` of the image. This multimodal content is then sent to the model.
+The application uses the Firebase AI SDK (see [How to run](../../#how-to-run)) for Android to interact with the `Gemini 3 Pro Image` model. The core logic is in the `GeminiImageChatViewModel.kt` file. When a user sends a message with an image, a `content` block is created that includes both the text and the `Bitmap` of the image. This multimodal content is then sent to the model.
+
+Here is how the model is instantiated:
+```kotlin
+ Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
+ "gemini-3-pro-image-preview",
+ generationConfig = generationConfig {
+ temperature = 0.9f
+ topK = 32
+ topP = 1f
+ maxOutputTokens = 4096
+ responseModalities = listOf(ResponseModality.TEXT, ResponseModality.IMAGE)
+ },
+ safetySettings = listOf(
+ SafetySetting(HarmCategory.HARASSMENT, HarmBlockThreshold.MEDIUM_AND_ABOVE),
+ SafetySetting(HarmCategory.HATE_SPEECH, HarmBlockThreshold.MEDIUM_AND_ABOVE),
+ SafetySetting(HarmCategory.SEXUALLY_EXPLICIT, HarmBlockThreshold.MEDIUM_AND_ABOVE),
+ SafetySetting(HarmCategory.DANGEROUS_CONTENT, HarmBlockThreshold.MEDIUM_AND_ABOVE),
+ ),
+ systemInstruction = content {
+ text("""You are a friendly assistant. Keep your responses short.""")
+ },
+ )
+```
Here is the key snippet of code that calls the generative model: