adk_openai_responses_stream (erlang_adk v0.8.0)

View Source

Logical, bounded assembler for OpenAI Responses streaming events.

The transport decodes each SSE data JSON object and passes the resulting binary-keyed map to decode_event/2. Text and function arguments are accumulated as reverse iolists, bounded before concatenation, and verified against their corresponding done and response.completed values.

Summary

Types

logical_event/0

-type logical_event() ::
          {text_delta, binary()} |
          {tool_call_started, non_neg_integer(), binary(), binary()} |
          {tool_call_arguments_delta, non_neg_integer(), binary()} |
          {tool_call_completed, non_neg_integer(), tuple()} |
          {completed, adk_provider_result:result()}.

state/0

-type state() :: map().

Functions

decode_event(Event, State0)

-spec decode_event(term(), state()) -> {ok, [logical_event()], state()} | {error, term(), state()}.

finish(_)

-spec finish(state()) -> {ok, adk_provider_result:result()} | {error, term()}.

new(Options)

-spec new(map()) -> {ok, state()} | {error, term()}.