pub struct EmbeddingBucket {
pub entries: Vec<EmbeddingEntry>,
pub extra: BTreeMap<String, Ipld>,
}Expand description
Per-node bucket of embeddings inside the
Commit.embeddings Prolly tree.
One bucket per node. Each bucket holds a sorted
(model, Embedding) list so a node may carry multiple
embeddings simultaneously - e.g. one local MiniLM vector plus
one OpenAI vector for the same chunk text. Lookups index into
the bucket by model string after the outer Prolly walk has
returned the bucket itself.
Fields§
§entries: Vec<EmbeddingEntry>Entries sorted lexicographically by model for byte-stable
canonical form. The sort is enforced on every serialize, so
callers may push entries in any order without breaking CID
determinism on the bucket itself.
extra: BTreeMap<String, Ipld>Forward-compat extension carrier. Unknown CBOR fields land here on decode and are emitted verbatim on re-encode, so a future schema bump that adds a per-bucket field stays round-trippable on today’s reader.
Implementations§
Source§impl EmbeddingBucket
impl EmbeddingBucket
Sourcepub const KIND: &'static str = "embedding_bucket"
pub const KIND: &'static str = "embedding_bucket"
On-wire _kind discriminator. Every content-addressed object
in mnem/0.x carries a _kind field as the first canonical key
so a corrupt bucket / wrong-type decode fails fast with an
actionable error instead of silently mis-decoding.
Sourcepub fn get(&self, model: &str) -> Option<&Embedding>
pub fn get(&self, model: &str) -> Option<&Embedding>
Look up an embedding by model string. Returns None when this
bucket has no entry for the requested embedder; the caller
typically falls back to lazy compute via the configured
embed provider.
Trait Implementations§
Source§impl Clone for EmbeddingBucket
impl Clone for EmbeddingBucket
Source§fn clone(&self) -> EmbeddingBucket
fn clone(&self) -> EmbeddingBucket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more