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:
| Submodule | Role |
|---|---|
parser | Parse one data: JSON payload → typed events |
decoder | Stateful byte-stream → events (line buffering, [DONE]) |
encoder | Typed 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
LlmStreamEventvalues into OpenAI-compatible SSEchat.completion.chunkdata:frames. - parser
- Parser for OpenAI-compatible SSE
data:frames.