pub struct BatchEmbeddingProvider { /* private fields */ }Expand description
Wraps any EmbeddingProvider to expose a convenience batch method.
Delegates to the inner provider’s embed_batch (which by default calls
embed sequentially). Providers that support native batching can override
embed_batch on the trait for better performance.
Implementations§
Source§impl BatchEmbeddingProvider
impl BatchEmbeddingProvider
Sourcepub fn new(inner: Arc<dyn EmbeddingProvider>) -> Self
pub fn new(inner: Arc<dyn EmbeddingProvider>) -> Self
Wrap an existing provider for batch operations.
Sourcepub async fn embed_batch(&self, texts: &[&str]) -> ArgentorResult<Vec<Vec<f32>>>
pub async fn embed_batch(&self, texts: &[&str]) -> ArgentorResult<Vec<Vec<f32>>>
Embed multiple texts, returning one vector per input.
Trait Implementations§
Source§impl EmbeddingProvider for BatchEmbeddingProvider
impl EmbeddingProvider for BatchEmbeddingProvider
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Compute embedding vector for a single text.
Source§fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Compute embeddings for a batch of texts.
Auto Trait Implementations§
impl Freeze for BatchEmbeddingProvider
impl !RefUnwindSafe for BatchEmbeddingProvider
impl Send for BatchEmbeddingProvider
impl Sync for BatchEmbeddingProvider
impl Unpin for BatchEmbeddingProvider
impl UnsafeUnpin for BatchEmbeddingProvider
impl !UnwindSafe for BatchEmbeddingProvider
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