Expand description
Streaming response codecs for the managed LLM execution pipeline.
crate::codec::traits::LlmResponseCodec decodes a complete provider response into a
normalized AnnotatedLlmResponse. For streaming providers, the analogous job is to:
- consume per-chunk events as they arrive on a streaming HTTP response, and
- assemble a single non-streaming-shape JSON payload at end of stream.
Once assembled, the payload can be fed back through the matching
crate::codec::traits::LlmResponseCodec to produce an AnnotatedLlmResponse — meaning
streaming and non-streaming requests converge on the same observability output without
per-route shape duplication.
StreamingCodec is the trait that bundles the two functions
(LlmCollectorFn,
LlmFinalizerFn) used by
crate::api::llm::llm_stream_call_execute. Each provider supplies one impl whose internal
state holds whatever incremental information is needed to materialize the final payload.
Structs§
- SseEvent
- One decoded SSE frame, paired with the parsed
data:payload. - SseEvent
Decoder - Incremental decoder for
text/event-streambyte streams that yields one JSON object per completedata:payload.
Enums§
- Normalized
Stream Event - Provider-neutral incremental stream item used by cross-protocol transcoders.
Traits§
- Streaming
Codec - Per-provider streaming codec used with
crate::api::llm::llm_stream_call_execute.