adk_llm_anthropic_stream (erlang_adk v0.8.0)

View Source

Logical Anthropic Messages SSE decoder and bounded stream assembler.

adk_model_sse_decoder owns byte framing. This module validates the named event/data agreement required by Anthropic, assembles text and tool inputs, and deliberately keeps unknown future event types as binaries.

Summary

Functions

Decode an event emitted by adk_model_sse_decoder. SSE id/retry fields are intentionally ignored at this provider layer.

Decode and apply one provider-neutral SSE envelope.

Types

emission/0

-type emission() :: {text, binary()}.

state/0

-type state() :: map().

Functions

content(State)

-spec content(state()) -> {ok, adk_content:content()} | {error, term()}.

decode_event(_)

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

Decode an event emitted by adk_model_sse_decoder. SSE id/retry fields are intentionally ignored at this provider layer.

decode_event(Name, Data)

-spec decode_event(binary(), binary() | map()) -> {ok, term()} | {error, term()}.

feed(State, WireEvent)

-spec feed(state(), map()) -> {ok, state(), [emission()]} | {done, term(), state()} | {error, term()}.

Decode and apply one provider-neutral SSE envelope.

new()

-spec new() -> state().

new(LimitOverrides)

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

push(Event, State)

-spec push(term(), state()) -> {ok, state(), [emission()]} | {done, term(), state()} | {error, term()}.

result(State)

-spec result(state()) -> term().