adk_model_sse_decoder (erlang_adk v0.8.0)

View Source

Bounded incremental Server-Sent Events decoder for model providers.

The decoder is deliberately transport- and provider-neutral. It accepts arbitrary TCP/HTTP chunk boundaries, supports LF and CRLF line endings, joins repeated data fields with a newline, and never creates atoms from remote field names or event types.

Summary

Types

event/0

-type event() :: #{data := binary(), event => binary(), id => binary(), retry => non_neg_integer()}.

state/0

-type state() :: map().

Functions

feed(State, Chunk)

-spec feed(state(), binary()) -> {ok, [event()], state()} | {error, term()}.

finish(State)

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

new()

-spec new() -> state().

new(Options)

-spec new(map()) -> state() | no_return().