pub trait Embedder {
// Required methods
fn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>;
fn platform(&self) -> &str;
fn embed(
&self,
asset_id: &str,
task: TaskKind,
) -> Result<Vec<f32>, EmbedError>;
}Expand description
The embedder seam the regeneration loop drives: “produce the canonical embedding for an asset under a task”. Abstracting it keeps the orchestration testable with a deterministic double and independent of any real model runtime.
Required Methods§
Sourcefn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>
fn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>
The (model_id, model_version) this embedder produces for task, or None if it does not
serve that task (e.g. a non-embedding task). The loop refuses an embedder whose declared
pair is not the registry canonical — its outputs would otherwise be stored under a tuple
they did not produce.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".