pub trait Embedder: Send + Sync {
// Required methods
fn dim(&self) -> usize;
fn embed(&self, text: &str) -> Result<Embedding>;
// Provided methods
fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Embedding>> { ... }
fn model_id(&self) -> &str { ... }
}Expand description
The embedding contract every backend implements.
Backends ship in ijima-server (candle is the IA-standard default,
consistent with Quantizon); a remote-API backend may follow.
Send + Sync so an Arc<dyn Embedder> can be shared across an
async store’s worker pool.
Required Methods§
Provided Methods§
Sourcefn embed_batch(&self, texts: &[&str]) -> Result<Vec<Embedding>>
fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Embedding>>
Embeds a batch of texts. The default loops over [embed];
backends with batch acceleration override this.
§Errors
Propagates any per-item embedding error.
Sourcefn model_id(&self) -> &str
fn model_id(&self) -> &str
The model id that produced these embeddings (e.g.
sentence-transformers/all-MiniLM-L6-v2@main). Used for
embedding provenance (D10): memories stamp the model that
embedded them, so a model swap is detectable and a re-embed pass
can be triggered rather than silently producing incomparable
vectors. Default "unknown" for backends that don’t track it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".