GenAI.StreamHandler.SSE
(GenAI Core v0.3.3)
Copy Markdown
Server-Sent Events (SSE) parser for streaming inference responses.
Pure and incremental: feed it raw chunk data as it arrives off the wire and
it returns parsed events plus any trailing partial frame to carry forward
into the next feed/2 call.
Events:
{:data, payload}— a completeddata:frame (payload verbatim,\njoined when a frame carries multipledata:lines):done— the[DONE]sentinel used by OpenAI compatible providers
Comment lines (: prefixed) and non-data fields are ignored per the SSE
spec. Handles \n\n and \r\n\r\n frame separators, including
separators split across chunk boundaries.