Skip to content

Commit 28f729c

Browse files
committed
Merge branch 'main' into dl/url-context
2 parents be567a3 + 6974f49 commit 28f729c

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

firebase-ai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [changed] Added support for the URL context tool, which allows the model to access content from
55
provided public web URLs to inform and enhance its responses. (#7382)
66
- [changed] Added better error messages to `ServiceConnectionHandshakeFailedException` (#7412)
7+
- [changed] Marked the public constructor for `UsageMetadata` as deprecated (#7420)
78

89
# 17.3.0
910

firebase-ai/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ package com.google.firebase.ai.type {
12571257
}
12581258

12591259
public final class UsageMetadata {
1260-
ctor public UsageMetadata(int promptTokenCount, Integer? candidatesTokenCount, int totalTokenCount, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> promptTokensDetails, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> candidatesTokensDetails, int thoughtsTokenCount, int toolUsePromptTokenCount, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> toolUsePromptTokensDetails);
1260+
ctor @Deprecated public UsageMetadata(int promptTokenCount, Integer? candidatesTokenCount, int totalTokenCount, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> promptTokensDetails, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> candidatesTokensDetails, int thoughtsTokenCount, int toolUsePromptTokenCount, java.util.List<com.google.firebase.ai.type.ModalityTokenCount> toolUsePromptTokensDetails);
12611261
method public Integer? getCandidatesTokenCount();
12621262
method public java.util.List<com.google.firebase.ai.type.ModalityTokenCount> getCandidatesTokensDetails();
12631263
method public int getPromptTokenCount();

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import kotlinx.serialization.Serializable
3333
* @param thoughtsTokenCount The number of tokens used by the model's internal "thinking" process.
3434
* @param toolUsePromptTokenCount The number of tokens used by tools.
3535
*/
36-
public class UsageMetadata(
36+
public class UsageMetadata
37+
internal constructor(
3738
public val promptTokenCount: Int,
3839
public val candidatesTokenCount: Int?,
3940
public val totalTokenCount: Int,
@@ -42,8 +43,31 @@ public class UsageMetadata(
4243
public val thoughtsTokenCount: Int,
4344
public val toolUsePromptTokenCount: Int,
4445
public val toolUsePromptTokensDetails: List<ModalityTokenCount>,
46+
placeholder: Unit
4547
) {
4648

49+
@Deprecated("Not intended for public use")
50+
public constructor(
51+
promptTokenCount: Int,
52+
candidatesTokenCount: Int?,
53+
totalTokenCount: Int,
54+
promptTokensDetails: List<ModalityTokenCount>,
55+
candidatesTokensDetails: List<ModalityTokenCount>,
56+
thoughtsTokenCount: Int,
57+
toolUsePromptTokenCount: Int,
58+
toolUsePromptTokensDetails: List<ModalityTokenCount>
59+
) : this(
60+
promptTokenCount,
61+
candidatesTokenCount,
62+
totalTokenCount,
63+
promptTokensDetails,
64+
candidatesTokensDetails,
65+
thoughtsTokenCount,
66+
toolUsePromptTokenCount,
67+
toolUsePromptTokensDetails,
68+
Unit
69+
)
70+
4771
@Serializable
4872
internal data class Internal(
4973
val promptTokenCount: Int? = null,

0 commit comments

Comments
 (0)