pub struct DynEmbedder { /* private fields */ }
Expand description
A trait object for an embedder.
Trait Implementations§
Source§impl Embedder for DynEmbedder
impl Embedder for DynEmbedder
Source§type Error = Box<dyn Error + Send + Sync>
type Error = Box<dyn Error + Send + Sync>
The error type that can occur when embedding a string.
Source§fn embed_string(
&self,
input: String,
) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
fn embed_string( &self, input: String, ) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
Embed some text into a vector space.
Source§fn embed_vec(
&self,
inputs: Vec<String>,
) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
fn embed_vec( &self, inputs: Vec<String>, ) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
Embed a
Vec<String>
into a vector space. Returns a list of embeddings in the same order as the inputs.Source§fn embed_for(
&self,
input: EmbeddingInput,
) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
fn embed_for( &self, input: EmbeddingInput, ) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
Embed a
EmbeddingInput
into a vector spaceSource§fn embed_vec_for(
&self,
inputs: Vec<EmbeddingInput>,
) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
fn embed_vec_for( &self, inputs: Vec<EmbeddingInput>, ) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
Embed a
Vec<String>
into a vector space. Returns a list of embeddings in the same order as the inputs.Auto Trait Implementations§
impl Freeze for DynEmbedder
impl !RefUnwindSafe for DynEmbedder
impl Send for DynEmbedder
impl Sync for DynEmbedder
impl Unpin for DynEmbedder
impl !UnwindSafe for DynEmbedder
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<M> EmbedderCacheExt for Mwhere
M: Embedder,
impl<M> EmbedderCacheExt for Mwhere
M: Embedder,
Source§fn cached(self, cache_size: NonZeroUsize) -> CachedEmbeddingModel<Self>where
Self: Sized,
fn cached(self, cache_size: NonZeroUsize) -> CachedEmbeddingModel<Self>where
Self: Sized,
Wrap the embedder with a cache for previously computed embeddings. Read more
Source§impl<E> EmbedderExt for Ewhere
E: Embedder,
impl<E> EmbedderExt for Ewhere
E: Embedder,
Source§fn into_any_embedder(self) -> DynEmbedder
fn into_any_embedder(self) -> DynEmbedder
Convert this embedder into an embedder trait object.
Source§fn embed(
&self,
input: impl ToString,
) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
fn embed( &self, input: impl ToString, ) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
Embed some text into a vector space
Source§fn embed_query(
&self,
input: impl ToString,
) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
fn embed_query( &self, input: impl ToString, ) -> impl Future<Output = Result<Embedding, Self::Error>> + Send
Embed a query into a vector space
Source§fn embed_batch(
&self,
inputs: impl IntoIterator<Item = impl ToString>,
) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
fn embed_batch( &self, inputs: impl IntoIterator<Item = impl ToString>, ) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
Embed a batch of text into a vector space. Returns a list of embeddings in the same order as the inputs.
Source§fn embed_batch_for(
&self,
inputs: impl IntoIterator<Item = EmbeddingInput>,
) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
fn embed_batch_for( &self, inputs: impl IntoIterator<Item = EmbeddingInput>, ) -> impl Future<Output = Result<Vec<Embedding>, Self::Error>> + Send
Embed a batch of
EmbeddingInput
into a vector space. Returns a list of embeddings in the same order as the inputs.