#[non_exhaustive]pub enum FinishReason {
Stop,
Length,
ToolUse,
ContentFilter,
Other(String),
}Expand description
Why a completion stopped (issue #859): what
TextDelta::Finish names when a stream ends successfully, and the
shape complete’s outcome takes on the streaming port.
#[non_exhaustive]: providers invent reasons, and Self::Other is
the pressure valve — a caller that matches the known ones and treats
anything else as Self::Stop-shaped should not recompile when a
provider’s vocabulary grows.
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.
Stop
The model finished its answer on its own.
Length
The answer was cut off at Prompt::max_tokens.
ToolUse
The model asked to call a tool; the answer continues in
Completion::tool_calls.
ContentFilter
The provider withheld or truncated content under its own policy.
Other(String)
A reason this port does not name. The provider’s own word rides along for the log line.
Trait Implementations§
Source§impl Clone for FinishReason
impl Clone for FinishReason
Source§impl Debug for FinishReason
impl Debug for FinishReason
Source§impl<'de> Deserialize<'de> for FinishReason
impl<'de> Deserialize<'de> for FinishReason
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FinishReason
Source§impl From<&FinishReason> for UiFinishReason
impl From<&FinishReason> for UiFinishReason
Source§fn from(reason: &FinishReason) -> Self
fn from(reason: &FinishReason) -> Self
Converts to this type from the input type.
Source§impl PartialEq for FinishReason
impl PartialEq for FinishReason
Source§impl Serialize for FinishReason
impl Serialize for FinishReason
impl StructuralPartialEq for FinishReason
Auto Trait Implementations§
impl Freeze for FinishReason
impl RefUnwindSafe for FinishReason
impl Send for FinishReason
impl Sync for FinishReason
impl Unpin for FinishReason
impl UnsafeUnpin for FinishReason
impl UnwindSafe for FinishReason
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.