Gemini.Types.Live.ServerContent (GeminiEx v0.11.0)

Copy Markdown View Source

Server content message for Live API sessions.

Incremental server update generated by the model in response to client messages. Content is generated as quickly as possible, not in real time. Clients may choose to buffer and play it out in real time.

Fields

  • model_turn - Content generated by the model as part of the conversation
  • generation_complete - True if the model is done generating
  • turn_complete - True if the model has completed its turn
  • interrupted - True if a client message interrupted model generation
  • grounding_metadata - Grounding metadata for the generated content
  • input_transcription - Transcription of input audio
  • output_transcription - Transcription of model's audio output
  • url_context_metadata - Metadata from URL context retrieval

Example

%ServerContent{
  model_turn: %{role: "model", parts: [%{text: "Hello!"}]},
  turn_complete: true
}

Summary

Functions

Extracts text from the model turn.

Parses from API response.

Creates a new ServerContent.

Converts to API format (camelCase).

Types

content()

@type content() :: %{optional(:role) => String.t(), optional(:parts) => [map()]}

t()

@type t() :: %Gemini.Types.Live.ServerContent{
  generation_complete: boolean() | nil,
  grounding_metadata: Gemini.Types.Live.GroundingMetadata.t() | nil,
  input_transcription: Gemini.Types.Live.Transcription.t() | nil,
  interrupted: boolean() | nil,
  model_turn: content() | nil,
  output_transcription: Gemini.Types.Live.Transcription.t() | nil,
  turn_complete: boolean() | nil,
  url_context_metadata: url_context_metadata() | nil
}

url_context_metadata()

@type url_context_metadata() :: %{optional(:url_metadata) => [map()]}

Functions

extract_text(arg1)

@spec extract_text(t()) :: String.t() | nil

Extracts text from the model turn.

from_api(data)

@spec from_api(map() | nil) :: t() | nil

Parses from API response.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new ServerContent.

to_api(value)

@spec to_api(t() | nil) :: map() | nil

Converts to API format (camelCase).