Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add totalBillableCharacters to CountTokensResponse #106

Merged
merged 10 commits into from
Apr 3, 2024
1 change: 1 addition & 0 deletions .changes/baseball-comfort-dock-appliance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"MAJOR","changes":["Make totalTokens in CountTokensResponse nullable"]}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ data class GenerateContentResponse(
val usageMetadata: UsageMetadata? = null
) : Response

@Serializable data class CountTokensResponse(val totalTokens: Int) : Response
@Serializable
data class CountTokensResponse(val totalTokens: Int, val totalBillableCharacters: Int? = null) :
Response

@Serializable data class GRpcErrorResponse(val error: GRpcError) : Response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ internal class RequestFormatTests {

@Test
fun `countTokenRequest doesn't include the model name`() = doBlocking {
val response = JSON.encodeToString(CountTokensResponse(totalTokens = 10))
val response =
JSON.encodeToString(CountTokensResponse(totalTokens = 10, totalBillableCharacters = 10))
val mockEngine = MockEngine {
respond(response, HttpStatusCode.OK, headersOf(HttpHeaders.ContentType, "application/json"))
}
Expand Down
Loading