Enum LlmResponseChunk
pub enum LlmResponseChunk {
MessageStart {
id: Option<String>,
model: Option<String>,
},
TextDelta {
index: usize,
text: String,
},
ReasoningDelta {
index: usize,
text: String,
},
ReasoningDetailsDelta {
index: usize,
details: Vec<Value>,
text: String,
},
ToolCallDelta {
index: usize,
id: Option<String>,
name: Option<String>,
arguments_delta: Option<String>,
},
Usage(Usage),
MessageStop {
reason: Option<String>,
},
DecodeError {
message: String,
},
StreamError {
message: String,
},
}Expand description
One provider-neutral streaming response chunk.
Variants§
MessageStart
Starts a response message, or fills in identity first supplied by a later frame.
Fields
TextDelta
Adds text to one output index.
ReasoningDelta
Adds reasoning text to one output index.
ReasoningDetailsDelta
Adds structured reasoning details to one output index.
Fields
ToolCallDelta
Adds or updates a tool call at one index.
Fields
Usage(Usage)
Reports token usage, normally near the end of the stream.
MessageStop
Ends a response message.
DecodeError
Reports that an inbound stream event could not be decoded.
StreamError
Reports an upstream failure delivered inside an otherwise successful stream.
Trait Implementations§
§impl Clone for LlmResponseChunk
impl Clone for LlmResponseChunk
§fn clone(&self) -> LlmResponseChunk
fn clone(&self) -> LlmResponseChunk
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for LlmResponseChunk
impl Debug for LlmResponseChunk
§impl<'de> Deserialize<'de> for LlmResponseChunk
impl<'de> Deserialize<'de> for LlmResponseChunk
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LlmResponseChunk, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LlmResponseChunk, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<LlmResponseChunk> for LlmResponseStreamEvent
impl From<LlmResponseChunk> for LlmResponseStreamEvent
§fn from(chunk: LlmResponseChunk) -> LlmResponseStreamEvent
fn from(chunk: LlmResponseChunk) -> LlmResponseStreamEvent
Converts to this type from the input type.
§impl PartialEq for LlmResponseChunk
impl PartialEq for LlmResponseChunk
§impl Serialize for LlmResponseChunk
impl Serialize for LlmResponseChunk
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for LlmResponseChunk
Auto Trait Implementations§
impl Freeze for LlmResponseChunk
impl RefUnwindSafe for LlmResponseChunk
impl Send for LlmResponseChunk
impl Sync for LlmResponseChunk
impl Unpin for LlmResponseChunk
impl UnsafeUnpin for LlmResponseChunk
impl UnwindSafe for LlmResponseChunk
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