Skip to content

Commit bd50917

Browse files
authored
refactor(ai): adjust indentation on snippets
1 parent 1e29800 commit bd50917

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ 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-2.5-flash", generationConfig = config)
58+
.generativeModel(
59+
modelName = "gemini-2.5-flash",
60+
generationConfig = config)
5961

6062
// ...
6163
// [END model_parameters_general]
@@ -79,7 +81,9 @@ class GoogleAISnippets : ViewModel() {
7981
// Specify the config as part of creating the `GenerativeModel` instance
8082
val model =
8183
Firebase.ai(backend = GenerativeBackend.vertexAI())
82-
.imagenModel(modelName = "imagen-4.0-generate-001", generationConfig = config)
84+
.imagenModel(
85+
modelName = "imagen-4.0-generate-001",
86+
generationConfig = config)
8387

8488
// ...
8589
// [END model_parameters_imagen]
@@ -104,7 +108,9 @@ class GoogleAISnippets : ViewModel() {
104108
// Specify the config as part of creating the `LiveModel` instance
105109
val model =
106110
Firebase.ai(backend = GenerativeBackend.googleAI())
107-
.liveModel(modelName = "gemini-2.5-flash", generationConfig = config)
111+
.liveModel(
112+
modelName = "gemini-2.5-flash",
113+
generationConfig = config)
108114

109115
// ...
110116
// [END model_parameters_live]
@@ -165,21 +171,23 @@ class GoogleAISnippets : ViewModel() {
165171
fun systemInstructions_general() {
166172
// [START system_instructions_general]
167173
// Specify the system instructions as part of creating the `GenerativeModel` instance
168-
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
169-
modelName = "gemini-2.5-flash",
170-
systemInstruction = content { text("You are a cat. Your name is Neko.") }
171-
)
174+
val model = Firebase.ai(backend = GenerativeBackend.googleAI())
175+
.generativeModel(
176+
modelName = "gemini-2.5-flash",
177+
systemInstruction = content { text("You are a cat. Your name is Neko.") }
178+
)
172179
// [END system_instructions_general]
173180
}
174181

175182
@OptIn(PublicPreviewAPI::class)
176183
fun systemInstructions_live() {
177184
// [START system_instructions_live]
178185
// Specify the system instructions as part of creating the `LiveModel` instance
179-
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).liveModel(
180-
modelName = "gemini-2.5-flash",
181-
systemInstruction = content { text("You are a cat. Your name is Neko.") }
182-
)
186+
val model = Firebase.ai(backend = GenerativeBackend.googleAI())
187+
.liveModel(
188+
modelName = "gemini-2.5-flash",
189+
systemInstruction = content { text("You are a cat. Your name is Neko.") }
190+
)
183191
// [END system_instructions_live]
184192
}
185193
}

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ 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-2.5-flash", generationConfig = config)
59+
.generativeModel(
60+
modelName = "gemini-2.5-flash",
61+
generationConfig = config)
6062

6163
// ...
6264
// [END model_parameters_general]
@@ -80,7 +82,9 @@ class VertexAISnippets : ViewModel() {
8082
// Specify the config as part of creating the `GenerativeModel` instance
8183
val model =
8284
Firebase.ai(backend = GenerativeBackend.vertexAI())
83-
.imagenModel(modelName = "imagen-4.0-generate-001", generationConfig = config)
85+
.imagenModel(
86+
modelName = "imagen-4.0-generate-001",
87+
generationConfig = config)
8488

8589
// ...
8690
// [END model_parameters_imagen]
@@ -105,7 +109,9 @@ class VertexAISnippets : ViewModel() {
105109
// Specify the config as part of creating the `LiveModel` instance
106110
val model =
107111
Firebase.ai(backend = GenerativeBackend.vertexAI())
108-
.liveModel(modelName = "gemini-2.5-flash", generationConfig = config)
112+
.liveModel(
113+
modelName = "gemini-2.5-flash",
114+
generationConfig = config)
109115

110116
// ...
111117
// [END model_parameters_live]
@@ -166,21 +172,23 @@ class VertexAISnippets : ViewModel() {
166172
fun systemInstructions_general() {
167173
// [START system_instructions_general]
168174
// Specify the system instructions as part of creating the `GenerativeModel` instance
169-
val model = Firebase.ai(backend = GenerativeBackend.vertexAI()).generativeModel(
170-
modelName = "gemini-2.5-flash",
171-
systemInstruction = content { text("You are a cat. Your name is Neko.") }
172-
)
175+
val model = Firebase.ai(backend = GenerativeBackend.vertexAI())
176+
.generativeModel(
177+
modelName = "gemini-2.5-flash",
178+
systemInstruction = content { text("You are a cat. Your name is Neko.") }
179+
)
173180
// [END system_instructions_general]
174181
}
175182

176183
@OptIn(PublicPreviewAPI::class)
177184
fun systemInstructions_live() {
178185
// [START system_instructions_live]
179186
// Specify the system instructions as part of creating the `LiveModel` instance
180-
val model = Firebase.ai(backend = GenerativeBackend.vertexAI()).liveModel(
181-
modelName = "gemini-2.5-flash",
182-
systemInstruction = content { text("You are a cat. Your name is Neko.") }
183-
)
187+
val model = Firebase.ai(backend = GenerativeBackend.vertexAI())
188+
.liveModel(
189+
modelName = "gemini-2.5-flash",
190+
systemInstruction = content { text("You are a cat. Your name is Neko.") }
191+
)
184192
// [END system_instructions_live]
185193
}
186194
}

0 commit comments

Comments
 (0)