pub enum EmbeddingError {
Timeout,
RateLimit {
retry_after_secs: Option<u64>,
},
ContextOverflow {
tokens: usize,
},
InvalidResponse {
message: String,
},
ServiceUnavailable {
message: String,
},
AuthenticationFailed,
JsonError {
message: String,
},
NetworkError {
message: String,
},
InvalidRequest {
message: String,
},
EmptyInput,
DimensionMismatch {
expected: usize,
actual: usize,
},
}Expand description
Unified error type for all embedding providers.
TigerStyle: Explicit variants for all failure modes.
Variants§
Timeout
Request timed out
RateLimit
Rate limit exceeded
ContextOverflow
Input text too long
InvalidResponse
Invalid response from provider
Service unavailable
AuthenticationFailed
Authentication failed
JsonError
JSON serialization/deserialization error
NetworkError
Network error
InvalidRequest
Invalid request parameters
EmptyInput
Empty input provided
DimensionMismatch
Dimension mismatch in returned embedding
Implementations§
Source§impl EmbeddingError
impl EmbeddingError
Sourcepub fn rate_limit(retry_after_secs: Option<u64>) -> Self
pub fn rate_limit(retry_after_secs: Option<u64>) -> Self
Create a rate limit error.
Sourcepub fn context_overflow(tokens: usize) -> Self
pub fn context_overflow(tokens: usize) -> Self
Create a context overflow error.
Sourcepub fn invalid_response(message: impl Into<String>) -> Self
pub fn invalid_response(message: impl Into<String>) -> Self
Create an invalid response error.
Create a service unavailable error.
Sourcepub fn json_error(message: impl Into<String>) -> Self
pub fn json_error(message: impl Into<String>) -> Self
Create a JSON error.
Sourcepub fn network_error(message: impl Into<String>) -> Self
pub fn network_error(message: impl Into<String>) -> Self
Create a network error.
Sourcepub fn invalid_request(message: impl Into<String>) -> Self
pub fn invalid_request(message: impl Into<String>) -> Self
Create an invalid request error.
Sourcepub fn dimension_mismatch(expected: usize, actual: usize) -> Self
pub fn dimension_mismatch(expected: usize, actual: usize) -> Self
Create a dimension mismatch error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Trait Implementations§
Source§impl Clone for EmbeddingError
impl Clone for EmbeddingError
Source§fn clone(&self) -> EmbeddingError
fn clone(&self) -> EmbeddingError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingError
impl Debug for EmbeddingError
Source§impl Display for EmbeddingError
impl Display 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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<EmbeddingError> for MemoryError
impl From<EmbeddingError> for MemoryError
Source§fn from(err: EmbeddingError) -> Self
fn from(err: EmbeddingError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for EmbeddingError
impl RefUnwindSafe for EmbeddingError
impl Send for EmbeddingError
impl Sync for EmbeddingError
impl Unpin 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
Mutably borrows from an owned value. Read more