Skip to main content

Module stream_text

Module stream_text 

Source
Expand description

Streaming text generation (stream_text).

The step loop runs in a background task and emits StreamEvents through a bounded channel; the consumer side applies the user transforms, accumulates step results and resolves the Completion.

Design: docs/01-architecture/07-generation-loop-and-streaming.md §3.

Re-exports§

pub use transforms::StreamTransform;
pub use transforms::TransformContext;
pub use transforms::smooth_stream;

Modules§

transforms
Transforms applied to the event stream before step results are accumulated.

Structs§

Completion
Drives the event pipeline and resolves with its final result.
StreamErrorInfo
Serializable projection of an Error carried in a stream.
StreamText
Builder and future of a stream_text call.
StreamTextResult
Result of a streaming call with independent event views and a final result.

Enums§

ErrorDecision
What the pipeline does after an error reported by the model stream.
StreamEvent
One event of a text stream. Serializable, so applications can forward events over SSE or WebSocket frames unchanged.

Traits§

OnErrorFn
Callback invoked for every error that occurs while streaming.

Functions§

stream_text
Starts building a streaming text generation call.

Type Aliases§

EventStream
A boxed stream of StreamEvents.