Octoroom.Agent.GeminiLive.Protocol (octoroom_agents v0.1.0)

Copy Markdown View Source

Gemini Live's wire format: the frames sent to it and the events its frames decode to. Pure, so it's tested without a socket.

Copied from Subvocal, with session resumption and audioStreamEnd added.

Summary

Functions

Tells the model the audio stopped for a while, so it doesn't wait for more.

The model as the API names it, "models/...". Takes a bare name or a gemini: or google: prefix; nil is the default.

The setup frame, the first thing sent on a connection. Options: :model (needed), :voice, :response_modalities, :system_instruction, :tools (Gemini declarations), :resumption_handle (from a {:resumption, handle} event, to carry on the same session on a new connection), :context_window_compression (false to disable, or [trigger_tokens: ..., target_tokens: ...]), :input_audio_transcription (default true), and :output_audio_transcription (default true).

Functions

audio_input_frame(audio, opts \\ [])

audio_stream_end_frame()

Tells the model the audio stopped for a while, so it doesn't wait for more.

decode_frame(data)

default_voice()

model_name(model)

The model as the API names it, "models/...". Takes a bare name or a gemini: or google: prefix; nil is the default.

send_sample_rate()

setup_frame(opts)

The setup frame, the first thing sent on a connection. Options: :model (needed), :voice, :response_modalities, :system_instruction, :tools (Gemini declarations), :resumption_handle (from a {:resumption, handle} event, to carry on the same session on a new connection), :context_window_compression (false to disable, or [trigger_tokens: ..., target_tokens: ...]), :input_audio_transcription (default true), and :output_audio_transcription (default true).

text_input_frame(text)

tool_response_frame(function_responses)

video_input_frame(data, opts \\ [])