Models

class Models

Provides methods for interacting with the available GenAI models. Instantiating this class is not required. After instantiating a Client, access methods through client.models directly.

Functions

Link copied to clipboard
suspend fun computeTokens(model: String, content: Content, config: ComputeTokensConfig? = null): ComputeTokensResponse

Computes the number of tokens for the provided Content object.

suspend fun computeTokens(model: String, text: String, config: ComputeTokensConfig? = null): ComputeTokensResponse

Computes the number of tokens for the provided text string.

suspend fun computeTokens(model: String, contents: List<Content>, config: ComputeTokensConfig? = null): ComputeTokensResponse

Computes the number of tokens for the given List object.

Link copied to clipboard
suspend fun countTokens(model: String, content: Content, config: CountTokensConfig? = null): CountTokensResponse

Counts the number of tokens in the provided Content object.

suspend fun countTokens(model: String, text: String, config: CountTokensConfig? = null): CountTokensResponse

Counts the number of tokens in the provided text string.

suspend fun countTokens(model: String, contents: List<Content>, config: CountTokensConfig? = null): CountTokensResponse

Counts the number of tokens in the given List object.

Link copied to clipboard
suspend fun delete(model: String, config: DeleteModelConfig? = null): DeleteModelResponse

Deletes a tuned model by its name.

Link copied to clipboard
suspend fun embedContent(model: String, content: Content, config: EmbedContentConfig? = null): EmbedContentResponse
suspend fun embedContent(model: String, contents: List<Content>, config: EmbedContentConfig? = null): EmbedContentResponse

Calculates embeddings for the given content.

suspend fun embedContent(model: String, text: String, config: EmbedContentConfig? = null): EmbedContentResponse

Calculates embeddings for the given text string.

Link copied to clipboard
suspend fun generateContent(model: String, content: Content, config: GenerateContentConfig? = null): GenerateContentResponse

Generates content given a GenAI model and a content object.

suspend fun generateContent(model: String, text: String, config: GenerateContentConfig? = null): GenerateContentResponse

Generates content given a GenAI model and a text string.

suspend fun generateContent(model: String, contents: List<Content>, config: GenerateContentConfig? = null): GenerateContentResponse

Generates content given a GenAI model and a list of content.

Link copied to clipboard

Generates content with streaming support given a GenAI model and a content object.

Generates content with streaming support given a GenAI model and a text string.

Generates content with streaming support given a GenAI model and a list of content.

Link copied to clipboard
suspend fun get(model: String, config: GetModelConfig? = null): Model

Fetches information about a model by name.

Link copied to clipboard
fun list(config: ListModelsConfig? = null): Pager<Model>

Lists the available models.

Link copied to clipboard
suspend fun update(model: String, config: UpdateModelConfig? = null): Model

Updates a tuned model by its name using the optional config.