pub struct SimpleEmbedder { /* private fields */ }
Implementations§
Source§impl SimpleEmbedder
impl SimpleEmbedder
pub fn new(api_key: String) -> Self
pub fn new_ollama(base_url: String, model: String) -> Self
pub fn new_mock() -> Self
pub fn with_model(self, model: String) -> Self
pub fn with_base_url(self, base_url: String) -> Self
Sourcepub async fn generate_embedding(&self, text: &str) -> Result<Vec<f32>>
pub async fn generate_embedding(&self, text: &str) -> Result<Vec<f32>>
Generate embedding for text with automatic retry
Sourcepub async fn generate_embeddings_batch(
&self,
texts: &[String],
) -> Result<Vec<Vec<f32>>>
pub async fn generate_embeddings_batch( &self, texts: &[String], ) -> Result<Vec<Vec<f32>>>
Generate embeddings for multiple texts in batch
Sourcepub fn embedding_dimension(&self) -> usize
pub fn embedding_dimension(&self) -> usize
Get the dimension of embeddings for this model
Sourcepub fn provider(&self) -> &EmbeddingProvider
pub fn provider(&self) -> &EmbeddingProvider
Get the provider type
Sourcepub async fn auto_configure(base_url: String) -> Result<Self>
pub async fn auto_configure(base_url: String) -> Result<Self>
Auto-detect and configure the best available embedding model
Sourcepub async fn generate_embedding_with_fallback(
&self,
text: &str,
) -> Result<Vec<f32>>
pub async fn generate_embedding_with_fallback( &self, text: &str, ) -> Result<Vec<f32>>
Generate embedding with automatic fallback to alternative models
Sourcepub async fn health_check(&self) -> Result<EmbeddingHealth>
pub async fn health_check(&self) -> Result<EmbeddingHealth>
Health check for the embedding service
Trait Implementations§
Source§impl Clone for SimpleEmbedder
impl Clone for SimpleEmbedder
Source§fn clone(&self) -> SimpleEmbedder
fn clone(&self) -> SimpleEmbedder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SimpleEmbedder
impl Debug for SimpleEmbedder
Source§impl EmbeddingService for SimpleEmbedder
impl EmbeddingService for SimpleEmbedder
fn generate_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for SimpleEmbedder
impl !RefUnwindSafe for SimpleEmbedder
impl Send for SimpleEmbedder
impl Sync for SimpleEmbedder
impl Unpin for SimpleEmbedder
impl !UnwindSafe for SimpleEmbedder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more