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
Sets the batch size for the transformer. If the batch size is not set, the transformer will use the default batch size set by the pipeline # Parameters
batch_size
- The batch size to use for the transformer.
§Returns
A new instance of Embed
.
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 ofNode
objects 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§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