Skip to main content

Crate erio_embedding

Crate erio_embedding 

Source
Expand description

§erio-embedding

erio-embedding defines embedding engine abstractions and concrete implementations used by Erio retrieval pipelines.

It supports local model execution via GemmaEmbedding and includes additional configuration/types for embedding tasks.

§Quickstart

Set ERIO_MODEL_DIR to a directory containing local model assets before constructing GemmaEmbedding.

export ERIO_MODEL_DIR=/absolute/path/to/local/embedding-model
use erio_embedding::{EmbeddingConfig, EmbeddingEngine, GemmaEmbedding};

let _engine: Box<dyn EmbeddingEngine> = Box::new(GemmaEmbedding::new(EmbeddingConfig::default())?);

§docs.rs behavior

Real usage requires ERIO_MODEL_DIR to point to valid local model assets. During docs.rs builds (DOCS_RS=1), the build script skips model download and validation by setting ERIO_MODEL_DIR to a dummy directory, so docs/examples are for API reference and are not runnable there.

§API tour

  • Engine API: EmbeddingEngine
  • Implementations: GemmaEmbedding, RemoteEmbedding
  • Config/types: EmbeddingConfig, TaskType
  • Error type: EmbeddingError
  • Modules: engine, gemma, remote, config, task, model, error

§Compatibility

  • MSRV: Rust 1.93
  • License: Apache-2.0 Erio Embedding - embedding engine abstraction for computing vector embeddings.

Local embedding engines (e.g. GemmaEmbedding) load model files from ERIO_MODEL_DIR. The embedding crate’s build script fetches the default model assets at build time.

Re-exports§

pub use config::EmbeddingConfig;
pub use engine::EmbeddingEngine;
pub use error::EmbeddingError;
pub use gemma::GemmaEmbedding;
pub use remote::RemoteEmbedding;
pub use task::TaskType;

Modules§

config
Configuration for embedding engines.
engine
Embedding engine trait definition.
error
Embedding-specific error types.
gemma
Local embedding engine using the GGUF-quantized EmbeddingGemma model.
model
GGUF-quantized EmbeddingGemma model internals.
remote
Remote embedding engine calling an OpenAI-compatible embedding API.
task
Task type definitions and prompt formatting for embedding models.