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

Copy Markdown View Source

Realtime input for Live API sessions.

User input that is sent in real time. Different from ClientContent in that:

  • Can be sent continuously without interrupting model generation
  • End of turn is derived from user activity (e.g., end of speech)
  • Data is processed incrementally for fast response start
  • Always assumed to be user's input (cannot populate conversation history)

Fields

  • media_chunks - Deprecated: Use audio, video, or text instead
  • audio - Realtime audio input stream
  • video - Realtime video input stream
  • text - Realtime text input stream
  • activity_start - Marks start of user activity (only with manual detection)
  • activity_end - Marks end of user activity (only with manual detection)
  • audio_stream_end - Indicates audio stream has ended (e.g., mic off)

Example

# Audio input
%RealtimeInput{
  audio: %{mime_type: "audio/pcm", data: base64_audio_data}
}

# Text input
%RealtimeInput{text: "Hello, how are you?"}

Summary

Functions

Parses from API response.

Creates a new RealtimeInput.

Converts to API format (camelCase).

Types

t()

@type t() :: %Gemini.Types.Live.RealtimeInput{
  activity_end: boolean() | nil,
  activity_start: boolean() | nil,
  audio: Gemini.Types.Blob.t() | map() | nil,
  audio_stream_end: boolean() | nil,
  media_chunks: [Gemini.Types.Blob.t() | map()] | nil,
  text: String.t() | nil,
  video: Gemini.Types.Blob.t() | map() | nil
}

Functions

from_api(data)

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

Parses from API response.

new(opts \\ [])

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

Creates a new RealtimeInput.

to_api(value)

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

Converts to API format (camelCase).