Rate this page:

LiveAPIClient

Methods

addEventListener

Copy URL
addEventListener(event: 

Events

|

LiveAPIEvents

,
callback:

Function

):

void

Adds a handler for the specified Gemini.Experimental.LiveAPIEvents or Gemini.Experimental.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.Experimental.LiveAPIEvents.BidiGenerateContentSetupComplete])

  • callback:

    Function

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

Returns

  • type:

    void

bidiGenerateContentClientContent

Copy URL
bidiGenerateContentClientContent(parameters: 

Object

):

void

Incremental update of the current conversation delivered from the client. https://ai.google.dev/gemini-api/docs/live#bidigeneratecontentclientcontent

Parameters

  • parameters:

    Object

Returns

  • type:

    void

bidiGenerateContentRealtimeInput

Copy URL
bidiGenerateContentRealtimeInput(parameters: 

Object

):

void

Parameters

  • parameters:

    Object

Returns

  • type:

    void

bidiGenerateContentToolResponse

Copy URL
bidiGenerateContentToolResponse(parameters: 

Object

):

void

Client generated response to a ToolCall received from the server. https://ai.google.dev/gemini-api/docs/live#bidigeneratecontenttoolresponse

Parameters

  • parameters:

    Object

Returns

  • type:

    void

close

Copy URL
close(): 

void

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

Returns

  • type:

    void

id

Copy URL
id(): 

string

Returns the LiveAPIClient id.

Returns

  • type:

    string

removeEventListener

Copy URL
removeEventListener(event: 

Events

|

LiveAPIEvents

,
callback:

Function

):

void

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

Parameters

  • event:

    Events

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

  • callback:

    Function

    Optional

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

Returns

  • type:

    void

sendMediaTo

Copy URL
sendMediaTo(mediaUnit: 

VoxMediaUnit

,
parameters:

SendMediaParameters

):

void

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

Parameters

Returns

  • type:

    void

stopMediaTo

Copy URL
stopMediaTo(mediaUnit: 

VoxMediaUnit

):

void

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

Parameters

Returns

  • type:

    void

webSocketId

Copy URL
webSocketId(): 

string

Returns the LiveAPI WebSocket id.

Returns

  • type:

    string