pub struct Embed { /* private fields */ }Expand description
A transformer that can generate embeddings for an Node
This file defines the Embed struct and its implementation of the BatchableTransformer trait.
Implementations§
source§impl Embed
impl Embed
sourcepub fn new(model: impl EmbeddingModel + 'static) -> Self
pub fn new(model: impl EmbeddingModel + 'static) -> Self
pub fn with_concurrency(self, concurrency: usize) -> Self
sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Trait Implementations§
source§impl BatchableTransformer for Embed
impl BatchableTransformer for Embed
source§fn batch_transform<'life0, 'async_trait>(
&'life0 self,
nodes: Vec<Node>,
) -> Pin<Box<dyn Future<Output = IndexingStream> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_transform<'life0, 'async_trait>(
&'life0 self,
nodes: Vec<Node>,
) -> Pin<Box<dyn Future<Output = IndexingStream> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transforms a batch of Node objects by generating embeddings for them.
§Parameters
nodes- A vector ofNodeobjects to be transformed.
§Returns
An IndexingStream containing the transformed Node objects with their embeddings.
§Errors
If the embedding process fails, the function returns a stream with the error.
source§fn concurrency(&self) -> Option<usize>
fn concurrency(&self) -> Option<usize>
Overrides the default concurrency of the pipeline
source§fn batch_size(&self) -> Option<usize>
fn batch_size(&self) -> Option<usize>
Overrides the default batch size of the pipeline
fn name(&self) -> &'static str
source§impl WithBatchIndexingDefaults for Embed
impl WithBatchIndexingDefaults for Embed
fn with_indexing_defaults(&mut self, _indexing_defaults: IndexingDefaults)
source§impl WithIndexingDefaults for Embed
impl WithIndexingDefaults for Embed
fn with_indexing_defaults(&mut self, _indexing_defaults: IndexingDefaults)
Auto Trait Implementations§
impl Freeze for Embed
impl !RefUnwindSafe for Embed
impl Send for Embed
impl Sync for Embed
impl Unpin for Embed
impl !UnwindSafe for Embed
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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