LiveSession

actual class LiveSession(source)

Represents a live WebSocket session capable of streaming content to and from the server.

expect class LiveSession(source)

Represents a live WebSocket session capable of streaming content to and from the server.

actual class LiveSession(source)

A Live API session of the platform SDK. The messages of the server are buffered from the moment the session opens until they are received. resumeSession opens a new session of the platform SDK and closes the current one, as the Android SDK does.

The platforms other than Android have no audio conversation of the SDK's own (the Android SDK records and plays the audio itself): startAudioConversation does nothing there, so stream audio with sendAudioRealtime and play the audio parts the server sends.

Functions

Link copied to clipboard
actual suspend fun close()

Closes the client session.

expect suspend fun close()

Closes the client session.

actual suspend fun close()

Closes the client session.

Link copied to clipboard

Indicates whether an audio conversation is being used for this session object.

Indicates whether an audio conversation is being used for this session object.

Indicates whether an audio conversation is being used for this session object.

Link copied to clipboard
actual fun isClosed(): Boolean

Indicates whether the underlying websocket connection is active.

expect fun isClosed(): Boolean

Indicates whether the underlying websocket connection is active.

actual fun isClosed(): Boolean

Indicates whether the underlying websocket connection is active.

Link copied to clipboard
actual fun receive(): Flow<LiveServerMessage>

Receives responses from the model for both streaming and standard requests.

expect fun receive(): Flow<LiveServerMessage>

Receives responses from the model for both streaming and standard requests.

actual fun receive(): Flow<LiveServerMessage>

Receives responses from the model for both streaming and standard requests.

Link copied to clipboard
actual suspend fun resumeSession(sessionResumption: SessionResumptionConfig?)

Resumes an existing live session with the server.

expect suspend fun resumeSession(sessionResumption: SessionResumptionConfig? = null)

Resumes an existing live session with the server.

actual suspend fun resumeSession(sessionResumption: SessionResumptionConfig?)

Resumes an existing live session with the server.

Link copied to clipboard
actual suspend fun send(content: Content, turnComplete: Boolean)

Streams client data to the model.

actual suspend fun send(text: String, turnComplete: Boolean)

Streams text data to the model.

expect suspend fun send(content: Content, turnComplete: Boolean = true)

Streams client data to the model.

expect suspend fun send(text: String, turnComplete: Boolean = true)

Streams text data to the model.

actual suspend fun send(content: Content, turnComplete: Boolean)

Streams client data to the model.

actual suspend fun send(text: String, turnComplete: Boolean)

Streams text data to the model.

Link copied to clipboard
actual suspend fun sendAudioRealtime(audio: InlineData)

Sends an audio input stream to the model, using the realtime API.

expect suspend fun sendAudioRealtime(audio: InlineData)

Sends an audio input stream to the model, using the realtime API.

actual suspend fun sendAudioRealtime(audio: InlineData)

Sends an audio input stream to the model, using the realtime API.

Link copied to clipboard
actual suspend fun sendFunctionResponse(functionList: List<FunctionResponsePart>)

Sends function calling responses to the model.

expect suspend fun sendFunctionResponse(functionList: List<FunctionResponsePart>)

Sends function calling responses to the model.

actual suspend fun sendFunctionResponse(functionList: List<FunctionResponsePart>)

Sends function calling responses to the model.

Link copied to clipboard
actual suspend fun sendStartActivityRealtime()

Manually marks the start of user activity, using the realtime API.

expect suspend fun sendStartActivityRealtime()

Manually marks the start of user activity, using the realtime API.

actual suspend fun sendStartActivityRealtime()

Manually marks the start of user activity, using the realtime API.

Link copied to clipboard
actual suspend fun sendStopActivityRealtime()

Manually marks the end of user activity, using the realtime API.

expect suspend fun sendStopActivityRealtime()

Manually marks the end of user activity, using the realtime API.

actual suspend fun sendStopActivityRealtime()

Manually marks the end of user activity, using the realtime API.

Link copied to clipboard
actual suspend fun sendTextRealtime(text: String)

Sends a text input stream to the model, using the realtime API.

expect suspend fun sendTextRealtime(text: String)

Sends a text input stream to the model, using the realtime API.

actual suspend fun sendTextRealtime(text: String)

Sends a text input stream to the model, using the realtime API.

Link copied to clipboard
actual suspend fun sendVideoRealtime(video: InlineData)

Sends a video frame to the model, using the realtime API.

expect suspend fun sendVideoRealtime(video: InlineData)

Sends a video frame to the model, using the realtime API.

actual suspend fun sendVideoRealtime(video: InlineData)

Sends a video frame to the model, using the realtime API.

Link copied to clipboard
actual suspend fun startAudioConversation(liveAudioConversationConfig: LiveAudioConversationConfig)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, enableInterruptions: Boolean)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, transcriptHandler: (Transcription?, Transcription?) -> Unit?, enableInterruptions: Boolean)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, transcriptHandler: (Transcription?, Transcription?) -> Unit?, goAwayHandler: (LiveServerGoAway) -> Unit?, enableInterruptions: Boolean)

Starts an audio conversation with the model, which can only be stopped using stopAudioConversation or close.

expect suspend fun startAudioConversation(liveAudioConversationConfig: LiveAudioConversationConfig)
expect suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart? = null)
expect suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart? = null, enableInterruptions: Boolean = false)
expect suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart? = null, transcriptHandler: (Transcription?, Transcription?) -> Unit? = null, enableInterruptions: Boolean = false)
expect suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart? = null, transcriptHandler: (Transcription?, Transcription?) -> Unit? = null, goAwayHandler: (LiveServerGoAway) -> Unit? = null, enableInterruptions: Boolean = false)

Starts an audio conversation with the model, which can only be stopped using stopAudioConversation or close.

actual suspend fun startAudioConversation(liveAudioConversationConfig: LiveAudioConversationConfig)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, enableInterruptions: Boolean)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, transcriptHandler: (Transcription?, Transcription?) -> Unit?, enableInterruptions: Boolean)
actual suspend fun startAudioConversation(functionCallHandler: (FunctionCallPart) -> FunctionResponsePart?, transcriptHandler: (Transcription?, Transcription?) -> Unit?, goAwayHandler: (LiveServerGoAway) -> Unit?, enableInterruptions: Boolean)

Starts an audio conversation with the model, which can only be stopped using stopAudioConversation or close.

Link copied to clipboard

Stops the audio conversation with the model.

Stops the audio conversation with the model.

Stops receiving, as on Android (where it also stops the audio conversation, which does not exist here).

Link copied to clipboard
actual fun stopReceiving()

Stops receiving from the model.

expect fun stopReceiving()

Stops receiving from the model.

actual fun stopReceiving()

Stops receiving from the model.