Skip to main content

Module embedder

Module embedder 

Source
Expand description

Pluggable text → vector embedding.

The Agent Memory SDK is bring-your-own-vector: it never generates embeddings. This crate mirrors the repo’s established pattern (the Python SDK’s Embedder protocol, the tauri-rag demo’s fastembed backend): an Embedder trait with a default on-device model and a deterministic, network-free fallback for tests and air-gapped reproducibility.

Structs§

HashEmbedder
Deterministic, network-free embedder (token-hashing into L2-normalized buckets). Not semantically strong — its purpose is reproducible tests and offline behavior, exactly like the fake_embed used in the repo’s agent_memory examples. Swap in a real model (e.g. fastembed, all-MiniLM-L6-v2, 384-dim) for production recall quality.

Enums§

EmbedError
Failure produced by an Embedder backend (e.g. a network-backed embedder that cannot reach its model). The in-memory HashEmbedder never fails.

Traits§

Embedder
Turns text into a fixed-dimension embedding vector.

Type Aliases§

DynEmbedder
A boxed, object-safe embedder. Lets a non-generic MemoryService<DynEmbedder> be stored behind a concrete type — the MCP server and the language bindings both need this, since handler/pyclass types can’t carry a generic E.