Skip to content

Commit 75e66a2

Browse files
committed
[ALF] Deprecate UsageMetadata public constructor
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 75e66a2

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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)