pub enum SubEmbedder {
HuggingFace(Embedder),
OpenAi(Embedder),
UserProvided(Embedder),
Ollama(Embedder),
Rest(Embedder),
}Variants§
HuggingFace(Embedder)
An embedder based on running local models, fetched from the Hugging Face Hub.
OpenAi(Embedder)
An embedder based on making embedding queries against the OpenAI API.
UserProvided(Embedder)
An embedder based on the user providing the embeddings in the documents and queries.
Ollama(Embedder)
An embedder based on making embedding queries against an https://ollama.com embedding server.
Rest(Embedder)
An embedder based on making embedding queries against a generic JSON/REST embedding server.
Implementations§
Source§impl SubEmbedder
impl SubEmbedder
pub fn new( options: SubEmbedderOptions, cache_cap: usize, ) -> Result<Self, NewEmbedderError>
pub fn embed( &self, texts: Vec<String>, deadline: Option<Instant>, ) -> Result<Vec<Embedding>, EmbedError>
pub fn embed_one( &self, text: &str, deadline: Option<Instant>, ) -> Result<Embedding, EmbedError>
Sourcepub fn embed_index(
&self,
text_chunks: Vec<Vec<String>>,
threads: &ThreadPoolNoAbort,
) -> Result<Vec<Vec<Embedding>>, EmbedError>
pub fn embed_index( &self, text_chunks: Vec<Vec<String>>, threads: &ThreadPoolNoAbort, ) -> Result<Vec<Vec<Embedding>>, EmbedError>
Embed multiple chunks of texts.
Each chunk is composed of one or multiple texts.
Sourcepub fn embed_index_ref(
&self,
texts: &[&str],
threads: &ThreadPoolNoAbort,
) -> Result<Vec<Embedding>, EmbedError>
pub fn embed_index_ref( &self, texts: &[&str], threads: &ThreadPoolNoAbort, ) -> Result<Vec<Embedding>, EmbedError>
Non-owning variant of Self::embed_index.
Sourcepub fn chunk_count_hint(&self) -> usize
pub fn chunk_count_hint(&self) -> usize
Indicates the preferred number of chunks to pass to [Self::embed_chunks]
Sourcepub fn prompt_count_in_chunk_hint(&self) -> usize
pub fn prompt_count_in_chunk_hint(&self) -> usize
Indicates the preferred number of texts in a single chunk passed to Self::embed
pub fn uses_document_template(&self) -> bool
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Indicates the dimensions of a single embedding produced by the embedder.
Sourcepub fn distribution(&self) -> Option<DistributionShift>
pub fn distribution(&self) -> Option<DistributionShift>
An optional distribution used to apply an affine transformation to the similarity score of a document.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SubEmbedder
impl !RefUnwindSafe for SubEmbedder
impl Send for SubEmbedder
impl Sync for SubEmbedder
impl Unpin for SubEmbedder
impl !UnwindSafe for SubEmbedder
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
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> ⓘ
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> ⓘ
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