pub struct LlmResponseStreamEvent { /* private fields */ }Expand description
One streaming item crossing the host/algorithm boundary.
normalized contains only provider-neutral chunks. preservation is opaque to
algorithms and is interpreted by switchyard-translation for same-format replay.
Implementations§
Source§impl LlmResponseStreamEvent
impl LlmResponseStreamEvent
Sourcepub fn new(normalized: Vec<LlmResponseChunk>) -> Self
pub fn new(normalized: Vec<LlmResponseChunk>) -> Self
Creates an event containing only normalized chunks.
Sourcepub fn preserved(
source: impl Into<FormatId>,
raw: Value,
normalized: Vec<LlmResponseChunk>,
) -> Self
pub fn preserved( source: impl Into<FormatId>, raw: Value, normalized: Vec<LlmResponseChunk>, ) -> Self
Creates an event with parsed provider JSON retained for replay.
Sourcepub fn preservation(&self) -> Option<&ProviderStreamEvent>
pub fn preservation(&self) -> Option<&ProviderStreamEvent>
Retained provider event, when this event came directly from a provider.
Sourcepub fn normalized(&self) -> &[LlmResponseChunk]
pub fn normalized(&self) -> &[LlmResponseChunk]
Provider-neutral chunks carried by this event.
Sourcepub fn into_parts(self) -> (Option<ProviderStreamEvent>, Vec<LlmResponseChunk>)
pub fn into_parts(self) -> (Option<ProviderStreamEvent>, Vec<LlmResponseChunk>)
Consumes the event into its preservation and normalized content.
Sourcepub fn replace_normalized(self, normalized: Vec<LlmResponseChunk>) -> Self
pub fn replace_normalized(self, normalized: Vec<LlmResponseChunk>) -> Self
Replaces semantic content and drops raw replay data that no longer describes it.
Trait Implementations§
Source§impl Clone for LlmResponseStreamEvent
impl Clone for LlmResponseStreamEvent
Source§fn clone(&self) -> LlmResponseStreamEvent
fn clone(&self) -> LlmResponseStreamEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LlmResponseStreamEvent
impl Debug for LlmResponseStreamEvent
Source§impl<'de> Deserialize<'de> for LlmResponseStreamEvent
impl<'de> Deserialize<'de> for LlmResponseStreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<LlmResponseChunk> for LlmResponseStreamEvent
impl From<LlmResponseChunk> for LlmResponseStreamEvent
Source§fn from(chunk: LlmResponseChunk) -> Self
fn from(chunk: LlmResponseChunk) -> Self
Converts to this type from the input type.
Source§impl PartialEq for LlmResponseStreamEvent
impl PartialEq for LlmResponseStreamEvent
Source§impl Serialize for LlmResponseStreamEvent
impl Serialize for LlmResponseStreamEvent
impl StructuralPartialEq for LlmResponseStreamEvent
Auto Trait Implementations§
impl Freeze for LlmResponseStreamEvent
impl RefUnwindSafe for LlmResponseStreamEvent
impl Send for LlmResponseStreamEvent
impl Sync for LlmResponseStreamEvent
impl Unpin for LlmResponseStreamEvent
impl UnsafeUnpin for LlmResponseStreamEvent
impl UnwindSafe for LlmResponseStreamEvent
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
Mutably borrows from an owned value. Read more