File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed
src/main/kotlin/com/google/firebase/ai/common Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 55* [ changed] Introduced the ` Voice ` class, which accepts a voice name, and deprecated the ` Voices ` class.
66* [ changed] ** Breaking Change** : Updated ` SpeechConfig ` to take in ` Voice ` class instead of ` Voices ` class.
77 * ** Action Required:** Update all references of ` SpeechConfig ` initialization to use ` Voice ` class.
8+ * [ fixed] Fix incorrect model name in count token requests to the developer API backend
89
910
1011# 16.0.0
Original file line number Diff line number Diff line change 1818package com.google.firebase.ai.common
1919
2020import com.google.firebase.ai.common.util.fullModelName
21+ import com.google.firebase.ai.common.util.trimmedModelName
2122import com.google.firebase.ai.type.Content
2223import com.google.firebase.ai.type.GenerationConfig
2324import com.google.firebase.ai.type.ImagenImageFormat
@@ -57,7 +58,7 @@ internal data class CountTokensRequest(
5758 CountTokensRequest (
5859 generateContentRequest =
5960 generateContentRequest.model?.let {
60- generateContentRequest.copy(model = fullModelName(it ))
61+ generateContentRequest.copy(model = fullModelName(trimmedModelName(it) ))
6162 }
6263 ? : generateContentRequest
6364 )
Original file line number Diff line number Diff line change @@ -23,3 +23,5 @@ package com.google.firebase.ai.common.util
2323 */
2424internal fun fullModelName (name : String ): String =
2525 name.takeIf { it.contains(" /" ) } ? : " models/$name "
26+
27+ internal fun trimmedModelName (name : String ): String = name.split(" /" ).last()
You can’t perform that action at this time.
0 commit comments