#[non_exhaustive]pub enum AgentStreamEvent {
Text(String),
ToolStart {
tool: String,
input: String,
},
ToolEnd {
tool: String,
output: String,
},
Usage(TokenUsage),
Finish {
output: String,
},
}Expand description
What an agent run is doing, streamed by AgentExecutor::stream_events.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
A chunk of text from the model, as it is generated. With tool-calling agents this is the answer itself (or a short preamble before tool calls).
ToolStart
The agent is about to run a tool.
ToolEnd
A tool finished. output is what the agent sees; a failed tool shows up here as
its error message unless the executor uses with_break_if_error(true).
Usage(TokenUsage)
Tokens used by one model call of the run, when the LLM reports them. The run’s
total is in Chain::call’s GenerateResult::tokens.
Finish
The run is over. Always the last event of a successful run.
Trait Implementations§
Source§impl Clone for AgentStreamEvent
impl Clone for AgentStreamEvent
Source§impl Debug for AgentStreamEvent
impl Debug for AgentStreamEvent
Source§impl PartialEq for AgentStreamEvent
impl PartialEq for AgentStreamEvent
impl StructuralPartialEq for AgentStreamEvent
Auto Trait Implementations§
impl Freeze for AgentStreamEvent
impl RefUnwindSafe for AgentStreamEvent
impl Send for AgentStreamEvent
impl Sync for AgentStreamEvent
impl Unpin for AgentStreamEvent
impl UnsafeUnpin for AgentStreamEvent
impl UnwindSafe for AgentStreamEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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