pub enum StreamChunk {
Content {
text: String,
},
ToolCallStart {
id: String,
name: String,
},
ToolCallDelta {
id: String,
arguments: String,
},
ToolCallEnd {
id: String,
},
ToolResult {
id: String,
name: String,
output: String,
success: bool,
},
StateTransition {
from: Option<String>,
to: String,
},
Done {},
Error {
message: String,
},
}Expand description
Represents a chunk of streamed response from the agent
Variants§
Content
Text content from the LLM
ToolCallStart
A tool call is starting
ToolCallDelta
Incremental arguments for a tool call
ToolCallEnd
A tool call has completed
ToolResult
Tool execution result
StateTransition
State transition occurred
Done
Stream has completed
Error
An error occurred
Implementations§
Source§impl StreamChunk
impl StreamChunk
pub fn content(text: impl Into<String>) -> Self
pub fn tool_start(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn tool_delta(id: impl Into<String>, arguments: impl Into<String>) -> Self
pub fn tool_end(id: impl Into<String>) -> Self
pub fn tool_result( id: impl Into<String>, name: impl Into<String>, output: impl Into<String>, success: bool, ) -> Self
pub fn state_transition(from: Option<String>, to: impl Into<String>) -> Self
pub fn error(message: impl Into<String>) -> Self
pub fn is_done(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_content(&self) -> bool
Trait Implementations§
Source§impl Clone for StreamChunk
impl Clone for StreamChunk
Source§fn clone(&self) -> StreamChunk
fn clone(&self) -> StreamChunk
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 moreSource§impl Debug for StreamChunk
impl Debug for StreamChunk
Source§impl<'de> Deserialize<'de> for StreamChunk
impl<'de> Deserialize<'de> for StreamChunk
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
Auto Trait Implementations§
impl Freeze for StreamChunk
impl RefUnwindSafe for StreamChunk
impl Send for StreamChunk
impl Sync for StreamChunk
impl Unpin for StreamChunk
impl UnsafeUnpin for StreamChunk
impl UnwindSafe for StreamChunk
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Converts
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>
Converts
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