pub enum StopReason {
EndTurn,
MaxTokens,
StopSequence,
ToolUse,
Other(String),
}Expand description
Why the model stopped generating.
Variants§
EndTurn
It finished what it had to say.
MaxTokens
It ran into max_tokens — the text is probably truncated.
StopSequence
It hit one of the caller’s stop sequences.
ToolUse
It is waiting for tool results.
Other(String)
Something provider-specific; kept verbatim rather than guessed at.
Implementations§
Source§impl StopReason
impl StopReason
Sourcepub fn parse(text: &str) -> StopReason
pub fn parse(text: &str) -> StopReason
Map a provider’s word onto ours.
The vocabularies genuinely overlap (end_turn/stop, max_tokens/
length), so one table serves all three providers.
pub fn as_str(&self) -> &str
pub fn is_tool_use(&self) -> bool
Trait Implementations§
Source§impl Clone for StopReason
impl Clone for StopReason
Source§impl Debug for StopReason
impl Debug for StopReason
Source§impl Display for StopReason
impl Display 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