parse_sse_frame

Function parse_sse_frame 

Source
pub fn parse_sse_frame(data: &str) -> Result<SseParseResult>
Expand description

Parse a single SSE data: payload into zero or more LlmStreamEvents.

Returns:

  • Ok(SseParseResult::Done) when data == "[DONE]"
  • Ok(SseParseResult::Events(…)) for a valid JSON frame (may be empty when the frame carries no content or tool-call deltas)
  • Err(…) when the frame is not valid JSON

§Errors

Returns an error if the data payload is not valid JSON.