pub enum EmbeddingProviderEnum {
Gemini(GeminiClient),
OpenAI(OpenAIClient),
Ollama(OllamaClient),
}Expand description
Unified embedding provider that wraps concrete implementations.
This enum allows runtime selection of embedding providers while
implementing the EmbeddingProvider trait.
Variants§
Gemini(GeminiClient)
Google Gemini embedding provider (768 dimensions).
OpenAI(OpenAIClient)
OpenAI embedding provider (1536 or 3072 dimensions).
Ollama(OllamaClient)
Ollama local embedding provider (default 768 dimensions).
Implementations§
Source§impl EmbeddingProviderEnum
impl EmbeddingProviderEnum
Sourcepub fn openai(api_key: &str) -> Result<Self, AppError>
pub fn openai(api_key: &str) -> Result<Self, AppError>
Creates an OpenAI embedding provider with the default model.
Uses text-embedding-3-small (1536 dimensions).
§Arguments
api_key- OpenAI API key (starts withsk-)
Sourcepub fn openai_with_model(api_key: &str, model: &str) -> Result<Self, AppError>
pub fn openai_with_model(api_key: &str, model: &str) -> Result<Self, AppError>
Creates an OpenAI embedding provider with a specific model.
§Arguments
api_key- OpenAI API keymodel- Model name (e.g.,text-embedding-3-large)
Sourcepub fn ollama() -> Result<Self, AppError>
pub fn ollama() -> Result<Self, AppError>
Creates an Ollama embedding provider with default settings.
Uses nomic-embed-text model at http://localhost:11434.
Sourcepub fn ollama_with_config(
model: &str,
endpoint: Option<&str>,
) -> Result<Self, AppError>
pub fn ollama_with_config( model: &str, endpoint: Option<&str>, ) -> Result<Self, AppError>
Creates an Ollama embedding provider with custom configuration.
Sourcepub fn from_config(config: &EmbeddingConfig) -> Result<Self>
pub fn from_config(config: &EmbeddingConfig) -> Result<Self>
Creates an embedding provider from configuration.
Parses the provider type and initializes the appropriate client with the given API key and optional model override.
Trait Implementations§
Source§impl Clone for EmbeddingProviderEnum
impl Clone for EmbeddingProviderEnum
Source§fn clone(&self) -> EmbeddingProviderEnum
fn clone(&self) -> EmbeddingProviderEnum
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more