diff --git a/misc/build.gradle.kts b/misc/build.gradle.kts index cb090542..52234ff6 100644 --- a/misc/build.gradle.kts +++ b/misc/build.gradle.kts @@ -72,6 +72,15 @@ dependencies { implementation(libs.androidx.startup.runtime) implementation(libs.androidx.window.java) implementation(libs.appcompat) + // [START firebase_ai_bom] + // Import the BoM for the Firebase platform + implementation(platform("com.google.firebase:firebase-bom:34.3.0")) + + // Add the dependency for the Firebase AI Logic library When using the BoM, + // you don't specify versions in Firebase library dependencies + implementation("com.google.firebase:firebase-ai") + // [END firebase_ai_bom] + testImplementation(libs.junit) testImplementation(kotlin("test")) androidTestImplementation(libs.androidx.test.ext.junit) diff --git a/misc/src/main/java/com/example/snippets/ai/GenerativeAiSnippets.kt b/misc/src/main/java/com/example/snippets/ai/GenerativeAiSnippets.kt new file mode 100644 index 00000000..6a2d4280 --- /dev/null +++ b/misc/src/main/java/com/example/snippets/ai/GenerativeAiSnippets.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.snippets.ai + +import com.google.firebase.Firebase +import com.google.firebase.ai.ai +import com.google.firebase.ai.type.GenerativeBackend + +object GeminiDeveloperApi25FlashModelConfiguration { + // [START firebase_ai_generative_backend_configuration] + // Start by instantiating a GenerativeModel and specifying the model name: + val model = Firebase.ai(backend = GenerativeBackend.googleAI()) + .generativeModel("gemini-2.5-flash") + // [END firebase_ai_generative_backend_configuration] +}