Skip to main content

Crate polyc_embeddings

Crate polyc_embeddings 

Source
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

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 EmbeddingProvider so callers can hold a single Arc<dyn EmbeddingProvider> regardless of which backend is configured.
error
EmbeddingError marker trait and a reference implementation.

Traits§

EmbeddingProvider
The seam between the tool-search engine and any concrete embedding backend.