From 0874a3e66d5ecf346fdd2818a06a9ad055ef4245 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 19:56:47 +0000 Subject: [PATCH 1/5] Deprecate totalBillableCharacters in firebase-ai I've marked the `totalBillableCharacters` field in `CountTokensResponse.kt` as deprecated. This includes adding the `@Deprecated` annotation and a corresponding KDoc `@deprecated` tag. The field is planned to be removed in a future version of the SDK. --- .../kotlin/com/google/firebase/ai/type/CountTokensResponse.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt index 955f7bf941a..c1cce09a9ba 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt @@ -30,12 +30,13 @@ import kotlinx.serialization.Serializable * to the model as a prompt. **Important:** this property does not include billable image, video or * other non-text input. See * [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details. + * @deprecated This field is deprecated and will be removed in a future version. * @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the * prompt. */ public class CountTokensResponse( public val totalTokens: Int, - public val totalBillableCharacters: Int? = null, + @Deprecated("This field is deprecated and will be removed in a future version.") public val totalBillableCharacters: Int? = null, public val promptTokensDetails: List = emptyList(), ) { public operator fun component1(): Int = totalTokens From 591d57db940fe43a385c3ff5cddb767f75f6a6e7 Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Paz Date: Tue, 17 Jun 2025 16:09:51 -0400 Subject: [PATCH 2/5] Format fix --- .../kotlin/com/google/firebase/ai/type/CountTokensResponse.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt index c1cce09a9ba..47907f4ff2f 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt @@ -36,7 +36,8 @@ import kotlinx.serialization.Serializable */ public class CountTokensResponse( public val totalTokens: Int, - @Deprecated("This field is deprecated and will be removed in a future version.") public val totalBillableCharacters: Int? = null, + @Deprecated("This field is deprecated and will be removed in a future version.") + public val totalBillableCharacters: Int? = null, public val promptTokensDetails: List = emptyList(), ) { public operator fun component1(): Int = totalTokens From 9ba7d53b593a9499447b561b659ceeac26be1ced Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Paz Date: Tue, 17 Jun 2025 16:12:41 -0400 Subject: [PATCH 3/5] Add changelog entry --- firebase-ai/CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firebase-ai/CHANGELOG.md b/firebase-ai/CHANGELOG.md index 3174d1364b8..3a5408f227d 100644 --- a/firebase-ai/CHANGELOG.md +++ b/firebase-ai/CHANGELOG.md @@ -1,5 +1,5 @@ # Unreleased - +* [changed] Deprecate the `totalBillableCharacters` field (only usable with pre-2.0 models). (#7042) # 16.1.0 * [fixed] Fixed `FirebaseAI.getInstance` StackOverflowException (#6971) @@ -9,7 +9,7 @@ * **Action Required:** Update all references of `SpeechConfig` initialization to use `Voice` class. * [fixed] Fix incorrect model name in count token requests to the developer API backend * [feature] Added support for extra schema properties like `title`, `minItems`, `maxItems`, `minimum` - and `maximum`. As well as support for the `anyOf` schema. + and `maximum`. As well as support for the `anyOf` schema. # 16.0.0 * [feature] Initial release of the Firebase AI SDK (`firebase-ai`). This SDK *replaces* the previous @@ -28,4 +28,3 @@ Note: This feature is in Public Preview, which means that it is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - From 3a9efd9b1b71c49e96d502574000ad1ce23f7c28 Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Date: Tue, 17 Jun 2025 16:15:13 -0400 Subject: [PATCH 4/5] Update CountTokensResponse.kt --- .../com/google/firebase/ai/type/CountTokensResponse.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt index 47907f4ff2f..fba5202cae0 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt @@ -29,10 +29,9 @@ import kotlinx.serialization.Serializable * @property totalBillableCharacters The total number of billable characters in the text input given * to the model as a prompt. **Important:** this property does not include billable image, video or * other non-text input. See - * [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details. - * @deprecated This field is deprecated and will be removed in a future version. + * [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details. * @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the - * prompt. + * prompt. */ public class CountTokensResponse( public val totalTokens: Int, From aac46c907e54670848d08c5d7e48a8b76650c54b Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Paz Date: Wed, 18 Jun 2025 12:14:21 -0400 Subject: [PATCH 5/5] Fix format --- .../kotlin/com/google/firebase/ai/type/CountTokensResponse.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt index fba5202cae0..df80744b260 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/CountTokensResponse.kt @@ -29,9 +29,9 @@ import kotlinx.serialization.Serializable * @property totalBillableCharacters The total number of billable characters in the text input given * to the model as a prompt. **Important:** this property does not include billable image, video or * other non-text input. See - * [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details. + * [Vertex AI pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) for details. * @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the - * prompt. + * prompt. */ public class CountTokensResponse( public val totalTokens: Int,