Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions firebase-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [changed] Introduced the `Voice` class, which accepts a voice name, and deprecated the `Voices` class.
* [changed] **Breaking Change**: Updated `SpeechConfig` to take in `Voice` class instead of `Voices` class.
* **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


# 16.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.google.firebase.ai.common

import com.google.firebase.ai.common.util.fullModelName
import com.google.firebase.ai.common.util.trimmedModelName
import com.google.firebase.ai.type.Content
import com.google.firebase.ai.type.GenerationConfig
import com.google.firebase.ai.type.ImagenImageFormat
Expand Down Expand Up @@ -57,7 +58,7 @@ internal data class CountTokensRequest(
CountTokensRequest(
generateContentRequest =
generateContentRequest.model?.let {
generateContentRequest.copy(model = fullModelName(it))
generateContentRequest.copy(model = fullModelName(trimmedModelName(it)))
}
?: generateContentRequest
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ package com.google.firebase.ai.common.util
*/
internal fun fullModelName(name: String): String =
name.takeIf { it.contains("/") } ?: "models/$name"

internal fun trimmedModelName(name: String): String = name.split("/").last()
Loading