Module sse

Module sse 

Source
Expand description

Server-Sent Events (SSE) codec for OpenAI-compatible chat completion streams.

This module is the single source of truth for translating between the OpenAI chat.completion.chunk SSE wire format and the typed crate::LlmStreamEvent domain values. It contains three pieces:

SubmoduleRole
parserParse one data: JSON payload → typed events
decoderStateful byte-stream → events (line buffering, [DONE])
encoderTyped event → data: JSON payload (for re-emission)

Promoting the codec to gglib-core lets every adapter (runtime, proxy, future GUIs) share a single, well-tested implementation rather than re-rolling SSE parsing per surface.

Re-exports§

pub use decoder::SseStreamDecoder;
pub use encoder::SseEncoder;
pub use parser::SseParseResult;
pub use parser::parse_sse_frame;

Modules§

decoder
Stateful SSE byte-stream decoder.
encoder
Encode typed LlmStreamEvent values into OpenAI-compatible SSE chat.completion.chunk data: frames.
parser
Parser for OpenAI-compatible SSE data: frames.