Skip to main content

EmbeddingModel

Enum EmbeddingModel 

Source
#[non_exhaustive]
pub enum EmbeddingModel { BgeSmallEnV15, BgeBaseEnV15, BgeLargeEnV15, MultilingualE5Small, MultilingualE5Base, Qwen3Embedding0_6B, Qwen3Embedding4B, AllMiniLmL6V2, ParaphraseMultilingualMiniLmL12V2, TextEmbedding3Small, }
Expand description

Stable: external consumers may depend on this; breaking changes require a SemVer bump.

Registry of supported local and remote embedding models.

See docs/model.md for model capabilities and identity rules.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BgeSmallEnV15

BGE small English v1.5 (384 dimensions) - fast and efficient.

§

BgeBaseEnV15

BGE base English v1.5 (768 dimensions) - balanced quality/speed.

§

BgeLargeEnV15

BGE large English v1.5 (1024 dimensions) - highest quality local.

§

MultilingualE5Small

Multilingual E5 small (384 dimensions) - multilingual, same arch as BGE.

§

MultilingualE5Base

Multilingual E5 base (768 dimensions) - best multilingual quality/speed.

§

Qwen3Embedding0_6B

Qwen3-Embedding-0.6B (1024 dimensions) - multilingual, decoder-only, GPU-accelerated.

§

Qwen3Embedding4B

Qwen3-Embedding-4B (2560 dimensions, MRL-capable) - multilingual, decoder-only, GPU-accelerated.

§

AllMiniLmL6V2

all-MiniLM-L6-v2 (384 dimensions) - BERT-class, WordPiece tokenizer, sentence-transformers.

§

ParaphraseMultilingualMiniLmL12V2

paraphrase-multilingual-MiniLM-L12-v2 (384 dimensions) - multilingual, XLM-R base, sentence-transformers.

§

TextEmbedding3Small

OpenAI text-embedding-3-small (1536 dimensions) - remote API.

Implementations§

Source§

impl EmbeddingModel

Source

pub const fn native_dimensions(&self) -> usize

Stable: get the native (full-resolution) output dimension of this model’s embeddings.

Returns the model’s intrinsic dimension regardless of any MRL truncation. For MRL-capable models with a configured truncation, use ModelConfig::dimensions().

Source

pub const fn dimensions(&self) -> usize

Stable: get this model’s native output dimension.

See docs/model.md for active-dimension selection.

Source

pub const fn is_local(&self) -> bool

Stable: check if this model can run locally (via lattice-inference).

Source

pub const fn is_remote(&self) -> bool

Stable: check if this model requires a remote API.

Source

pub const fn max_input_tokens(&self) -> usize

Stable: conservative maximum input tokens for chunking and truncation.

See docs/model.md for per-model limits.

Source

pub const fn query_instruction(&self) -> Option<&'static str>

Stable: query instruction prefix for asymmetric retrieval, when required.

See docs/model.md for prompt policy and vector-space implications.

Source

pub const fn document_instruction(&self) -> Option<&'static str>

Stable: document instruction prefix for asymmetric retrieval, when required.

See docs/model.md for prompt policy and vector-space implications.

Source

pub const fn max_instruction_bytes(&self) -> usize

Stable: byte length of this model’s longest retrieval instruction.

Zero for symmetric models, which take no prefix at all.

Callers apply an instruction to caller-supplied text, so text that has already been prepared is longer than what the caller passed by at most this many bytes. Length guards that run on prepared text size themselves with this; guards that run on caller text use MAX_TEXT_BYTES exactly.

Source

pub const fn model_id(&self) -> &'static str

Stable: get the model identifier (HuggingFace ID or provider/model).

Source

pub const fn supports_output_dim(&self) -> bool

Stable: whether this model supports configurable output dimensions (MRL/Matryoshka).

Source

pub const fn bert_pooling(&self) -> Option<BertPooling>

Stable: BERT pooling strategy for this model, or None for non-BERT paths.

See docs/model.md for pooling routing.

Source

pub const fn key_version(&self) -> &'static str

Stable: embedding key revision string for this model family.

Trait Implementations§

Source§

impl Clone for EmbeddingModel

Source§

fn clone(&self) -> EmbeddingModel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EmbeddingModel

Source§

impl Debug for EmbeddingModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EmbeddingModel

Source§

fn default() -> EmbeddingModel

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for EmbeddingModel

Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for EmbeddingModel

Source§

impl FromStr for EmbeddingModel

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Stable: parse a normalized canonical name, alias, or supported provider identifier.

See docs/model.md for accepted forms and persistence guidance.

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

impl Hash for EmbeddingModel

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EmbeddingModel

Source§

fn eq(&self, other: &EmbeddingModel) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for EmbeddingModel

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EmbeddingModel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more