LiveAPIClient
Note that the Gemini.LiveAPIClient using the Google Gen AI Go SDK v1.32.0.
Methods
addEventListener
Adds a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
Event class (i.e., [Gemini.LiveAPIEvents.SetupComplete])
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
clearMediaBuffer
Clears the LiveAPI WebSocket media buffer.
Parameters
parameters:
OptionalOptional. Media buffer clearing parameters
Returns
type:
void
close
Closes the LiveAPI connection (over WebSocket) or connection attempt.
Returns
type:
void
id
Returns the LiveAPIClient id.
Returns
type:
string
removeEventListener
Removes a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event.
Parameters
event:
Event class (i.e., [Gemini.LiveAPIEvents.SetupComplete])
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
sendClientContent
Transmits a LiveClientContent over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.32.0#Session.SendClientContent
Parameters
input:
Object
Returns
type:
void
sendMediaTo
Starts sending media from the LiveAPI (via WebSocket) to the media unit. LiveAPI works in real time.
Parameters
mediaUnit:
Media unit that receives media
parameters:
OptionalOptional interaction parameters
Returns
type:
void
sendRealtimeInput
Transmits a LiveClientRealtimeInput over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.32.0#Session.SendRealtimeInput
Parameters
input:
Object
Returns
type:
void
sendToolResponse
Transmits a LiveClientToolResponse over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.32.0#Session.SendToolResponse
Parameters
input:
Object
Returns
type:
void
stopMediaTo
Stops sending media from the LiveAPI (via WebSocket) to the media unit.
Parameters
mediaUnit:
Media unit that stops receiving media
Returns
type:
void
webSocketId
Returns the LiveAPI WebSocket id.
Returns
type:
string