adk_llm_compatible_stream (erlang_adk v0.8.0)
View SourceBounded raw-SSE assembler for compatible Chat Completions streams.
feed/2 accepts arbitrary HTTP/TCP byte chunks and delegates SSE framing to adk_model_sse_decoder. This module then validates Chat Completions deltas, assembles interleaved parallel tool calls by numeric index, and creates one checked provider result when [DONE] is received.
Summary
Functions
Feed raw SSE bytes. The terminal form retains emissions produced by earlier events in the same byte chunk, so a coalesced delta plus [DONE] can never lose text delivered to the caller.
Types
Functions
-spec content(state()) -> {ok, adk_content:content()} | {error, term()}.
-spec feed(state(), binary()) -> {ok, state(), [emission()]} | {done, adk_provider_result:result(), state(), [emission()]} | {error, term()}.
Feed raw SSE bytes. The terminal form retains emissions produced by earlier events in the same byte chunk, so a coalesced delta plus [DONE] can never lose text delivered to the caller.
-spec finish(state()) -> {ok, adk_provider_result:result()} | {error, term()}.
-spec result(state()) -> {ok, adk_provider_result:result()} | {error, term()}.