pub struct Embedding(pub Vec<f32>);Expand description
A vector of floating-point numbers representing a semantic embedding.
Tuple Fields§
§0: Vec<f32>Implementations§
Source§impl Embedding
impl Embedding
Sourcepub fn cosine_similarity(&self, other: &Embedding) -> f32
pub fn cosine_similarity(&self, other: &Embedding) -> f32
Computes the cosine similarity between this embedding and another. Returns a value between -1.0 and 1.0.
Sourcepub fn from_text_simple(text: &str) -> Self
pub fn from_text_simple(text: &str) -> Self
A simple placeholder for text-to-embedding conversion. In a production environment, this should be replaced with a proper model (e.g., from a transformer).
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
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