pub struct Embedding {
pub document: String,
pub vec: Vec<f64>,
}Expand description
A single document and its vector representation.
The document field preserves the original text so embeddings can be
matched back to their source after batching or storage.
Fields§
§document: StringThe text that was embedded.
vec: Vec<f64>The embedding vector returned by the model.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Embedding
impl<'de> Deserialize<'de> for Embedding
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Embedding
Source§impl VectorDistance for Embedding
impl VectorDistance for Embedding
Source§fn dot_product(&self, other: &Self) -> f64
fn dot_product(&self, other: &Self) -> f64
Dot product of two vectors.
Source§fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64
fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64
Cosine similarity in
[-1, 1]. Read moreSource§fn angular_distance(&self, other: &Self, normalized: bool) -> f64
fn angular_distance(&self, other: &Self, normalized: bool) -> f64
Angular distance in
[0, 1] (0 = identical direction).Source§fn euclidean_distance(&self, other: &Self) -> f64
fn euclidean_distance(&self, other: &Self) -> f64
Euclidean (L2) distance.
Source§fn manhattan_distance(&self, other: &Self) -> f64
fn manhattan_distance(&self, other: &Self) -> f64
Manhattan (L1) distance.
Source§fn chebyshev_distance(&self, other: &Self) -> f64
fn chebyshev_distance(&self, other: &Self) -> f64
Chebyshev (L∞) distance — maximum absolute difference across dimensions.
Auto Trait Implementations§
impl Freeze for Embedding
impl RefUnwindSafe for Embedding
impl Send for Embedding
impl Sync for Embedding
impl Unpin for Embedding
impl UnsafeUnpin for Embedding
impl UnwindSafe for Embedding
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