pub struct EmbeddingKey {
pub model: Box<str>,
pub revision: Box<str>,
pub dims: u32,
pub metric: DistanceMetric,
pub dtype: VectorDType,
pub norm: VectorNorm,
}Expand description
Identifies an embedding space (model + revision + dims + metric + dtype + norm).
Used for selecting vector store collections, caching, and embedding migration routing.
canonical_bytes() produces a stable hash for deduplication.
Fields§
§model: Box<str>Provider/model name (e.g., “bge-small-en-v1.5”).
revision: Box<str>Provider-specific revision (semver, date tag, or commit hash).
dims: u32Vector dimensionality.
metric: DistanceMetricDistance metric for similarity.
dtype: VectorDTypeElement data type.
norm: VectorNormNormalization state.
Implementations§
Source§impl EmbeddingKey
impl EmbeddingKey
Sourcepub fn new(
model: impl Into<Box<str>>,
revision: impl Into<Box<str>>,
dims: u32,
metric: DistanceMetric,
dtype: VectorDType,
norm: VectorNorm,
) -> Self
pub fn new( model: impl Into<Box<str>>, revision: impl Into<Box<str>>, dims: u32, metric: DistanceMetric, dtype: VectorDType, norm: VectorNorm, ) -> Self
Create a new EmbeddingKey.
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
Returns canonical bytes for deterministic hashing.
Format:
- model (4-byte big-endian length prefix + UTF-8 bytes)
- revision (4-byte big-endian length prefix + UTF-8 bytes)
- dims (4 bytes, big-endian)
- metric (1 byte)
- dtype (1 byte)
- norm (1 byte)
Trait Implementations§
Source§impl Clone for EmbeddingKey
impl Clone for EmbeddingKey
Source§fn clone(&self) -> EmbeddingKey
fn clone(&self) -> EmbeddingKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 EmbeddingKey
impl Debug for EmbeddingKey
Source§impl<'de> Deserialize<'de> for EmbeddingKey
impl<'de> Deserialize<'de> for EmbeddingKey
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 Hash for EmbeddingKey
impl Hash for EmbeddingKey
Source§impl PartialEq for EmbeddingKey
impl PartialEq for EmbeddingKey
Source§fn eq(&self, other: &EmbeddingKey) -> bool
fn eq(&self, other: &EmbeddingKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EmbeddingKey
impl Serialize for EmbeddingKey
impl Eq for EmbeddingKey
impl StructuralPartialEq for EmbeddingKey
Auto Trait Implementations§
impl Freeze for EmbeddingKey
impl RefUnwindSafe for EmbeddingKey
impl Send for EmbeddingKey
impl Sync for EmbeddingKey
impl Unpin for EmbeddingKey
impl UnsafeUnpin for EmbeddingKey
impl UnwindSafe for EmbeddingKey
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.