Skip to main content

Module embedding

Module embedding 

Source
Expand description

Embedding engine abstraction and providers.

Structs§

EmbeddingConfig
Unified embedding configuration.
MockEmbeddingEngine
A mock embedding engine.
ModelUrls
HuggingFace Hub URLs for supported models
OllamaEmbeddingEngine
Embedding engine that calls the Ollama /api/embed HTTP endpoint.
OnnxEmbeddingConfig
ONNX-specific configuration.
OnnxEmbeddingEngine
ONNX-based embedding engine for local inference
OpenAICompatibleEmbeddingEngine
Embedding engine that calls an OpenAI-compatible /v1/embeddings HTTP endpoint.

Enums§

EmbeddingError
Error type for embedding engine operations.
EmbeddingProvider
Selects the backend used to generate embeddings.

Traits§

EmbeddingEngine
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 true if s is non-empty after stripping ASCII whitespace.
sanitize_embedding_inputs
Replace empty/whitespace-only strings with "." to prevent API errors.

Type Aliases§

EmbeddingResult
Convenience Result alias for embedding engine operations.