adk_live_provider behaviour (erlang_adk v0.7.0)

View Source

Provider adapter contract for bidirectional Live sessions.

Provider adapters validate an immutable setup, produce one setup frame, encode admitted client actions, and decode each provider frame into an ordered list of provider-neutral event specifications. They do not own sockets or process lifetimes.

Summary

Types

client_action/0

-type client_action() ::
          {text, binary()} |
          {audio, adk_live_media:media()} |
          {video_frame, adk_live_media:media()} |
          activity_start | activity_end | audio_stream_end |
          {tool_response, binary(), binary(), map()}.

event_spec/0

-type event_spec() :: #{kind := atom(), payload := term()}.

Callbacks

capabilities/0

-callback capabilities() -> map().

decode_server/2

-callback decode_server(binary(), map()) -> {ok, [event_spec()]} | {error, term()}.

encode_client/2

-callback encode_client(client_action(), map()) -> {ok, binary()} | {error, term()}.

resume_setup_frame/2

(optional)
-callback resume_setup_frame(map(), binary()) -> {ok, binary()} | {error, term()}.

setup_frame/1

-callback setup_frame(map()) -> {ok, binary()} | {error, term()}.

validate_config/1

-callback validate_config(map()) -> {ok, map()} | {error, term()}.