adk_live_media (erlang_adk v0.7.0)
View SourceStrict, provider-neutral realtime media values.
Live media deliberately does not use adk_content. PCM MIME parameters and short-lived audio/video chunks have different lifetime and pressure semantics from durable model content. Raw bytes remain Erlang binaries until a provider codec crosses its JSON boundary.
Summary
Functions
Decode a Gemini Live Blob without retaining its base64 representation.
Convert a checked media value to the Gemini Live Blob JSON shape.
Types
-type error_reason() ::
invalid_media | invalid_audio_data | invalid_sample_rate | invalid_channels |
audio_chunk_too_large | invalid_video_frame | video_frame_too_large | unsupported_media_type |
invalid_base64.
-type media() :: #{schema_version := 1, kind := audio | video, format := pcm_s16le | jpeg | png, data := binary(), sample_rate => pos_integer(), channels => pos_integer()}.
Functions
-spec audio_pcm(binary(), pos_integer(), pos_integer()) -> {ok, media()} | {error, error_reason()}.
-spec bytes(media()) -> non_neg_integer().
-spec from_gemini_blob(binary(), binary()) -> {ok, media()} | {error, error_reason()}.
Decode a Gemini Live Blob without retaining its base64 representation.
-spec to_gemini_blob(media()) -> {ok, map()} | {error, error_reason()}.
Convert a checked media value to the Gemini Live Blob JSON shape.
-spec validate(term()) -> ok | {error, error_reason()}.
-spec video_frame(jpeg | png, binary()) -> {ok, media()} | {error, error_reason()}.