pub type RawStreamingResult<R> = Pin<Box<dyn Stream<Item = Result<RawStreamingChoice<R>, CompletionError>> + Send>>;target_os=unknown and WebAssembly).Expand description
Provider stream whose terminal record is the provider-native R, on native
targets.
This is the raw channel of rig’s two-channel contract: every provider’s
inherent raw_stream/raw_completion returns provider-native types
directly from the wire decode, never routed through the normalized
accumulation (normalize_stream / the parts accumulator) — the
semantic channel maps this stream’s terminal record exactly once. There
is deliberately no provider-typed payload on the normalized types; the
typed channels are the contract. What the normalized types also carry is
that same terminal record serialized (StreamFinal::raw) — for
callers who no longer hold the concrete model, an agent having erased it,
and so cannot reach the typed channel at all. The frames of the stream are
a different axis: they were never exposed on any rig surface, and exposing
them is a per-frame mechanism (a raw stream part), not a field on the
terminal record — so StreamFinal::raw captures the terminal only.
Precedent, read carefully: openai-agents also splits raw from semantic,
but the load-bearing part of its design is elsewhere — its semantic
layer never reads a delta at all (it acts only on whole done items and
the completed response), and delta aggregation is confined to the
per-provider adapter, which synthesizes a canonical terminal event so
the shared layer sees one grammar. rig cannot fully adopt that shape
(openai-agents’ canonical grammar is one vendor’s schema; rig normalizes
14 wire families through one accumulator), and centralizing the
accumulator is what forces cross-provider identity — hence the
provenance-typed StreamPartId. What rig does copy from that precedent is
the raw channel itself and provenance-as-data rather than naming
convention.
Aliased Type§
pub struct RawStreamingResult<R> { /* private fields */ }