SSEParser
Server-Sent Events (SSE) parser for streaming LLM responses.
Handles the SSE format used by both OpenAI and Anthropic streaming endpoints. SSE format consists of fields like:
- data:
- event:
- id:
- retry:
- :
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SSEParser.type
Members list
Type members
Classlikes
Represents a parsed SSE event
Represents a parsed SSE event
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Parse streaming data with a buffer for incomplete events. This is useful for parsing data as it arrives from a network stream.
Parse streaming data with a buffer for incomplete events. This is useful for parsing data as it arrives from a network stream.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Create a new streaming parser instance
Create a new streaming parser instance
Attributes
Parse a single SSE event from a string. An event is terminated by a double newline.
Parse a single SSE event from a string. An event is terminated by a double newline.
Attributes
Parse a stream of SSE data into individual events. Returns an iterator of SSEEvents.
Parse a stream of SSE data into individual events. Returns an iterator of SSEEvents.