File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
firebase-ai/src/main/kotlin/com/google/firebase/ai/common Expand file tree Collapse file tree 2 files changed +4
-1
lines changed 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