Expand description
Parser for OpenAI-compatible SSE data: frames.
Isolated so the frame-parsing logic and its tests are self-contained and do not require an HTTP client or async runtime.
ยงFrame ordering for reasoning models
When a single SSE frame carries both reasoning_content (chain-of-thought)
and content (answer text), the ReasoningDelta event is emitted
first. This matches the temporal semantics of reasoning models such as
DeepSeek R1 and QwQ, where the chain-of-thought is always produced before
the answer โ even if llama-server coalesces both into the same frame.
Enumsยง
- SseParse
Result - Result of parsing a single SSE
data:payload.
Functionsยง
- parse_
inline_ ๐error_ frame - Parse a bare top-level
errorobject (with nochoiceskey) into anLlmStreamEvent::UpstreamErrorevent. - parse_
sse_ frame - Parse a single SSE
data:payload into zero or moreLlmStreamEvents. - parse_
usage_ ๐event - Parse a top-level
usageobject into aLlmStreamEvent::Usageevent.