LiveSession

Represents an active WebSocket session with the Live API.

Functions

Link copied to clipboard
open override fun close()

Forcefully closes the WebSocket session synchronously.

Link copied to clipboard
suspend fun closeSession()

Gracefully closes the WebSocket session.

Link copied to clipboard

Receives a flow of messages from the server.

Link copied to clipboard
suspend fun sendClientContent(turns: List<Content>? = null, turnComplete: Boolean = true)

Sends standard client content (text, blobs) to the model.

Link copied to clipboard
suspend fun sendRealtimeInput(audio: Blob? = null, audioStreamEnd: Boolean? = null, video: Blob? = null, text: String? = null, activityStart: ActivityStart? = null, activityEnd: ActivityEnd? = null)

Sends real-time input (audio, video, etc.) to the model.

Link copied to clipboard
suspend fun sendToolResponse(functionResponse: FunctionResponse)
suspend fun sendToolResponse(functionResponses: List<FunctionResponse>)

Sends a tool response to the model after executing a tool call.