LlmCall.StreamState (llm_call v0.1.0)

Copy Markdown View Source

Opaque per-codec streaming state.

The public API checks codec/1 before delegating, so a state produced by one codec cannot be fed to another. Codecs read their private data with data/1 and build a new state with new/2.

Summary

Types

t()

A codec's stream state, tagged with the codec that owns it.

Types

t()

@type t() :: %LlmCall.StreamState{codec: module(), data: term()}

A codec's stream state, tagged with the codec that owns it.

This is a public struct type rather than @opaque: the behaviour hands the struct to a codec in another module, and an opaque type cannot be destructured across that boundary (Dialyzer rejects it). It is still a typed struct, never a bare term(); data remains deliberately untyped.

Functions

codec(stream_state)

@spec codec(t()) :: module()

data(stream_state)

@spec data(t()) :: term()

new(codec, data)

@spec new(module(), term()) :: t()