Server message wrapper for Live API responses.
Response message for the BidiGenerateContent call. Contains exactly one message type field plus optional usage metadata.
Message Types
setup_complete- Session setup confirmationserver_content- Content generated by the modeltool_call- Request to execute function callstool_call_cancellation- Notification to cancel tool callsgo_away- Notice that server will disconnect soonsession_resumption_update- Session resumption state updatevoice_activity- Voice activity detection signal
Example
# Server content message
%ServerMessage{
server_content: %ServerContent{
model_turn: %{role: "model", parts: [%{text: "Hello!"}]},
turn_complete: true
},
usage_metadata: %UsageMetadata{total_token_count: 100}
}
Summary
Functions
Extracts text from server content if present.
Parses from API response.
Checks if this is an interrupted message.
Returns the message type as an atom.
Creates a new ServerMessage.
Checks if this is a setup complete message.
Converts to API format (camelCase).
Checks if this is a turn complete message.
Types
@type t() :: %Gemini.Types.Live.ServerMessage{ go_away: Gemini.Types.Live.GoAway.t() | nil, server_content: Gemini.Types.Live.ServerContent.t() | nil, session_resumption_update: Gemini.Types.Live.SessionResumptionUpdate.t() | nil, setup_complete: Gemini.Types.Live.SetupComplete.t() | nil, tool_call: Gemini.Types.Live.ToolCall.t() | nil, tool_call_cancellation: Gemini.Types.Live.ToolCallCancellation.t() | nil, usage_metadata: Gemini.Types.Live.UsageMetadata.t() | nil, voice_activity: Gemini.Types.Live.VoiceActivity.t() | nil }
Functions
Extracts text from server content if present.
Parses from API response.
Checks if this is an interrupted message.
Returns the message type as an atom.
Creates a new ServerMessage.
Checks if this is a setup complete message.
Converts to API format (camelCase).
Checks if this is a turn complete message.