Skip to content

Commit 6974f49

Browse files
authored
[ALF] Deprecate UsageMetadata public constructor (#7420)
The class was never meant to be instantiated by clients. The public constructor is now marked as deprecated and will be removed in a upcoming major version bump. Additionally, the PR includes an unused parameter in the internal version to get the code to build. It will be removed in a upcoming change were an actual new parameter, exclusive to the internal constructor, is added.
1 parent e6a9f6a commit 6974f49

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

firebase-ai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [changed] **Breaking Change**: Removed the `candidateCount` option from `LiveGenerationConfig`
44
(#7382)
55
- [changed] Added better error messages to `ServiceConnectionHandshakeFailedException` (#7412)
6+
- [changed] Marked the public constructor for `UsageMetadata` as deprecated (#7420)
67

78
# 17.3.0
89

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/UsageMetadata.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,35 @@ import kotlinx.serialization.Serializable
3030
* candidates.
3131
* @param thoughtsTokenCount The number of tokens used by the model's internal "thinking" process.
3232
*/
33-
public class UsageMetadata(
33+
public class UsageMetadata
34+
internal constructor(
3435
public val promptTokenCount: Int,
3536
public val candidatesTokenCount: Int?,
3637
public val totalTokenCount: Int,
3738
public val promptTokensDetails: List<ModalityTokenCount>,
3839
public val candidatesTokensDetails: List<ModalityTokenCount>,
3940
public val thoughtsTokenCount: Int,
41+
placeholder: Unit
4042
) {
4143

44+
@Deprecated("Not intended for public use")
45+
public constructor(
46+
promptTokenCount: Int,
47+
candidatesTokenCount: Int?,
48+
totalTokenCount: Int,
49+
promptTokensDetails: List<ModalityTokenCount>,
50+
candidatesTokensDetails: List<ModalityTokenCount>,
51+
thoughtsTokenCount: Int
52+
) : this(
53+
promptTokenCount,
54+
candidatesTokenCount,
55+
totalTokenCount,
56+
promptTokensDetails,
57+
candidatesTokensDetails,
58+
thoughtsTokenCount,
59+
Unit
60+
)
61+
4262
@Serializable
4363
internal data class Internal(
4464
val promptTokenCount: Int? = null,

0 commit comments

Comments
 (0)