#[non_exhaustive]pub enum FinishReason {
EndTurn,
ToolUse,
MaxTokens,
StopSequence,
Aborted(String),
Other(String),
}Expand description
Reason a provider turn (or an entire run) ended.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EndTurn
Model produced a complete reply with no tool call. The natural terminator of a run.
ToolUse
Model emitted at least one tool call. The engine continues the run by executing tools and issuing the next turn.
MaxTokens
Model stopped because crate::ChatRequest::max_tokens was
reached. The reply is partial.
StopSequence
Model emitted one of the configured
crate::ChatRequest::stop_sequences.
Aborted(String)
Run was terminated outside the model: cancellation token,
timeout, crate::HookAction::Terminate, or
crate::ToolDecision::Terminate. The string carries a
human-readable reason ("cancelled by caller",
"timeout: ...", the middleware-supplied reason, etc.).
The engine guarantees this is the only finish reason ever
surfaced for caller-initiated stops — Err results are
reserved for transport errors.
Other(String)
Provider reported a finish reason the adapter did not map to one of the typed variants. Treat as terminal.
Trait Implementations§
Source§impl Clone for FinishReason
impl Clone for FinishReason
Source§fn clone(&self) -> FinishReason
fn clone(&self) -> FinishReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more