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 5
5
* [ changed] Introduced the ` Voice ` class, which accepts a voice name, and deprecated the ` Voices ` class.
6
6
* [ changed] ** Breaking Change** : Updated ` SpeechConfig ` to take in ` Voice ` class instead of ` Voices ` class.
7
7
* ** 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
8
9
9
10
10
11
# 16.0.0
Original file line number Diff line number Diff line change 18
18
package com.google.firebase.ai.common
19
19
20
20
import com.google.firebase.ai.common.util.fullModelName
21
+ import com.google.firebase.ai.common.util.trimmedModelName
21
22
import com.google.firebase.ai.type.Content
22
23
import com.google.firebase.ai.type.GenerationConfig
23
24
import com.google.firebase.ai.type.ImagenImageFormat
@@ -57,7 +58,7 @@ internal data class CountTokensRequest(
57
58
CountTokensRequest (
58
59
generateContentRequest =
59
60
generateContentRequest.model?.let {
60
- generateContentRequest.copy(model = fullModelName(it ))
61
+ generateContentRequest.copy(model = fullModelName(trimmedModelName(it) ))
61
62
}
62
63
? : generateContentRequest
63
64
)
Original file line number Diff line number Diff line change @@ -23,3 +23,5 @@ package com.google.firebase.ai.common.util
23
23
*/
24
24
internal fun fullModelName (name : String ): String =
25
25
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