pub enum EmbeddingModel {
MiniLM,
BgeSmall,
E5Small,
}Expand description
Supported embedding models.
Variants§
MiniLM
all-MiniLM-L6-v2 - Fast and efficient, good for general use
- Dimensions: 384
- Max tokens: 256
- Speed: Fastest
BgeSmall
BAAI/bge-small-en-v1.5 - Balanced quality and speed
- Dimensions: 384
- Max tokens: 512
- Speed: Medium
E5Small
intfloat/e5-small-v2 - Higher quality embeddings
- Dimensions: 384
- Max tokens: 512
- Speed: Medium
Implementations§
Source§impl EmbeddingModel
impl EmbeddingModel
Sourcepub fn max_seq_length(&self) -> usize
pub fn max_seq_length(&self) -> usize
Get the maximum sequence length (in tokens).
Sourcepub fn query_prefix(&self) -> Option<&'static str>
pub fn query_prefix(&self) -> Option<&'static str>
Get the query prefix for models that require it. Some models like E5 require a prefix for queries vs documents.
Sourcepub fn document_prefix(&self) -> Option<&'static str>
pub fn document_prefix(&self) -> Option<&'static str>
Get the document/passage prefix for models that require it.
Sourcepub fn use_mean_pooling(&self) -> bool
pub fn use_mean_pooling(&self) -> bool
Whether this model uses mean pooling (vs CLS token).
Sourcepub fn normalize_embeddings(&self) -> bool
pub fn normalize_embeddings(&self) -> bool
Whether embeddings should be normalized.
Sourcepub fn tokens_per_second_cpu(&self) -> usize
pub fn tokens_per_second_cpu(&self) -> usize
Get approximate tokens per second on CPU (for estimation).
Sourcepub fn all() -> &'static [EmbeddingModel]
pub fn all() -> &'static [EmbeddingModel]
List all available models.
Trait Implementations§
Source§impl Clone for EmbeddingModel
impl Clone for EmbeddingModel
Source§fn clone(&self) -> EmbeddingModel
fn clone(&self) -> EmbeddingModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingModel
impl Debug for EmbeddingModel
Source§impl Default for EmbeddingModel
impl Default for EmbeddingModel
Source§fn default() -> EmbeddingModel
fn default() -> EmbeddingModel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EmbeddingModel
impl<'de> Deserialize<'de> for EmbeddingModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for EmbeddingModel
impl Display for EmbeddingModel
Source§impl Hash for EmbeddingModel
impl Hash for EmbeddingModel
Source§impl PartialEq for EmbeddingModel
impl PartialEq for EmbeddingModel
Source§impl Serialize for EmbeddingModel
impl Serialize for EmbeddingModel
impl Copy for EmbeddingModel
impl Eq for EmbeddingModel
impl StructuralPartialEq for EmbeddingModel
Auto Trait Implementations§
impl Freeze for EmbeddingModel
impl RefUnwindSafe for EmbeddingModel
impl Send for EmbeddingModel
impl Sync for EmbeddingModel
impl Unpin for EmbeddingModel
impl UnsafeUnpin for EmbeddingModel
impl UnwindSafe for EmbeddingModel
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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