Shared SSE stream transport for LLM providers.
Wraps a Req request made with into: :self in a lazy Stream of
ExAgent.Chunk structs. Framing lives in ExAgent.SSE; this module owns the
transport, so provider services only supply a mapper turning one decoded frame
into zero or more chunks.
Nothing here raises. A non-200 response, a transport failure, or an idle
timeout all terminate the stream with a :done chunk carrying an
ExAgent.Error - whatever was already emitted stays valid.
Summary
Functions
Streams an SSE response as a lazy enumerable of ExAgent.Chunk structs.
Types
@type mapper() :: (map() -> [ExAgent.Chunk.t()])
Functions
@spec stream(Req.Request.t(), keyword(), module(), mapper()) :: Enumerable.t()
Streams an SSE response as a lazy enumerable of ExAgent.Chunk structs.
req_opts are passed to Req.post/2; into: :self is added automatically.
provider names the module in any error chunk. The stream always ends with
exactly one :done chunk.