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,
) -> Self
pub fn new( event: Symbol, runner: Symbol, model: impl Into<String>, span_id: Expr, ) -> Self
Constructs a generic event record.
Sourcepub fn start(runner: Symbol, model: impl Into<String>, span_id: Expr) -> Self
pub fn start(runner: Symbol, model: impl Into<String>, span_id: Expr) -> Self
Constructs a start event.
Sourcepub fn delta_text(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
text: impl Into<String>,
) -> Self
pub fn delta_text( runner: Symbol, model: impl Into<String>, span_id: Expr, text: impl Into<String>, ) -> Self
Constructs a text delta event.
Sourcepub fn usage(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
usage: ModelUsage,
) -> Self
pub fn usage( runner: Symbol, model: impl Into<String>, span_id: Expr, usage: ModelUsage, ) -> Self
Constructs a usage event.
Sourcepub fn error_text(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
message: impl Into<String>,
) -> Self
pub fn error_text( runner: Symbol, model: impl Into<String>, span_id: Expr, message: impl Into<String>, ) -> Self
Constructs an error event with a text payload.
Sourcepub fn tool_call(
runner: Symbol,
model: impl Into<String>,
span_id: Expr,
tool_call: Expr,
) -> Self
pub fn tool_call( runner: Symbol, model: impl Into<String>, span_id: Expr, tool_call: Expr, ) -> Self
Constructs a tool-call event.
Sourcepub fn final_of(response: &ModelResponse) -> Self
pub fn final_of(response: &ModelResponse) -> Self
Constructs a terminal final event from a completed response.
Sourcepub fn with_field(self, key: &str, value: Expr) -> Self
pub fn with_field(self, key: &str, value: Expr) -> Self
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 From<ModelEvent> for Expr
impl From<ModelEvent> for Expr
Source§fn from(value: ModelEvent) -> Self
fn from(value: ModelEvent) -> Self
Converts to this type from the input type.
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