pub struct ResponsesDecoder { /* private fields */ }Expand description
The OpenAI Responses wire’s decoder: one state machine for the SSE stream, the unary body and the websocket session.
Each output item becomes one block. It opens when it is announced, or at its first delta, with no provider item, and its done item closes it, becoming the block’s native: an item the provider never stated complete replays from its canonical fields. A done item merges into what streamed: a call keeps the id and name it was announced with and the arguments it streamed when its done item leaves them out, and text the done item leaves out stays, written into the item. The terminal response is the whole output: it finishes the items no done event carried, writes the ones the stream never stated, which is how a unary body decodes, and backfills the ciphertext of reasoning done without it.
Implementations§
Trait Implementations§
Source§impl<'id> Decoder<'id, Completion> for ResponsesDecoder
impl<'id> Decoder<'id, Completion> for ResponsesDecoder
Source§type Event = ResponsesEvent
type Event = ResponsesEvent
Source§fn classify(&self, frame: WireFrame) -> WireEvent<ResponsesEvent>
fn classify(&self, frame: WireFrame) -> WireEvent<ResponsesEvent>
crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.Source§fn decode(
&mut self,
event: ResponsesEvent,
out: Out<'id, Completion>,
) -> Result<Flow, ProviderError>
fn decode( &mut self, event: ResponsesEvent, out: Out<'id, Completion>, ) -> Result<Flow, ProviderError>
Known event into the reply. An error ends the reply with
it.Auto Trait Implementations§
impl Freeze for ResponsesDecoder
impl RefUnwindSafe for ResponsesDecoder
impl Send for ResponsesDecoder
impl Sync for ResponsesDecoder
impl Unpin for ResponsesDecoder
impl UnsafeUnpin for ResponsesDecoder
impl UnwindSafe for ResponsesDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more