pub trait StreamingCodec: Send + Sync {
// Required methods
fn collector(&self) -> LlmCollectorFn;
fn finalizer(&self) -> LlmFinalizerFn;
}Expand description
Per-provider streaming codec used with crate::api::llm::llm_stream_call_execute.
collector() and finalizer() produce owned closures that share the codec’s internal
accumulation state. Implementations typically wrap that state in Arc<Mutex<...>> so each
&self-produced closure captures a clone of the handle.
LlmFinalizerFn is FnOnce, so a StreamingCodec instance is single-use: callers
construct a fresh instance per managed-lifecycle call and discard it after the stream
completes.
Required Methods§
Sourcefn collector(&self) -> LlmCollectorFn
fn collector(&self) -> LlmCollectorFn
Returns a closure that consumes one decoded provider event per call.
Sourcefn finalizer(&self) -> LlmFinalizerFn
fn finalizer(&self) -> LlmFinalizerFn
Returns a closure that, when called once at end of stream, produces the assembled response
payload in the shape the matching crate::codec::traits::LlmResponseCodec can decode.