Enum CompletionErrorKind
#[non_exhaustive]pub enum CompletionErrorKind {
ContextOverflow,
RateLimited,
QuotaExhausted,
Overloaded,
Refused,
Timeout,
Transport,
ServerError,
Rejected,
MalformedResponse,
EmptyReply,
Unavailable,
}Expand description
The kind of failure a model round ended with.
The kinds form a closed set, so a caller can branch on the kind alone.
The caller that performs a round maps every failure into one of these
kinds. Each kind is either retryable or permanent (see
CompletionError::is_retryable). The enum is #[non_exhaustive], so
a match on it needs a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ContextOverflow
The request exceeds the model’s context window. Permanent.
RateLimited
The backend is limiting the request rate. Retryable.
QuotaExhausted
The billing or usage quota is spent. Permanent.
Overloaded
The backend is temporarily at capacity. Retryable.
Refused
The provider declined the content on policy grounds. Permanent.
Timeout
The wait for a reply or the next chunk timed out. Retryable.
Transport
The connection failed or the stream broke. Retryable.
ServerError
The backend reported a fault of its own. Retryable.
Rejected
The backend refused the request for any other reason. Permanent.
MalformedResponse
The reply was malformed, or it was larger than the size limit for a reply. Retryable.
EmptyReply
The model’s reply was empty of text and tool calls. Permanent.
Model access is turned off or lacks a configuration. Permanent.
Implementations§
§impl CompletionErrorKind
impl CompletionErrorKind
pub fn phrase(self) -> &'static str
pub fn phrase(self) -> &'static str
Returns the fixed phrase for this kind: one lowercase phrase written for a model to read.
The caller builds a CompletionError message from this phrase. For
a failure that came from an HTTP status, it appends (status N). A
401 or 403 is Unavailable, and its message uses the phrase
the model backend did not accept the credentials. Only
MalformedResponse, EmptyReply, and Unavailable may extend the
phrase with : and specific text that the caller’s own code wrote.
Provider text never enters the message. It goes in the
detail.
Trait Implementations§
§impl Clone for CompletionErrorKind
impl Clone for CompletionErrorKind
§fn clone(&self) -> CompletionErrorKind
fn clone(&self) -> CompletionErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CompletionErrorKind
§impl Debug for CompletionErrorKind
impl Debug for CompletionErrorKind
impl Eq for CompletionErrorKind
§impl Hash for CompletionErrorKind
impl Hash for CompletionErrorKind
§impl PartialEq for CompletionErrorKind
impl PartialEq for CompletionErrorKind
impl StructuralPartialEq for CompletionErrorKind
Auto Trait Implementations§
impl Freeze for CompletionErrorKind
impl RefUnwindSafe for CompletionErrorKind
impl Send for CompletionErrorKind
impl Sync for CompletionErrorKind
impl Unpin for CompletionErrorKind
impl UnsafeUnpin for CompletionErrorKind
impl UnwindSafe for CompletionErrorKind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more