pub struct EmbedderIdentity {
pub name: String,
pub dimensions: usize,
pub normalize: bool,
pub query_convention: String,
}Expand description
Describe an embedder’s observable identity. Used both in-memory on
an open [Mnemo] handle and persisted at metadata.embedder on the
scaffold manifest so that reopening with a different embedder is
caught at set_embedder time instead of silently polluting the
index.
Build one with a struct literal ending in ..Default::default(), so a
field added later (as query_convention was in v0.15) doesn’t break it.
Fields§
§name: StringModel identifier the caller chose. Convention: a short, stable
slug — "all-MiniLM-L6-v2", "text-embedding-3-small".
dimensions: usizeVector width this embedder emits. Validated against
[Mnemo::dimensions] on registration.
normalize: boolWhether the embedder returns unit-normalized vectors. Caller’s claim — mnemo doesn’t verify it, but records it on the manifest so downstream readers can tell whether a dot product is cosine equivalent.
query_convention: String12.3 step 4 (v0.15): how Embedder::embed_query differs from
Embedder::embed. Empty (the default) when queries are embedded
like documents; otherwise a short, stable name for the convention,
such as "bge-query-instruction" for a model that prefixes queries
with an instruction. It’s part of the identity: a file embedded one
way refuses an embedder that queries another way
(MnemoError::EmbedderMismatch); mnemo reembed moves a file to a
new identity. Stored only when it isn’t empty, so a symmetric
embedder records what it did before v0.15. Builds before v0.15
ignore it.
Implementations§
Source§impl EmbedderIdentity
impl EmbedderIdentity
Sourcepub const MISMATCH_MSG: &'static str = "embedder identity mismatch"
pub const MISMATCH_MSG: &'static str = "embedder identity mismatch"
Message rendered inside MnemoError::Invalid on an identity
mismatch. Public so tests + binding layers can assert on it.