pub enum EmbeddingRole {
Query,
Passage,
Generic,
}Expand description
Stable: role of text in asymmetric retrieval.
Models trained with asymmetric objectives (E5, Qwen3-Embedding) use different prompt prefixes for queries vs documents. Providing the wrong role causes the embedding to land in the wrong region of the model’s retrieval space, degrading retrieval quality.
Use EmbeddingService::embed_query / EmbeddingService::embed_passage to
apply the correct prefix automatically. The role is also included in the cache
key so that embed_query("hello") and embed_passage("hello") are stored as
separate entries even when the raw text is identical.
Variants§
Query
Query / question text — may receive a query-side prompt prefix.
Passage
Document / passage text — may receive a passage-side prompt prefix.
Generic
Generic text with no role-specific prefix (backwards-compatible default).
Trait Implementations§
Source§impl Clone for EmbeddingRole
impl Clone for EmbeddingRole
Source§fn clone(&self) -> EmbeddingRole
fn clone(&self) -> EmbeddingRole
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmbeddingRole
impl Debug for EmbeddingRole
Source§impl Hash for EmbeddingRole
impl Hash for EmbeddingRole
Source§impl PartialEq for EmbeddingRole
impl PartialEq for EmbeddingRole
Source§fn eq(&self, other: &EmbeddingRole) -> bool
fn eq(&self, other: &EmbeddingRole) -> bool
self and other values to be equal, and is used by ==.impl Copy for EmbeddingRole
impl Eq for EmbeddingRole
impl StructuralPartialEq for EmbeddingRole
Auto Trait Implementations§
impl Freeze for EmbeddingRole
impl RefUnwindSafe for EmbeddingRole
impl Send for EmbeddingRole
impl Sync for EmbeddingRole
impl Unpin for EmbeddingRole
impl UnsafeUnpin for EmbeddingRole
impl UnwindSafe for EmbeddingRole
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<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
key and return true if they are equal.