pub enum LlmCallError {
NotConfigured {
model: String,
},
UnknownModel {
model: String,
available: Vec<String>,
},
BudgetExceeded {
model: String,
limit_kind: LlmLimitKind,
},
PromptBoundsExceeded {
model: String,
limit_kind: PromptBoundKind,
actual: u64,
limit: u64,
},
Unauthorized {
model: String,
},
Transport {
model: String,
detail: String,
},
}Expand description
Why a model dispatch failed — the request never reached the model, or the transport died before any element ran.
Reserved for dispatch-level failure only. A model that answered and produced
an unusable or incomplete element reports that in LlmOutcome’s failure
arm, never here: returning Err for one bad element would throw away the
sibling elements that did succeed.
Every variant names the model it was dispatched at and the fix the caller can act on. None carries prompt or completion text.
Variants§
NotConfigured
No LlmProvider is wired into the runtime, so nothing can dispatch.
The pure-interpreter path leaves the provider None, and this is the
catchable configuration error a script sees there.
UnknownModel
The model name is not one the provider serves. available lists what it
does serve, so the message can name the alternatives rather than only the
rejection.
BudgetExceeded
A token ceiling cannot cover this dispatch. Charged before any element ran, so nothing was billed.
limit_kind carries which ceiling refused, because the three want
different responses and a message that reads the same for all of them
sends a caller to shrink work that was never what filled the budget.
PromptBoundsExceeded
The prompt slice is outside the bounds the host accepts — too many elements, or one element too large. Counted in elements and bytes, never quoted.
The provider rejected the credential, or none was resolvable when the
provider was constructed. One variant covers both because the fix is the
same key — this is the LoadAPIKeyError-vs-401 split collapsed at the
point where the caller can act on it.
Fields
Transport
The request never completed, and died before any element ran. A transport
failure after elements started belongs in FailureReason::Transport
on the affected elements instead.
detail is a fixed classification string — “connection reset”,
“dns lookup failed”, “tls handshake failed”. It is the one free-form field
in this taxonomy, and the no-payload rule binds it: never a provider response body, and
never a request echo. The precedent this trait otherwise mirrors does
interpolate a body
(McpCallError::Upstream
renders HTTP {status}: {body}); this one deliberately does not, because a
model provider’s body carries completion fragments.
Implementations§
Source§impl LlmCallError
impl LlmCallError
Sourcepub fn model(&self) -> &str
pub fn model(&self) -> &str
The model this dispatch was aimed at. Every variant names one, so a caller need not match to attribute the failure.
Sourcepub fn is_budget_exceeded(&self) -> bool
pub fn is_budget_exceeded(&self) -> bool
Token-budget refusals become catchable QuotaExceededErrors at the
stdlib boundary. Prompt size/count bounds remain RangeErrors.
Trait Implementations§
Source§impl Clone for LlmCallError
impl Clone for LlmCallError
Source§impl Debug for LlmCallError
impl Debug for LlmCallError
Source§impl Display for LlmCallError
impl Display for LlmCallError
impl Eq for LlmCallError
Source§impl Error for LlmCallError
impl Error for LlmCallError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for LlmCallError
impl PartialEq for LlmCallError
impl StructuralPartialEq for LlmCallError
Auto Trait Implementations§
impl Freeze for LlmCallError
impl RefUnwindSafe for LlmCallError
impl Send for LlmCallError
impl Sync for LlmCallError
impl Unpin for LlmCallError
impl UnsafeUnpin for LlmCallError
impl UnwindSafe for LlmCallError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.