pub struct Embedding {
pub document: String,
pub vec: Vec<f64>,
}
Expand description
Struct that holds a single document and its embedding.
Fields§
§document: String
The document that was embedded. Used for debugging.
vec: Vec<f64>
The embedding vector
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
Source§impl VectorDistance for Embedding
Available on crate feature rayon
only.
impl VectorDistance for Embedding
Available on crate feature
rayon
only.Source§fn dot_product(&self, other: &Self) -> f64
fn dot_product(&self, other: &Self) -> f64
Get dot product of two embedding vectors
Source§fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64
fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64
Get cosine similarity of two embedding vectors.
If
normalized
is true, the dot product is returned.Source§fn angular_distance(&self, other: &Self, normalized: bool) -> f64
fn angular_distance(&self, other: &Self, normalized: bool) -> f64
Get angular distance of two embedding vectors.
Source§fn euclidean_distance(&self, other: &Self) -> f64
fn euclidean_distance(&self, other: &Self) -> f64
Get euclidean distance of two embedding vectors.
Source§fn manhattan_distance(&self, other: &Self) -> f64
fn manhattan_distance(&self, other: &Self) -> f64
Get manhattan distance of two embedding vectors.
Source§fn chebyshev_distance(&self, other: &Self) -> f64
fn chebyshev_distance(&self, other: &Self) -> f64
Get chebyshev distance of two embedding vectors.
impl Eq for Embedding
Auto Trait Implementations§
impl Freeze for Embedding
impl RefUnwindSafe for Embedding
impl Send for Embedding
impl Sync for Embedding
impl Unpin 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
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§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
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more