pub trait EmbedderProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn dimensions(&self) -> usize;
fn build<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Arc<dyn EmbeddingService>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A source that can produce an EmbeddingService by name.
Packs implement this trait to register custom embedding backends.
The runtime calls build lazily — once per
process per model — and caches the result. Subsequent calls to
KhiveRuntime::embedder(name) are cheap.
Built-in lattice models are registered automatically via
LatticeEmbedderProvider; packs need not re-register them.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Stable, case-sensitive name for this embedder.
Must be unique across all registered providers. The name is used as
the key in KhiveRuntime::embedder(name) lookups and as the storage
table suffix for vector indices. Use the model’s canonical short form
(e.g. "all-minilm-l6-v2", "my-custom-encoder").
Sourcefn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Output vector dimension for this embedder.
Must be consistent with what build produces.
The runtime uses this to pre-register the vector store columns.
Sourcefn build<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Arc<dyn EmbeddingService>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn build<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Arc<dyn EmbeddingService>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Construct the underlying EmbeddingService.
Called at most once per process. The result is cached in a
OnceCell; concurrent callers block on the first call and share
the result thereafter.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".