Skip to content

Commit f68160c

Browse files
committed
chore: use gemini-2.5-flash and imagen-4.0-generate-001
1 parent b888231 commit f68160c

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

firebase-ai/app/src/main/java/com/google/firebase/example/ailogic/java/GoogleAISnippets.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void functionCalling(FunctionDeclaration fetchWeatherTool) {
3838
GenerativeModelFutures.from(
3939
FirebaseAI.getInstance(GenerativeBackend.googleAI())
4040
.generativeModel(
41-
"gemini-1.5-flash",
41+
"gemini-2.5-flash",
4242
null,
4343
null,
4444
// Provide the function declaration to the model.
@@ -64,7 +64,7 @@ public void modelConfiguration_model_parameters_general() {
6464
GenerativeModelFutures model =
6565
GenerativeModelFutures.from(
6666
FirebaseAI.getInstance(GenerativeBackend.googleAI())
67-
.generativeModel("gemini-1.5-flash", config));
67+
.generativeModel("gemini-2.5-flash", config));
6868

6969
// ...
7070
// [END model_parameters_general]
@@ -88,7 +88,7 @@ public void modelConfiguration_model_parameters_imagen() {
8888
// Specify the config as part of creating the `ImagenModel` instance
8989
ImagenModelFutures model =
9090
ImagenModelFutures.from(
91-
FirebaseAI.getInstance(GenerativeBackend.googleAI()).imagenModel("imagen-3", config));
91+
FirebaseAI.getInstance(GenerativeBackend.googleAI()).imagenModel("imagen-4.0-generate-001", config));
9292

9393
// ...
9494
// [END model_parameters_imagen]
@@ -116,7 +116,7 @@ public void modelConfiguration_model_parameters_live() {
116116
LiveModelFutures model =
117117
LiveModelFutures.from(
118118
FirebaseAI.getInstance(GenerativeBackend.googleAI())
119-
.liveModel("gemini-1.5-flash", config));
119+
.liveModel("gemini-2.5-flash", config));
120120

121121
// ...
122122
// [END model_parameters_live]
@@ -129,7 +129,7 @@ public void modelConfiguration_safety_settings_imagen() {
129129
ImagenModelFutures model =
130130
ImagenModelFutures.from(
131131
FirebaseAI.getInstance(GenerativeBackend.googleAI())
132-
.imagenModel(/* modelName */ "imagen-3", /* imageGenerationConfig */ null));
132+
.imagenModel(/* modelName */ "imagen-4.0-generate-001", /* imageGenerationConfig */ null));
133133

134134
// ...
135135
// [END safety_settings_imagen]
@@ -148,7 +148,7 @@ public void modelConfiguration_safety_settings_multiple() {
148148
GenerativeModelFutures.from(
149149
FirebaseAI.getInstance(GenerativeBackend.googleAI())
150150
.generativeModel(
151-
/* modelName */ "gemini-1.5-flash",
151+
/* modelName */ "gemini-2.5-flash",
152152
/* generationConfig is optional */ null,
153153
List.of(harassmentSafety, hateSpeechSafety)));
154154

@@ -166,7 +166,7 @@ public void modelConfiguration_safety_settings_single() {
166166
GenerativeModelFutures.from(
167167
FirebaseAI.getInstance(GenerativeBackend.googleAI())
168168
.generativeModel(
169-
/* modelName */ "gemini-1.5-flash",
169+
/* modelName */ "gemini-2.5-flash",
170170
/* generationConfig is optional */ null,
171171
Collections.singletonList(harassmentSafety)));
172172

@@ -179,7 +179,7 @@ public void systemInstructions_general() {
179179
// Specify the system instructions as part of creating the `GenerativeModel` instance
180180
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
181181
.generativeModel(
182-
/* modelName */ "gemini-1.5-flash",
182+
/* modelName */ "gemini-2.5-flash",
183183
/* generationConfig (optional) */ null,
184184
/* safetySettings (optional) */ null,
185185
/* tools (optional) */ null,

firebase-ai/app/src/main/java/com/google/firebase/example/ailogic/java/VertexAISnippets.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void functionCalling(FunctionDeclaration fetchWeatherTool) {
3939
GenerativeModelFutures.from(
4040
FirebaseAI.getInstance(GenerativeBackend.vertexAI("global"))
4141
.generativeModel(
42-
"gemini-1.5-flash",
42+
"gemini-2.5-flash",
4343
null,
4444
null,
4545
// Provide the function declaration to the model.
@@ -65,7 +65,7 @@ public void modelConfiguration_model_parameters_general() {
6565
GenerativeModelFutures model =
6666
GenerativeModelFutures.from(
6767
FirebaseAI.getInstance(GenerativeBackend.vertexAI())
68-
.generativeModel("gemini-1.5-flash", config));
68+
.generativeModel("gemini-2.5-flash", config));
6969

7070
// ...
7171
// [END model_parameters_general]
@@ -89,7 +89,7 @@ public void modelConfiguration_model_parameters_imagen() {
8989
// Specify the config as part of creating the `ImagenModel` instance
9090
ImagenModelFutures model =
9191
ImagenModelFutures.from(
92-
FirebaseAI.getInstance(GenerativeBackend.vertexAI()).imagenModel("imagen-3", config));
92+
FirebaseAI.getInstance(GenerativeBackend.vertexAI()).imagenModel("imagen-4.0-generate-001", config));
9393

9494
// ...
9595
// [END model_parameters_imagen]
@@ -117,7 +117,7 @@ public void modelConfiguration_model_parameters_live() {
117117
LiveModelFutures model =
118118
LiveModelFutures.from(
119119
FirebaseAI.getInstance(GenerativeBackend.vertexAI())
120-
.liveModel("gemini-1.5-flash", config));
120+
.liveModel("gemini-2.5-flash", config));
121121

122122
// ...
123123
// [END model_parameters_live]
@@ -130,7 +130,7 @@ public void modelConfiguration_safety_settings_imagen() {
130130
ImagenModelFutures model =
131131
ImagenModelFutures.from(
132132
FirebaseAI.getInstance(GenerativeBackend.vertexAI())
133-
.imagenModel(/* modelName */ "imagen-3", /* imageGenerationConfig */ null));
133+
.imagenModel(/* modelName */ "imagen-4.0-generate-001", /* imageGenerationConfig */ null));
134134

135135
// ...
136136
// [END safety_settings_imagen]
@@ -149,7 +149,7 @@ public void modelConfiguration_safety_settings_multiple() {
149149
GenerativeModelFutures.from(
150150
FirebaseAI.getInstance(GenerativeBackend.vertexAI())
151151
.generativeModel(
152-
/* modelName */ "gemini-1.5-flash",
152+
/* modelName */ "gemini-2.5-flash",
153153
/* generationConfig is optional */ null,
154154
List.of(harassmentSafety, hateSpeechSafety)));
155155

@@ -167,7 +167,7 @@ public void modelConfiguration_safety_settings_single() {
167167
GenerativeModelFutures.from(
168168
FirebaseAI.getInstance(GenerativeBackend.vertexAI())
169169
.generativeModel(
170-
/* modelName */ "gemini-1.5-flash",
170+
/* modelName */ "gemini-2.5-flash",
171171
/* generationConfig is optional */ null,
172172
Collections.singletonList(harassmentSafety)));
173173

@@ -180,7 +180,7 @@ public void systemInstructions_general() {
180180
// Specify the system instructions as part of creating the `GenerativeModel` instance
181181
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI())
182182
.generativeModel(
183-
/* modelName */ "gemini-1.5-flash",
183+
/* modelName */ "gemini-2.5-flash",
184184
/* generationConfig (optional) */ null,
185185
/* safetySettings (optional) */ null,
186186
/* tools (optional) */ null,
@@ -198,7 +198,7 @@ public void systemInstructions_live() {
198198
// Specify the system instructions as part of creating the `LiveModel` instance
199199
LiveGenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.vertexAI())
200200
.liveModel(
201-
/* modelName */ "gemini-1.5-flash",
201+
/* modelName */ "gemini-2.5-flash",
202202
/* generationConfig (optional) */ null,
203203
/* tools (optional) */ null,
204204
/* systemInstruction (optional) */ new Content.Builder().addText("You are a cat. Your name is Neko.").build()

firebase-ai/app/src/main/java/com/google/firebase/example/ailogic/kotlin/GoogleAISnippets.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GoogleAISnippets : ViewModel() {
3131
val model =
3232
Firebase.ai(backend = GenerativeBackend.googleAI())
3333
.generativeModel(
34-
modelName = "gemini-1.5-flash",
34+
modelName = "gemini-2.5-flash",
3535
// Provide the function declaration to the model.
3636
tools = listOf(Tool.functionDeclarations(listOf(fetchWeatherTool))),
3737
)
@@ -55,7 +55,7 @@ class GoogleAISnippets : ViewModel() {
5555
// Specify the config as part of creating the `GenerativeModel` instance
5656
val model =
5757
Firebase.ai(backend = GenerativeBackend.googleAI())
58-
.generativeModel(modelName = "gemini-1.5-flash", generationConfig = config)
58+
.generativeModel(modelName = "gemini-2.5-flash", generationConfig = config)
5959

6060
// ...
6161
// [END model_parameters_general]
@@ -79,7 +79,7 @@ class GoogleAISnippets : ViewModel() {
7979
// Specify the config as part of creating the `GenerativeModel` instance
8080
val model =
8181
Firebase.ai(backend = GenerativeBackend.vertexAI())
82-
.imagenModel(modelName = "imagen-3", generationConfig = config)
82+
.imagenModel(modelName = "imagen-4.0-generate-001", generationConfig = config)
8383

8484
// ...
8585
// [END model_parameters_imagen]
@@ -104,7 +104,7 @@ class GoogleAISnippets : ViewModel() {
104104
// Specify the config as part of creating the `LiveModel` instance
105105
val model =
106106
Firebase.ai(backend = GenerativeBackend.googleAI())
107-
.liveModel(modelName = "gemini-1.5-flash", generationConfig = config)
107+
.liveModel(modelName = "gemini-2.5-flash", generationConfig = config)
108108

109109
// ...
110110
// [END model_parameters_live]
@@ -117,7 +117,7 @@ class GoogleAISnippets : ViewModel() {
117117
val model =
118118
Firebase.ai(backend = GenerativeBackend.googleAI())
119119
.imagenModel(
120-
modelName = "imagen-3",
120+
modelName = "imagen-4.0-generate-001",
121121
safetySettings =
122122
ImagenSafetySettings(
123123
safetyFilterLevel = ImagenSafetyFilterLevel.BLOCK_LOW_AND_ABOVE,
@@ -139,7 +139,7 @@ class GoogleAISnippets : ViewModel() {
139139
val model =
140140
Firebase.ai(backend = GenerativeBackend.googleAI())
141141
.generativeModel(
142-
modelName = "gemini-1.5-flash",
142+
modelName = "gemini-2.5-flash",
143143
safetySettings = listOf(harassmentSafety, hateSpeechSafety),
144144
)
145145

@@ -153,7 +153,7 @@ class GoogleAISnippets : ViewModel() {
153153
val model =
154154
Firebase.ai(backend = GenerativeBackend.googleAI())
155155
.generativeModel(
156-
modelName = "gemini-1.5-flash",
156+
modelName = "gemini-2.5-flash",
157157
safetySettings =
158158
listOf(SafetySetting(HarmCategory.HARASSMENT, HarmBlockThreshold.ONLY_HIGH)),
159159
)
@@ -166,7 +166,7 @@ class GoogleAISnippets : ViewModel() {
166166
// [START system_instructions_general]
167167
// Specify the system instructions as part of creating the `GenerativeModel` instance
168168
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
169-
modelName = "gemini-1.5-flash",
169+
modelName = "gemini-2.5-flash",
170170
systemInstruction = content { text("You are a cat. Your name is Neko.") }
171171
)
172172
// [END system_instructions_general]
@@ -177,7 +177,7 @@ class GoogleAISnippets : ViewModel() {
177177
// [START system_instructions_live]
178178
// Specify the system instructions as part of creating the `LiveModel` instance
179179
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).liveModel(
180-
modelName = "gemini-1.5-flash",
180+
modelName = "gemini-2.5-flash",
181181
systemInstruction = content { text("You are a cat. Your name is Neko.") }
182182
)
183183
// [END system_instructions_live]

firebase-ai/app/src/main/java/com/google/firebase/example/ailogic/kotlin/VertexAISnippets.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class VertexAISnippets : ViewModel() {
3232
val model =
3333
Firebase.ai(backend = GenerativeBackend.vertexAI(location = "global"))
3434
.generativeModel(
35-
modelName = "gemini-1.5-flash",
35+
modelName = "gemini-2.5-flash",
3636
// Provide the function declaration to the model.
3737
tools = listOf(Tool.functionDeclarations(listOf(fetchWeatherTool))),
3838
)
@@ -56,7 +56,7 @@ class VertexAISnippets : ViewModel() {
5656
// Specify the config as part of creating the `GenerativeModel` instance
5757
val model =
5858
Firebase.ai(backend = GenerativeBackend.vertexAI())
59-
.generativeModel(modelName = "gemini-1.5-flash", generationConfig = config)
59+
.generativeModel(modelName = "gemini-2.5-flash", generationConfig = config)
6060

6161
// ...
6262
// [END model_parameters_general]
@@ -80,7 +80,7 @@ class VertexAISnippets : ViewModel() {
8080
// Specify the config as part of creating the `GenerativeModel` instance
8181
val model =
8282
Firebase.ai(backend = GenerativeBackend.vertexAI())
83-
.imagenModel(modelName = "imagen-3", generationConfig = config)
83+
.imagenModel(modelName = "imagen-4.0-generate-001", generationConfig = config)
8484

8585
// ...
8686
// [END model_parameters_imagen]
@@ -105,7 +105,7 @@ class VertexAISnippets : ViewModel() {
105105
// Specify the config as part of creating the `LiveModel` instance
106106
val model =
107107
Firebase.ai(backend = GenerativeBackend.vertexAI())
108-
.liveModel(modelName = "gemini-1.5-flash", generationConfig = config)
108+
.liveModel(modelName = "gemini-2.5-flash", generationConfig = config)
109109

110110
// ...
111111
// [END model_parameters_live]
@@ -118,7 +118,7 @@ class VertexAISnippets : ViewModel() {
118118
val model =
119119
Firebase.ai(backend = GenerativeBackend.vertexAI())
120120
.imagenModel(
121-
modelName = "imagen-3",
121+
modelName = "imagen-4.0-generate-001",
122122
safetySettings =
123123
ImagenSafetySettings(
124124
safetyFilterLevel = ImagenSafetyFilterLevel.BLOCK_LOW_AND_ABOVE,
@@ -140,7 +140,7 @@ class VertexAISnippets : ViewModel() {
140140
val model =
141141
Firebase.ai(backend = GenerativeBackend.vertexAI())
142142
.generativeModel(
143-
modelName = "gemini-1.5-flash",
143+
modelName = "gemini-2.5-flash",
144144
safetySettings = listOf(harassmentSafety, hateSpeechSafety),
145145
)
146146

@@ -154,7 +154,7 @@ class VertexAISnippets : ViewModel() {
154154
val model =
155155
Firebase.ai(backend = GenerativeBackend.vertexAI())
156156
.generativeModel(
157-
modelName = "gemini-1.5-flash",
157+
modelName = "gemini-2.5-flash",
158158
safetySettings =
159159
listOf(SafetySetting(HarmCategory.HARASSMENT, HarmBlockThreshold.ONLY_HIGH)),
160160
)
@@ -167,7 +167,7 @@ class VertexAISnippets : ViewModel() {
167167
// [START system_instructions_general]
168168
// Specify the system instructions as part of creating the `GenerativeModel` instance
169169
val model = Firebase.ai(backend = GenerativeBackend.vertexAI()).generativeModel(
170-
modelName = "gemini-1.5-flash",
170+
modelName = "gemini-2.5-flash",
171171
systemInstruction = content { text("You are a cat. Your name is Neko.") }
172172
)
173173
// [END system_instructions_general]
@@ -178,7 +178,7 @@ class VertexAISnippets : ViewModel() {
178178
// [START system_instructions_live]
179179
// Specify the system instructions as part of creating the `LiveModel` instance
180180
val model = Firebase.ai(backend = GenerativeBackend.vertexAI()).liveModel(
181-
modelName = "gemini-1.5-flash",
181+
modelName = "gemini-2.5-flash",
182182
systemInstruction = content { text("You are a cat. Your name is Neko.") }
183183
)
184184
// [END system_instructions_live]

0 commit comments

Comments
 (0)