Rate this page:

LiveAPIClient

Note that the Gemini.LiveAPIClient using the Google Gen AI Go SDK v1.32.0.

Methods

addEventListener

Copy URL

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:

    Events

    Event class (i.e., [Gemini.LiveAPIEvents.SetupComplete])

  • callback:

    Function

    Handler function. A single parameter is passed - object with event information

Returns

  • type:

    void

clearMediaBuffer

Copy URL

Clears the LiveAPI WebSocket media buffer.

Parameters

Returns

  • type:

    void

close

Copy URL

Closes the LiveAPI connection (over WebSocket) or connection attempt.

Returns

  • type:

    void

id

Copy URL

Returns the LiveAPIClient id.

Returns

  • type:

    string

removeEventListener

Copy URL

Removes a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event.

Parameters

  • event:

    Events

    Event class (i.e., [Gemini.LiveAPIEvents.SetupComplete])

  • callback:

    Function

    Optional

    Optional. Handler function. If not specified, all handler functions are removed

Returns

  • type:

    void

sendClientContent

Copy URL

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

Copy URL

Starts sending media from the LiveAPI (via WebSocket) to the media unit. LiveAPI works in real time.

Parameters

Returns

  • type:

    void

sendRealtimeInput

Copy URL

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

Copy URL

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

Copy URL

Stops sending media from the LiveAPI (via WebSocket) to the media unit.

Parameters

Returns

  • type:

    void

webSocketId

Copy URL

Returns the LiveAPI WebSocket id.

Returns

  • type:

    string