From e0cfdd1df07120f8650131a82a8c96fbaab005f7 Mon Sep 17 00:00:00 2001 From: emilypgoogle <110422458+emilypgoogle@users.noreply.github.com> Date: Tue, 20 May 2025 15:58:21 +0000 Subject: [PATCH 1/4] Fix Firebase AI StackOverflow --- .../src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt index bbce7546eff..4052fde809e 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt @@ -220,7 +220,9 @@ internal constructor( } /** The [FirebaseAI] instance for the provided [FirebaseApp] using the Google AI Backend. */ - @JvmStatic public fun getInstance(app: FirebaseApp): FirebaseAI = getInstance(app) + @JvmStatic public fun getInstance( + app: FirebaseApp + ): FirebaseAI = getInstance(app, GenerativeBackend.googleAI()) private const val GEMINI_MODEL_NAME_PREFIX = "gemini-" From bf9727006e617b6383d15dc4feba3cf6bdad836a Mon Sep 17 00:00:00 2001 From: emilypgoogle <110422458+emilypgoogle@users.noreply.github.com> Date: Tue, 20 May 2025 16:00:30 +0000 Subject: [PATCH 2/4] Add changelog --- firebase-ai/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/firebase-ai/CHANGELOG.md b/firebase-ai/CHANGELOG.md index 8d26e6850f1..78abd0e3b67 100644 --- a/firebase-ai/CHANGELOG.md +++ b/firebase-ai/CHANGELOG.md @@ -1,4 +1,5 @@ # Unreleased +* [fixed] Fixed `FirebaseAI.getInstance` StackOverflowException (#6971) * [fixed] **Breaking Change**: Fixed missing builder methods and return types in builders. * [changed] **Breaking Change**: `LiveModelFutures.connect` now returns `ListenableFuture` instead of `ListenableFuture`. * **Action Required:** Remove any transformations from LiveSession object to LiveSessionFutures object. From ad7f6294d4c2dc6b673dc44e9e677b0d40288c29 Mon Sep 17 00:00:00 2001 From: emilypgoogle <110422458+emilypgoogle@users.noreply.github.com> Date: Tue, 20 May 2025 16:26:59 +0000 Subject: [PATCH 3/4] Format --- .../src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt index 4052fde809e..94bcfb0cc65 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt @@ -220,9 +220,8 @@ internal constructor( } /** The [FirebaseAI] instance for the provided [FirebaseApp] using the Google AI Backend. */ - @JvmStatic public fun getInstance( - app: FirebaseApp - ): FirebaseAI = getInstance(app, GenerativeBackend.googleAI()) + @JvmStatic public fun getInstance(app: FirebaseApp): FirebaseAI = + getInstance(app, GenerativeBackend.googleAI()) private const val GEMINI_MODEL_NAME_PREFIX = "gemini-" From 5e147495018a1983c3aba8cbccc1c8cd4305414e Mon Sep 17 00:00:00 2001 From: emilypgoogle <110422458+emilypgoogle@users.noreply.github.com> Date: Tue, 20 May 2025 19:10:10 +0000 Subject: [PATCH 4/4] Format --- .../src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt index 94bcfb0cc65..86eb8057b1d 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt @@ -220,7 +220,8 @@ internal constructor( } /** The [FirebaseAI] instance for the provided [FirebaseApp] using the Google AI Backend. */ - @JvmStatic public fun getInstance(app: FirebaseApp): FirebaseAI = + @JvmStatic + public fun getInstance(app: FirebaseApp): FirebaseAI = getInstance(app, GenerativeBackend.googleAI()) private const val GEMINI_MODEL_NAME_PREFIX = "gemini-"