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§
- Hash
Embedder - 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_embedused in the repo’sagent_memoryexamples. Swap in a real model (e.g.fastembed, all-MiniLM-L6-v2, 384-dim) for production recall quality. - Ollama
Embedder - Embeds text through a local Ollama
/api/embeddingsendpoint — real semantic recall while the model stays on the user’s own machine. - Open
AiEmbedder - Embeds through any OpenAI-compatible
/v1/embeddingsendpoint — oMLX, llama.cpp’s server, LM Studio, vLLM, or a hosted provider.
Enums§
- Embed
Error - Failure produced by an
Embedderbackend (e.g. a network-backed embedder that cannot reach its model). The in-memoryHashEmbeddernever fails. - Embedder
Selection - What a caller must do about a named embedding backend.
Constants§
- DEFAULT_
OLLAMA_ MODEL - Default Ollama embedding model (384-dim;
ollama pull all-minilm). - DEFAULT_
OLLAMA_ URL - Default Ollama base URL.
- HASH_
EMBEDDER_ NOTICE - Transport-neutral part of the startup notice adapters emit for
hash. The library itself never writes to stderr; each owning binary or language binding adds the configuration syntax its caller can actually use.
Traits§
- Embedder
- Turns text into a fixed-dimension embedding vector.
Functions§
- select_
embedder - Resolve an embedding backend name to what the caller must do about it.
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 genericE.