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

Make CountTokenRequest contain the full request #152

Merged
merged 15 commits into from
Jun 10, 2024
Prev Previous commit
remove extra fullModelName
David Motsonashvili committed Jun 7, 2024
commit f26b607faeb823adcc4e9a3190c75f53868509a8
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ import android.graphics.Bitmap
import com.google.ai.client.generativeai.common.APIController
import com.google.ai.client.generativeai.common.CountTokensRequest
import com.google.ai.client.generativeai.common.GenerateContentRequest
import com.google.ai.client.generativeai.common.util.fullModelName
import com.google.ai.client.generativeai.internal.util.toInternal
import com.google.ai.client.generativeai.internal.util.toPublic
import com.google.ai.client.generativeai.type.Content
@@ -252,14 +253,4 @@ internal constructor(
.firstOrNull { it != FinishReason.STOP }
?.let { throw ResponseStoppedException(this) }
}

companion object {
/**
* Ensures the model name provided has a `models/` prefix
*
* Models must be prepended with the `models/` prefix when communicating with the backend.
*/
private fun fullModelName(name: String): String =
name.takeIf { it.contains("/") } ?: "models/$name"
}
}