Gemini
Voice agent client for Google Gemini Live API real-time voice scenarios.
Voice agent client for Google Gemini Live API real-time voice scenarios.
Gemini provides a VoxEngine client for connecting a call or media unit to the Google Gemini Live API over WebSocket.
Use Gemini.createLiveAPIClient(...) to create a LiveAPIClient for the current scenario.
Add the module before using the namespace:
Create the client, bridge media, and listen for Live API events.
Creates a Gemini.LiveAPIClient instance.
Parameters
Returns
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
Returns
Clears the LiveAPI WebSocket media buffer.
Parameters
Returns
Closes the LiveAPI connection (over WebSocket) or connection attempt.
Parameters
This method does not accept parameters.
Returns
Returns the LiveAPIClient id.
Parameters
This method does not accept parameters.
Returns
Removes a handler for the specified Gemini.LiveAPIEvents or Gemini.Events event.
Parameters
Returns
Transmits a LiveClientContent over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendClientContent
Parameters
Returns
Starts sending media from the LiveAPI (via WebSocket) to the media unit. LiveAPI works in real time.
Parameters
Returns
Transmits a LiveClientRealtimeInput over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendRealtimeInput
Parameters
Returns
Transmits a LiveClientToolResponse over the established connection. https://pkg.go.dev/google.golang.org/genai@v1.57.0#Session.SendToolResponse
Parameters
Returns
Stops sending media from the LiveAPI (via WebSocket) to the media unit.
Parameters
Returns
Returns the LiveAPI WebSocket id.
Parameters
This method does not accept parameters.
Returns
These events describe audio received through the Gemini WebSocket media bridge.
Triggered when the audio stream sent by a third party through a Gemini WebSocket is started playing.
Event constant: Events.WebSocketMediaStarted
Payload
Triggers after the end of the audio stream sent by a third party through a Gemini WebSocket (1 second of silence).
Event constant: Events.WebSocketMediaEnded
Payload
These events mirror server messages from the Gemini Live API. The data field contains the provider event payload.
The unknown event.
Event constant: LiveAPIEvents.Unknown
Payload
Content generated by the model in response to client messages. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerContent
Event constant: LiveAPIEvents.ServerContent
Payload
Request for the client to execute the function_calls and return the responses with the matching ids. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerToolCall
Event constant: LiveAPIEvents.ToolCall
Payload
Notification for the client that a previously issued ToolCallMessage with the specified ids should have been not executed and should be cancelled. https://pkg.go.dev/google.golang.org/genai@v1.57.0#LiveServerToolCallCancellation
Event constant: LiveAPIEvents.ToolCallCancellation
Payload
Contains information about connector.
Event constant: LiveAPIEvents.ConnectorInformation
Payload