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 onnx_repo_id(&self) -> &'static str
pub fn onnx_repo_id(&self) -> &'static str
Get the HuggingFace repository ID hosting the ONNX INT8 model for this embedding model.
These are Xenova-hosted Optimum ONNX exports — quantized INT8, pre-built, no conversion needed. MiniLM: 23 MB, BGE-small: 35 MB, E5-small: 35 MB.
Sourcepub fn onnx_filename(&self) -> &'static str
pub fn onnx_filename(&self) -> &'static str
Get the ONNX model filename (path within the repository).
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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>,
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
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.