pub struct ModelEvent {
pub event: Symbol,
pub runner: Symbol,
pub model: String,
pub span_id: Expr,
pub response: Option<ModelResponse>,
pub extra: Vec<(Expr, Expr)>,
}Expand description
Structured streaming event emitted by a model runner.
Fields§
§event: SymbolEvent kind such as start, delta, usage, tool-call, or final.
runner: SymbolRunner identity that produced the event.
model: StringProvider or runtime model name for the event.
span_id: ExprCorrelation id for one inference span.
response: Option<ModelResponse>Final response payload for terminal events when available.
extra: Vec<(Expr, Expr)>Open extension fields preserved for event-specific payloads.
Implementations§
Source§impl ModelEvent
impl ModelEvent
Sourcepub fn new(
event: Symbol,
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
) -> ModelEvent
pub fn new( event: Symbol, runner: Symbol, model: impl Into<String>, span_id: Expr, ) -> ModelEvent
Constructs a generic event record.
Sourcepub fn start(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
) -> ModelEvent
pub fn start( runner: Symbol, model: impl Into<String>, span_id: Expr, ) -> ModelEvent
Constructs a start event.
Sourcepub fn delta_text(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
text: impl Into<String>,
) -> ModelEvent
pub fn delta_text( runner: Symbol, model: impl Into<String>, span_id: Expr, text: impl Into<String>, ) -> ModelEvent
Constructs a text delta event.
Sourcepub fn usage(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
usage: ModelUsage,
) -> ModelEvent
pub fn usage( runner: Symbol, model: impl Into<String>, span_id: Expr, usage: ModelUsage, ) -> ModelEvent
Constructs a usage event.
Sourcepub fn error_text(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
message: impl Into<String>,
) -> ModelEvent
pub fn error_text( runner: Symbol, model: impl Into<String>, span_id: Expr, message: impl Into<String>, ) -> ModelEvent
Constructs an error event with a text payload.
Sourcepub fn tool_call(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
tool_call: Expr,
) -> ModelEvent
pub fn tool_call( runner: Symbol, model: impl Into<String>, span_id: Expr, tool_call: Expr, ) -> ModelEvent
Constructs a tool-call event.
Sourcepub fn final_of(response: &ModelResponse) -> ModelEvent
pub fn final_of(response: &ModelResponse) -> ModelEvent
Constructs a terminal final event from a completed response.
Sourcepub fn with_field(self, key: &str, value: Expr) -> ModelEvent
pub fn with_field(self, key: &str, value: Expr) -> ModelEvent
Appends an extra field to the event payload.
Trait Implementations§
Source§impl Clone for ModelEvent
impl Clone for ModelEvent
Source§fn clone(&self) -> ModelEvent
fn clone(&self) -> ModelEvent
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 ModelEvent
impl Debug for ModelEvent
Source§impl PartialEq for ModelEvent
impl PartialEq for ModelEvent
Source§fn eq(&self, other: &ModelEvent) -> bool
fn eq(&self, other: &ModelEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ModelEvent
Auto Trait Implementations§
impl Freeze for ModelEvent
impl RefUnwindSafe for ModelEvent
impl Send for ModelEvent
impl Sync for ModelEvent
impl Unpin for ModelEvent
impl UnsafeUnpin for ModelEvent
impl UnwindSafe for ModelEvent
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