pub struct TieredEngine { /* private fields */ }Expand description
Tiered embedding engine: fast writes via static backend, quality reads via transformer.
Enabled with DAKERA_TIERED=1. When disabled, embed_for_write and embed_for_read
both delegate to the single quality backend (no tier split).
Implementations§
Source§impl TieredEngine
impl TieredEngine
Sourcepub async fn new(config: &ModelConfig) -> Result<Self>
pub async fn new(config: &ModelConfig) -> Result<Self>
Build from the given ModelConfig.
When DAKERA_TIERED=1, initialises both the static fast backend and the
transformer quality backend. Otherwise both slots use the quality backend.
Sourcepub async fn embed_for_write(&self, texts: &[String]) -> Result<Vec<Vec<f32>>>
pub async fn embed_for_write(&self, texts: &[String]) -> Result<Vec<Vec<f32>>>
Embed texts for storage (write path).
Uses the fast backend when tiered mode is enabled, quality backend otherwise. Returns embeddings suitable for indexing — may be static Model2Vec quality.
Sourcepub async fn embed_for_read(&self, texts: &[String]) -> Result<Vec<Vec<f32>>>
pub async fn embed_for_read(&self, texts: &[String]) -> Result<Vec<Vec<f32>>>
Embed texts for retrieval scoring (read path).
Always uses the quality backend so recall scoring is at transformer quality.
Sourcepub async fn embed_query(&self, query: &str) -> Result<Vec<f32>>
pub async fn embed_query(&self, query: &str) -> Result<Vec<f32>>
Embed a single query for retrieval.
Sourcepub fn is_tiered(&self) -> bool
pub fn is_tiered(&self) -> bool
Whether the tiered split is active (fast writes / quality reads).
Sourcepub fn fast_dimension(&self) -> usize
pub fn fast_dimension(&self) -> usize
Dimension of the fast (write) backend.
Sourcepub fn quality_dimension(&self) -> usize
pub fn quality_dimension(&self) -> usize
Dimension of the quality (read) backend.
Sourcepub fn fast_backend(&self) -> Arc<dyn EmbeddingBackend>
pub fn fast_backend(&self) -> Arc<dyn EmbeddingBackend>
Expose fast backend for background re-embedding tasks.
Sourcepub fn quality_backend(&self) -> Arc<dyn EmbeddingBackend>
pub fn quality_backend(&self) -> Arc<dyn EmbeddingBackend>
Expose quality backend for background re-embedding tasks.
Auto Trait Implementations§
impl Freeze for TieredEngine
impl !RefUnwindSafe for TieredEngine
impl Send for TieredEngine
impl Sync for TieredEngine
impl Unpin for TieredEngine
impl UnsafeUnpin for TieredEngine
impl !UnwindSafe for TieredEngine
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