sse

package
v0.3.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sse provides a minimal Server-Sent Events reader. It handles the SSE wire format used by OpenAI, Anthropic, and most streaming LLM APIs.

This is an internal package — not part of the public API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Data []byte
}

Event represents a single Server-Sent Event.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads Server-Sent Events from an io.Reader.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader creates an SSE Reader.

func (*Reader) Next

func (r *Reader) Next() (Event, error)

Next reads the next SSE data event. Skips non-data lines (event:, id:, retry:, comments, blank lines). Returns io.EOF when the stream ends or a [DONE] marker is received.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL