pub trait ModelRunner {
// Required methods
fn platform(&self) -> &str;
fn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>;
fn embed_image(
&self,
task: TaskKind,
frames: &[Frame<'_>],
) -> Result<Vec<Embedding>, RunnerError>;
fn embed_text(&self, texts: &[&str]) -> Result<Vec<Embedding>, RunnerError>;
fn detect(
&self,
task: TaskKind,
frames: &[Frame<'_>],
) -> Result<Vec<Vec<Detection>>, RunnerError>;
}Expand description
The inference seam every consumer routes through. Implemented by real per-platform runners
(behind the inference feature) and by FixtureRunner for tests.
Required Methods§
Sourcefn platform(&self) -> &str
fn platform(&self) -> &str
The platform partition tag for this runner’s outputs (incomparable across platforms).
Sourcefn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>
fn model(&self, task: TaskKind) -> Option<(ModelId, ModelVersion)>
The (model_id, model_version) this runner produces for task, if it serves it. Must equal
the registry’s canonical row for the output to be accepted by the index.
Sourcefn embed_image(
&self,
task: TaskKind,
frames: &[Frame<'_>],
) -> Result<Vec<Embedding>, RunnerError>
fn embed_image( &self, task: TaskKind, frames: &[Frame<'_>], ) -> Result<Vec<Embedding>, RunnerError>
Embed images for an embedding task (SemanticSearch, FaceRecognition). One vector per
frame, in order.
Sourcefn embed_text(&self, texts: &[&str]) -> Result<Vec<Embedding>, RunnerError>
fn embed_text(&self, texts: &[&str]) -> Result<Vec<Embedding>, RunnerError>
Embed text into the semantic-search space — for natural-language queries and the zero-shot tagging that reuses the semantic embedder.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".