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) -> Self
pub fn with_data(event_type: EventType, data: EventData) -> Self
pub fn text_delta(delta: impl Into<String>) -> Self
pub fn text_start() -> Self
pub fn text_end() -> Self
pub fn thinking_start() -> Self
pub fn thinking_end() -> Self
pub fn session_started() -> Self
pub fn session_ended() -> Self
pub fn thinking_delta( delta: impl Into<String>, signature: Option<String>, ) -> Self
pub fn tool_use_start( id: impl Into<String>, name: impl Into<String>, input: Option<Value>, ) -> Self
pub fn tool_result( tool_use_id: impl Into<String>, content: impl Into<String>, is_error: bool, ) -> Self
pub fn error( message: impl Into<String>, code: Option<String>, source: Option<String>, ) -> Self
pub fn progress(message: impl Into<String>, percentage: Option<u8>) -> Self
pub fn usage(input_tokens: u64, output_tokens: u64) -> Self
pub fn usage_with_cache( input_tokens: u64, output_tokens: u64, cache_read: u64, cache_created: u64, ) -> Self
pub fn to_json(&self) -> Result<String, Error>
pub fn from_json(json: &str) -> Result<Self, 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<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 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
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