Documentation
¶
Overview ¶
Package ndjson frames a newline-delimited JSON body into one raw stream frame per line: StreamFrame.Data is the line's bytes and Name is empty. Blank lines are skipped. It is byte-level wire framing only — it does not parse the JSON or know any LLM semantics; a semantic StreamDecoder interprets each line's Data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeStreamFrames ¶
func DecodeStreamFrames(body io.ReadCloser) (*stream.StreamReader[stream.StreamFrame], error)
DecodeStreamFrames frames an NDJSON body into one StreamFrame per non-empty line. It owns body: the returned reader's Close closes body; on an early error (nil body) there is no body to close.
func Framer ¶
func Framer() codec.StreamFramer
Framer returns the package's StreamFramer as an interface value, for callers that inject an codec.StreamFramer.
Types ¶
type FramerError ¶
FramerError wraps a stream read failure surfaced while framing. Typed per the repo rule so callers can errors.As it and Unwrap the underlying I/O cause.
func (*FramerError) Error ¶
func (e *FramerError) Error() string
func (*FramerError) Unwrap ¶
func (e *FramerError) Unwrap() error