Package-level declarations

Types

Link copied to clipboard
class AutomaticFunctionCalling(val functions: List<CallableFunction>, val maximumRemoteCalls: Int = 10, val runFunctionsInParallel: Boolean = false)

The functions the model may ask for during a chat, and the limits on running them.

Link copied to clipboard
class Batches
Link copied to clipboard
class Caches

Provides methods for managing cached content. Instantiating this class is not required. After instantiating a Client, access methods through client.caches directly.

Link copied to clipboard

A function you give to the model, and the handler that runs when the model asks for it.

Link copied to clipboard
class Chat

A multi-turn chat session with a generative model.

Link copied to clipboard
class Chats

A factory for multi-turn Chat sessions.

Link copied to clipboard

The main entry point for the Google Gen AI SDK.

Link copied to clipboard
class ClientException(val code: Int, val status: String, message: String) : GenAiApiException

Exception thrown for 4xx client errors from the GenAI API.

Link copied to clipboard
annotation class Describe(val value: String)

Describes a function parameter to the model, so it knows what to pass.

Link copied to clipboard

Marks declarations that are experimental in the Google GenAI SDK.

Link copied to clipboard
class Files
Link copied to clipboard
open class GenAiApiException(val code: Int, val status: String, message: String) : GenAiException

Exception thrown when the GenAI API returns an error response.

Link copied to clipboard
sealed class GenAiException : Exception

Base exception class for all exceptions originating from the GenAI SDK.

Link copied to clipboard
expect class GoogleCredentials

Represents the credentials used to authenticate requests to the Google GenAI API.

actual typealias GoogleCredentials = <Error class: unknown class>
Link copied to clipboard
class Live

The Live API client for establishing WebSocket connections to Gemini models.

Link copied to clipboard

Represents an active WebSocket session with the Live API.

Link copied to clipboard
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.

Link copied to clipboard
class Page<T>

Represents a single immutable page of results.

Link copied to clipboard
class Pager<T> : Flow<T>

A generic pagination class that implements Flow of T items.

Link copied to clipboard
class ServerException(val code: Int, val status: String, message: String) : GenAiApiException

Exception thrown for 5xx server errors from the GenAI API.

Link copied to clipboard
class Tokens

Provides methods for managing ephemeral auth tokens. The tokens module is experimental.

Link copied to clipboard
class Tunings

Functions

Link copied to clipboard
inline fun <R> callableFunction(name: String, description: String? = null, noinline handler: suspend () -> R): CallableFunction

Makes a CallableFunction from a function that takes no parameters.

inline fun <A, R> callableFunction(name: String, description: String? = null, noinline handler: suspend (A) -> R): CallableFunction

Makes a CallableFunction from a function that takes one @Serializable class of parameters.

inline fun <A, R> callableFunction(name: String, description: String? = null, paramName: String, noinline handler: suspend (A) -> R): CallableFunction

Makes a CallableFunction from a function that takes one parameter.

inline fun <A, B, R> callableFunction(name: String, description: String? = null, paramNames: List<String>, noinline handler: suspend (A, B) -> R): CallableFunction

Makes a CallableFunction from a function that takes two parameters.

inline fun <A, B, C, R> callableFunction(name: String, description: String? = null, paramNames: List<String>, noinline handler: suspend (A, B, C) -> R): CallableFunction

Makes a CallableFunction from a function that takes three parameters.

Link copied to clipboard
suspend fun Files.downloadToFile(file: File, outputPath: <Error class: unknown class>, config: DownloadFileConfig? = null)
suspend fun Files.downloadToFile(fileName: String, outputPath: <Error class: unknown class>, config: DownloadFileConfig? = null)

Downloads a file from the API and streams it directly to a local file path.

Link copied to clipboard
suspend fun Files.upload(path: <Error class: unknown class>, config: UploadFileConfig? = null): File

Uploads a file at the specified path to the API.

suspend fun Files.upload(file: <Error class: unknown class>, config: UploadFileConfig? = null): File

Uploads a file to the API.