Skip to main content

Module stream

Module stream 

Source
Expand description

LLM token streaming.

Providers that support real streaming override CloudAiProvider::invoke_stream to push deltas through a LlmStreamSink as they arrive; providers without streaming support inherit the default impl, which calls invoke and emits a single final delta + done = true. That keeps the call signature uniform so the executor + agentic path can opt into streaming without per-provider branching, and the frontend chip ticks something useful in both cases.

Structs§

CapturingStreamSink
Buffering sink used by tests. Captures every event so assertions can inspect deltas, done-flags, and errors after the fact.
LlmStreamEvent
A single chunk of generated text emitted as the model produces tokens.
NullStreamSink
No-op sink. Useful in headless tests + as the default Executor field value so Executor::run doesn’t require a real sink when nobody cares about streaming.

Traits§

LlmStreamSink
Async fan-out target for LlmStreamEvents. Providers receive a &dyn LlmStreamSink, call emit once per chunk, and the caller decides what happens with the events (Tauri broadcasts to the frontend; tests collect into a Vec).