pub trait Decoder<'id, Op, Frame = WireFrame>where
Op: Operation,{
type Event;
// Required methods
fn classify(&self, frame: Frame) -> WireEvent<Self::Event>;
fn decode(
&mut self,
event: Self::Event,
out: Out<'id, Op>,
) -> Result<Flow, ProviderError>;
// Provided method
fn eof(&mut self, out: Out<'id, Op>) -> Result<Flow, ProviderError> { ... }
}Expand description
Synchronous state machine for one reply. It classifies frames and
decodes known events into the reply’s writer, without transport access
and without being told how the reply arrives. HTTP wires read
WireFrames; other transports name their own frame type.
Required Associated Types§
Required Methods§
Sourcefn classify(&self, frame: Frame) -> WireEvent<Self::Event>
fn classify(&self, frame: Frame) -> WireEvent<Self::Event>
Decode and classify one frame. A JSON wire MUST delegate to a
classifier in crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<'id> Decoder<'id, AudioGeneration> for SpeechDecoder
Available on crate feature audio only.
impl<'id> Decoder<'id, AudioGeneration> for SpeechDecoder
Available on crate feature
audio only.Source§impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
Source§impl<'id> Decoder<'id, Completion> for rig_agent::core::providers::cohere::streaming::ChatDecoder<'id>
impl<'id> Decoder<'id, Completion> for rig_agent::core::providers::cohere::streaming::ChatDecoder<'id>
Source§impl<'id> Decoder<'id, Completion> for rig_agent::core::providers::openai::wire::ChatDecoder<'id>
impl<'id> Decoder<'id, Completion> for rig_agent::core::providers::openai::wire::ChatDecoder<'id>
Source§impl<'id> Decoder<'id, Completion> for GenerateContentDecoder<'id>
impl<'id> Decoder<'id, Completion> for GenerateContentDecoder<'id>
Source§impl<'id> Decoder<'id, Completion> for InteractionsDecoder<'id>
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
impl<'id> Decoder<'id, Completion> for InteractionsDecoder<'id>
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
type Event = InteractionsEvent
Source§impl<'id> Decoder<'id, Completion> for MessagesDecoder<'id>
impl<'id> Decoder<'id, Completion> for MessagesDecoder<'id>
type Event = StreamingEvent
Source§impl<'id> Decoder<'id, Completion> for OllamaDecoder<'id>
EOF without a done: true record is truncation.
impl<'id> Decoder<'id, Completion> for OllamaDecoder<'id>
EOF without a done: true record is truncation.
type Event = CompletionResponse
Source§impl<'id> Decoder<'id, Completion> for OpenAiDecoder<'id>
impl<'id> Decoder<'id, Completion> for OpenAiDecoder<'id>
type Event = OpenAiEvent
Source§impl<'id> Decoder<'id, Completion> for ResponsesDecoder<'id>
impl<'id> Decoder<'id, Completion> for ResponsesDecoder<'id>
type Event = ResponsesEvent
Source§impl<'id> Decoder<'id, ContextCache> for CachedContentsDecoder
impl<'id> Decoder<'id, ContextCache> for CachedContentsDecoder
type Event = CachedContentReply
Source§impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::cohere::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::cohere::wire::EmbeddingsDecoder
type Event = EmbedReply<EmbeddingResponse>
Source§impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::gemini::embedding::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::gemini::embedding::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::ollama::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::ollama::wire::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::openai::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::openai::wire::EmbeddingsDecoder
Source§impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::voyageai::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_agent::core::providers::voyageai::wire::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, ImageEmbedding> for ImageEmbeddingsDecoder
impl<'id> Decoder<'id, ImageEmbedding> for ImageEmbeddingsDecoder
Source§impl<'id> Decoder<'id, ImageGeneration> for rig_agent::core::providers::gemini::image_generation::ImagesDecoder
impl<'id> Decoder<'id, ImageGeneration> for rig_agent::core::providers::gemini::image_generation::ImagesDecoder
Source§impl<'id> Decoder<'id, ImageGeneration> for rig_agent::core::providers::openai::wire::ImagesDecoder
Available on crate feature image only.
impl<'id> Decoder<'id, ImageGeneration> for rig_agent::core::providers::openai::wire::ImagesDecoder
Available on crate feature
image only.