Expand description
Provider-agnostic embedding trait for polychrome.
This crate defines the EmbeddingProvider trait that every concrete
embedding backend implements. It is the embedding-side analogue of
polyc-llm’s LlmProvider: a thin
seam so the tool-search layer can swap backends — pure-Rust static
embeddings (model2vec-rs) by default, a heavier transformer
(candle + EmbeddingGemma) when shallow matching isn’t enough — without
touching its own code.
Tool retrieval is a shallow-semantic task over short strings (a query vs. tool name+description), so the default backend is intentionally tiny and fully deterministic: a fixed lookup table + mean pooling embeds bit-for-bit identically for a pinned model across hardware, which lines up with the reproducible prompt-hash discipline elsewhere in the system.
§Modules
error— theEmbeddingErrorbound thatEmbeddingProvider::Errormust satisfy.erased— type erasure to a singleDynEmbeddingProvidertrait object, mirroringpolyc-llm’serasedmodule.
Re-exports§
pub use erased::BoxError;pub use erased::DynEmbeddingProvider;pub use erased::ErasedEmbeddingProvider;pub use erased::into_dyn;pub use error::EmbeddingError;
Modules§
- erased
- Type erasure for
EmbeddingProviderso callers can hold a singleArc<dyn EmbeddingProvider>regardless of which backend is configured. - error
EmbeddingErrormarker trait and a reference implementation.
Traits§
- Embedding
Provider - The seam between the tool-search engine and any concrete embedding backend.