pub enum Event {
UserInput {
thread_id: ThreadId,
interaction_id: InteractionId,
payload: Value,
task_id: Option<TaskId>,
step_id: Option<StepId>,
timestamp: DateTime<Utc>,
},
AssistantOutput {
thread_id: ThreadId,
interaction_id: InteractionId,
payload: Value,
task_id: Option<TaskId>,
step_id: Option<StepId>,
timestamp: DateTime<Utc>,
},
Artifact {
thread_id: ThreadId,
interaction_id: InteractionId,
reference_id: String,
task_id: Option<TaskId>,
step_id: Option<StepId>,
timestamp: DateTime<Utc>,
},
ExternalEvent {
thread_id: ThreadId,
interaction_id: Option<InteractionId>,
kind: String,
payload: Value,
task_id: Option<TaskId>,
step_id: Option<StepId>,
timestamp: DateTime<Utc>,
},
SystemTrace {
thread_id: ThreadId,
interaction_id: Option<InteractionId>,
level: String,
payload: Value,
task_id: Option<TaskId>,
step_id: Option<StepId>,
timestamp: DateTime<Utc>,
},
}Expand description
Event - append-only fact record
Events represent immutable facts that happened in the system.
Variants§
UserInput
User input event
Fields
§
interaction_id: InteractionIdInteraction this event belongs to
AssistantOutput
Assistant output event
Fields
§
interaction_id: InteractionIdInteraction this event belongs to
Artifact
Artifact event (reference to stored artifact)
Fields
§
interaction_id: InteractionIdInteraction this event belongs to
ExternalEvent
External event (webhook, timer, etc.)
Fields
§
interaction_id: Option<InteractionId>Optional interaction this event belongs to
SystemTrace
System trace event (for debugging and auditing)
Fields
§
interaction_id: Option<InteractionId>Optional interaction this event belongs to
Implementations§
Source§impl Event
impl Event
Sourcepub fn user_input(
thread_id: impl Into<ThreadId>,
interaction_id: impl Into<InteractionId>,
payload: Value,
) -> Event
pub fn user_input( thread_id: impl Into<ThreadId>, interaction_id: impl Into<InteractionId>, payload: Value, ) -> Event
Create a new user input event
Sourcepub fn assistant_output(
thread_id: impl Into<ThreadId>,
interaction_id: impl Into<InteractionId>,
payload: Value,
) -> Event
pub fn assistant_output( thread_id: impl Into<ThreadId>, interaction_id: impl Into<InteractionId>, payload: Value, ) -> Event
Create a new assistant output event
Sourcepub fn artifact(
thread_id: impl Into<ThreadId>,
interaction_id: impl Into<InteractionId>,
reference_id: impl Into<String>,
) -> Event
pub fn artifact( thread_id: impl Into<ThreadId>, interaction_id: impl Into<InteractionId>, reference_id: impl Into<String>, ) -> Event
Create a new artifact event
Sourcepub fn external(
thread_id: impl Into<ThreadId>,
kind: impl Into<String>,
payload: Value,
) -> Event
pub fn external( thread_id: impl Into<ThreadId>, kind: impl Into<String>, payload: Value, ) -> Event
Create a new external event
Sourcepub fn trace(
thread_id: impl Into<ThreadId>,
level: impl Into<String>,
payload: Value,
) -> Event
pub fn trace( thread_id: impl Into<ThreadId>, level: impl Into<String>, payload: Value, ) -> Event
Create a new system trace event
Sourcepub fn interaction_id(&self) -> Option<&str>
pub fn interaction_id(&self) -> Option<&str>
Get the interaction ID of this event if present.
Sourcepub fn with_interaction_id(
&self,
interaction_id: impl Into<InteractionId>,
) -> Event
pub fn with_interaction_id( &self, interaction_id: impl Into<InteractionId>, ) -> Event
Return a copy of this event with a new interaction ID.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Event
impl Serialize for Event
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
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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