pub enum ModelEvent {
Started(ModelResponseInfo),
TextDelta(Utf8Delta),
ThinkingDelta(Utf8Delta),
ToolCallStarted(ToolCallStarted),
ToolArgumentsDelta(ToolArgumentsDelta),
ToolCallCompleted(ToolCallCompleted),
HostedToolStarted(HostedToolStarted),
HostedToolCompleted(HostedToolCompleted),
SourceCitation(ModelSourceCitation),
Completed(ModelCompletion),
Failed(ModelFailure),
}Expand description
One normalized provider stream event.
Variants§
Started(ModelResponseInfo)
Provider accepted the request and began one response.
TextDelta(Utf8Delta)
Visible assistant text fragment.
ThinkingDelta(Utf8Delta)
Assistant reasoning fragment.
ToolCallStarted(ToolCallStarted)
Start of a provider tool call.
ToolArgumentsDelta(ToolArgumentsDelta)
Incomplete tool argument fragment, never executable by itself.
ToolCallCompleted(ToolCallCompleted)
Completed tool call with parsed object arguments.
HostedToolStarted(HostedToolStarted)
Start of a provider-hosted tool activity.
HostedToolCompleted(HostedToolCompleted)
Completed provider-hosted tool activity with normalized sources.
SourceCitation(ModelSourceCitation)
Citation emitted for assistant text and an external source.
Completed(ModelCompletion)
Successful terminal event.
Failed(ModelFailure)
Failed or cancelled terminal event.
Implementations§
Source§impl ModelEvent
impl ModelEvent
Sourcepub fn as_text_delta(&self) -> Option<&str>
pub fn as_text_delta(&self) -> Option<&str>
Returns visible text for a text-delta event.
Sourcepub fn as_thinking_delta(&self) -> Option<&str>
pub fn as_thinking_delta(&self) -> Option<&str>
Returns reasoning text for a thinking-delta event.
Sourcepub const fn as_tool_call_started(&self) -> Option<&ToolCallStarted>
pub const fn as_tool_call_started(&self) -> Option<&ToolCallStarted>
Returns the tool-call start payload.
Sourcepub const fn as_tool_arguments_delta(&self) -> Option<&ToolArgumentsDelta>
pub const fn as_tool_arguments_delta(&self) -> Option<&ToolArgumentsDelta>
Returns the incomplete tool-arguments payload.
Sourcepub const fn as_tool_call_completed(&self) -> Option<&ToolCallCompleted>
pub const fn as_tool_call_completed(&self) -> Option<&ToolCallCompleted>
Returns the completed tool-call payload.
Sourcepub const fn as_hosted_tool_started(&self) -> Option<&HostedToolStarted>
pub const fn as_hosted_tool_started(&self) -> Option<&HostedToolStarted>
Returns the hosted tool start payload.
Sourcepub const fn as_hosted_tool_completed(&self) -> Option<&HostedToolCompleted>
pub const fn as_hosted_tool_completed(&self) -> Option<&HostedToolCompleted>
Returns the hosted tool completion payload.
Sourcepub const fn as_source_citation(&self) -> Option<&ModelSourceCitation>
pub const fn as_source_citation(&self) -> Option<&ModelSourceCitation>
Returns the normalized source citation payload.
Trait Implementations§
Source§impl Clone for ModelEvent
impl Clone for ModelEvent
Source§fn clone(&self) -> ModelEvent
fn clone(&self) -> ModelEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more