pub enum EmbeddingError {
NotConfigured {
alias: String,
},
UnknownModel {
alias: String,
available: Vec<String>,
},
InputTooLong {
alias: String,
index: Option<usize>,
limit: Option<u64>,
settlements: Vec<SubBatchSettlement>,
},
BoundsExceeded {
alias: String,
kind: EmbeddingBoundKind,
actual: u64,
limit: u64,
},
BudgetExceeded {
alias: String,
limit_kind: EmbeddingLimitKind,
settlements: Vec<SubBatchSettlement>,
},
Unauthorized {
alias: String,
settlements: Vec<SubBatchSettlement>,
},
Provider {
alias: String,
reason: EmbeddingFailureReason,
settlements: Vec<SubBatchSettlement>,
},
Malformed {
alias: String,
reason: EmbeddingMalformedReason,
settlements: Vec<SubBatchSettlement>,
},
Internal {
alias: String,
settlements: Vec<SubBatchSettlement>,
},
}Expand description
Why an embedding call failed. Variants after the pre-send group carry the settlements of every sub-batch that was sent before the failure.
None carries input text.
Variants§
NotConfigured
UnknownModel
InputTooLong
An input exceeds the alias’s max_input_bytes, or the provider rejected
one as too long. index names the input when known. limit is the byte
limit for the pre-send check and None for a provider-side rejection,
which carries the settlements of sub-batches already sent.
BoundsExceeded
BudgetExceeded
A ceiling refused the call. Pre-send, settlements is empty; the
request cap can also trip between sub-batches.
Fields
Provider
Malformed
Internal
The provider’s own bookkeeping failed (a closed pool, a missing slot). Never guest-catchable: the stdlib settles the budget and ends the run.
Implementations§
Source§impl EmbeddingError
impl EmbeddingError
pub fn alias(&self) -> &str
Sourcepub fn settlements(&self) -> &[SubBatchSettlement]
pub fn settlements(&self) -> &[SubBatchSettlement]
Per-sub-batch settlements carried by a post-send failure; empty for pre-send variants.
Sourcepub fn is_budget_exceeded(&self) -> bool
pub fn is_budget_exceeded(&self) -> bool
Token-budget refusals become catchable QuotaExceededErrors at the
stdlib boundary.
Sourcepub fn is_internal(&self) -> bool
pub fn is_internal(&self) -> bool
A provider-side invariant failure that must end the run.
Sourcepub fn with_settlements(self, collected: Vec<SubBatchSettlement>) -> Self
pub fn with_settlements(self, collected: Vec<SubBatchSettlement>) -> Self
Attach settlements to a failure raised by EmbeddingTokenBudget::mark_sent
or built before the provider had them. A no-op on pre-send variants.
Trait Implementations§
Source§impl Clone for EmbeddingError
impl Clone for EmbeddingError
Source§impl Debug for EmbeddingError
impl Debug for EmbeddingError
Source§impl Display for EmbeddingError
impl Display for EmbeddingError
impl Eq for EmbeddingError
Source§impl Error for EmbeddingError
impl Error for EmbeddingError
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 EmbeddingError
impl PartialEq for EmbeddingError
impl StructuralPartialEq for EmbeddingError
Auto Trait Implementations§
impl Freeze for EmbeddingError
impl RefUnwindSafe for EmbeddingError
impl Send for EmbeddingError
impl Sync for EmbeddingError
impl Unpin for EmbeddingError
impl UnsafeUnpin for EmbeddingError
impl UnwindSafe for EmbeddingError
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.