LiveAPIClient
Methods
addEventListener
addEventListener(event: | , callback: Function
): void
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
clearMediaBuffer(parameters: ): void
Clears the LiveAPI WebSocket media buffer.
Parameters
parameters:
OptionalOptional. Media buffer clearing parameters
Returns
type:
void
close
close(): void
Closes the LiveAPI connection (over WebSocket) or connection attempt.
Returns
type:
void
id
id(): string
Returns the LiveAPIClient id.
Returns
type:
string
removeEventListener
removeEventListener(event: | , callback: Function
): void
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
sendClientContent(input: Object
): void
Transmits a LiveClientContent over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.1.0#Session.SendRealtimeInput
Parameters
input:
Object
Returns
type:
void
sendMediaTo
sendMediaTo(mediaUnit: , parameters: ): void
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
sendRealtimeInput(input: Object
): void
Transmits a LiveClientRealtimeInput over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.1.0#Session.SendClientContent
Parameters
input:
Object
Returns
type:
void
sendToolResponse
sendToolResponse(input: Object
): void
Transmits a LiveClientToolResponse over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.1.0#Session.SendToolResponse
Parameters
input:
Object
Returns
type:
void
stopMediaTo
stopMediaTo(mediaUnit: ): void
Stops sending media from the LiveAPI (via WebSocket) to the media unit.
Parameters
mediaUnit:
Media unit that stops receiving media
Returns
type:
void
webSocketId
webSocketId(): string
Returns the LiveAPI WebSocket id.
Returns
type:
string