#[non_exhaustive]pub enum StopReason {
EndTurn,
ToolUse,
MaxTokens,
Refusal,
ContentFiltered,
PauseTurn,
}Expand description
Why the model stopped generating.
Marked #[non_exhaustive]: providers keep introducing new stop reasons, so
downstream matches must include a wildcard arm and adding a variant is not
a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
EndTurn
The model finished its response naturally.
ToolUse
The model wants to call one or more tools.
MaxTokens
The response was truncated due to max token limits.
Refusal
The model declined to answer, e.g. for safety reasons.
ContentFiltered
A provider-side guardrail or content filter blocked the output.
PauseTurn
The provider paused mid-turn (e.g. during a server-tool loop); the turn can be continued with a follow-up request.
Trait Implementations§
Source§impl Clone for StopReason
impl Clone for StopReason
Source§fn clone(&self) -> StopReason
fn clone(&self) -> StopReason
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 moreimpl Copy for StopReason
Source§impl Debug for StopReason
impl Debug for StopReason
impl Eq for StopReason
Source§impl PartialEq for StopReason
impl PartialEq for StopReason
impl StructuralPartialEq for StopReason
Auto Trait Implementations§
impl Freeze for StopReason
impl RefUnwindSafe for StopReason
impl Send for StopReason
impl Sync for StopReason
impl Unpin for StopReason
impl UnsafeUnpin for StopReason
impl UnwindSafe for StopReason
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