Trait Streaming Codec
Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Referenced types: Send, Sync, Box, FnMut, Value, Result, (), FlowError, FnOnce, LlmJsonStream, Option
Per-provider streaming codec used with the runtime streaming execution API.
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
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
Returns a closure that consumes one decoded provider event per call.
finalizer
Referenced types: Box, FnOnce, Value, Send
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.
Provided Methods
validate_stream
Referenced types: LlmJsonStream
Wraps the source stream to check provider completion rules.
Feed the returned stream to this instance’s collector and finalizer. The default leaves the stream unchanged. An override must forward close and cleanup operations.
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send
Returns an optional collector that reads decoded events by reference.
Pass this to LlmStreamCallExecuteParams::borrowed_collector to avoid copying each whole JSON chunk. The default keeps the owned callback for custom codecs.
Implementations on Foreign Types
impl StreamingCodec for AnthropicMessagesStreamingCodec
Referenced types: StreamingCodec
validate_stream
Referenced types: LlmJsonStream
Reports provider errors and rejects EOF before Anthropic’s final message_stop event.
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send
finalizer
Referenced types: Box, FnOnce, Value, Send
impl StreamingCodec for GeminiGenerateContentStreamingCodec
Referenced types: StreamingCodec
validate_stream
Referenced types: LlmJsonStream
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send
finalizer
Referenced types: Box, FnOnce, Value, Send
impl StreamingCodec for OCIGenAIStreamingCodec
Referenced types: StreamingCodec
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send
finalizer
Referenced types: Box, FnOnce, Value, Send
impl StreamingCodec for OpenAIChatStreamingCodec
Referenced types: StreamingCodec
validate_stream
Referenced types: LlmJsonStream
Reports provider errors and rejects EOF before every observed choice has finished.
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send
finalizer
Referenced types: Box, FnOnce, Value, Send
impl StreamingCodec for OpenAIResponsesStreamingCodec
Referenced types: StreamingCodec
validate_stream
Referenced types: LlmJsonStream
Forwards a failed response or error event before reporting its error on the next poll. Reports an error at EOF unless a final response event was seen.
The check passes when this stream forwarded a final response event or when this codec’s collector recorded one. Middleware between this stream and the collector can drain the source first, so a clean EOF does not mean the collector has finished: the finalizer reflects only the events that reached the collector.
collector
Referenced types: Box, FnMut, Value, Result, (), FlowError, Send
Collects response snapshots and output items into this codec’s shared state.
finalizer
Referenced types: Box, FnOnce, Value, Send
Takes the collected state and returns the final provider response.
borrowed_collector
Referenced types: Option, Box, FnMut, Value, Result, (), FlowError, Send