#[non_exhaustive]pub enum EmbeddingError {
HttpError(String),
ApiError(String),
ParseError(String),
Config(String),
EmptyInput,
BatchMismatch {
expected: usize,
actual: usize,
},
EmptyVectorInBatch,
}Expand description
Embedding error type
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.
HttpError(String)
HTTP request error
ApiError(String)
API error
ParseError(String)
Parse error
Config(String)
配置错误(如 API key 为空、模型维度未知)——构造期 fail fast。
EmptyInput
Empty input
BatchMismatch
批量 embedding 数量错位:请求 N 条文本,服务端返回的向量数量或 index 超出了预期范围(某 chunk 少返回/乱序导致)。
P0-1: 拒绝静默错数据——绝不把缺失向量当成“不相似“。
EmptyVectorInBatch
批量 embedding 中某条文本未取到向量(服务端返回量 < 请求量)。
P0-1: 拒绝静默空向量——缺失即显式报错,而非留下零向量。
Trait Implementations§
Source§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()
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
Mutably borrows from an owned value. Read more