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
Resolves with the final result once the event stream has been drained.
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: one event stream plus a completion handle.

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.