pub struct AgentEvent {
pub event_type: EventType,
pub timestamp: u64,
pub data: Option<EventData>,
}Expand description
Agent event
Fields§
§event_type: EventType§timestamp: u64§data: Option<EventData>Implementations§
Source§impl AgentEvent
impl AgentEvent
pub fn new(event_type: EventType) -> AgentEvent
pub fn with_data(event_type: EventType, data: EventData) -> AgentEvent
pub fn text_delta(delta: impl Into<String>) -> AgentEvent
pub fn text_start() -> AgentEvent
pub fn text_end() -> AgentEvent
pub fn thinking_start() -> AgentEvent
pub fn thinking_end() -> AgentEvent
pub fn session_started() -> AgentEvent
pub fn session_ended() -> AgentEvent
pub fn thinking_delta( delta: impl Into<String>, signature: Option<String>, ) -> AgentEvent
pub fn tool_use_start( id: impl Into<String>, name: impl Into<String>, input: Option<Value>, ) -> AgentEvent
pub fn tool_result( tool_use_id: impl Into<String>, name: impl Into<String>, content: impl Into<String>, is_error: bool, ) -> AgentEvent
pub fn error( message: impl Into<String>, code: Option<String>, source: Option<String>, ) -> AgentEvent
pub fn progress( message: impl Into<String>, percentage: Option<u8>, ) -> AgentEvent
pub fn usage(input_tokens: u64, output_tokens: u64) -> AgentEvent
pub fn usage_with_cache( input_tokens: u64, output_tokens: u64, cache_read: u64, cache_created: u64, ) -> AgentEvent
pub fn to_json(&self) -> Result<String, Error>
pub fn from_json(json: &str) -> Result<AgentEvent, Error>
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
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 AgentEvent
impl Debug for AgentEvent
Source§impl<'de> Deserialize<'de> for AgentEvent
impl<'de> Deserialize<'de> for AgentEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AgentEvent
impl PartialEq for AgentEvent
Source§fn eq(&self, other: &AgentEvent) -> bool
fn eq(&self, other: &AgentEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for AgentEvent
impl Serialize for AgentEvent
Source§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 AgentEvent
Auto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnsafeUnpin for AgentEvent
impl UnwindSafe for AgentEvent
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,
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