Expand description
Embedding engine abstraction and providers.
Structs§
- Embedding
Config - Unified embedding configuration.
- Mock
Embedding Engine - A mock embedding engine.
- Model
Urls - HuggingFace Hub URLs for supported models
- Ollama
Embedding Engine - Embedding engine that calls the Ollama
/api/embedHTTP endpoint. - Onnx
Embedding Config - ONNX-specific configuration.
- Onnx
Embedding Engine - ONNX-based embedding engine for local inference
- OpenAI
Compatible Embedding Engine - Embedding engine that calls an OpenAI-compatible
/v1/embeddingsHTTP endpoint.
Enums§
- Embedding
Error - Error type for embedding engine operations.
- Embedding
Provider - Selects the backend used to generate embeddings.
Traits§
- Embedding
Engine - Core trait for text embedding engines
Functions§
- download_
model - Download both model and tokenizer for a specific configuration.
- ensure_
model_ exists - Ensure a model file exists, downloading it if necessary.
- ensure_
tokenizer_ exists - Ensure a tokenizer file exists, downloading it if necessary.
- handle_
embedding_ response - Replace embeddings for originally-invalid inputs with zero vectors.
- is_
embeddable - Returns
trueifsis non-empty after stripping ASCII whitespace. - sanitize_
embedding_ inputs - Replace empty/whitespace-only strings with
"."to prevent API errors.
Type Aliases§
- Embedding
Result - Convenience
Resultalias for embedding engine operations.