Skip to main content

Module backend

Module backend 

Source
Expand description

Pluggable embedding backend abstraction.

§Overview

The EmbeddingBackend trait decouples embedding generation from the transport layer (ONNX Runtime, Candle, static lookup, GGUF quantized). The engine selects a backend at startup via environment variables:

Env varBackend chosen
DAKERA_BACKEND=onnxOnnxBackend — production default (INT8 quantized)
DAKERA_BACKEND=candle[CandleBackend] — pure-Rust Candle (requires candle feature)
DAKERA_BACKEND=staticStaticBackend — Model2Vec static lookup (~500× faster ingest)
DAKERA_BACKEND=gguf[GgufBackend] — GGUF quantized via candle-gguf (requires candle feature)
(unset)OnnxBackend — same as onnx

All backends implement the same EmbeddingBackend trait so callers are fully backend-agnostic.

§Feature flags

  • candle — enables [CandleBackend] and [GgufBackend] (requires HuggingFace Candle crates)

The onnx and static backends are always compiled — they have no additional dependencies beyond what the dakera-inference crate already requires.

Re-exports§

pub use onnx::OnnxBackend;
pub use static_backend::StaticBackend;

Modules§

onnx
ONNX Runtime embedding backend.
static_backend
Model2Vec static embedding backend.

Enums§

BackendKind
Identifies which backend is active. Stored in HNSW node metadata so the background re-embed job knows which memories were indexed with a fast (static) embedding and need to be upgraded with the quality transformer.

Traits§

EmbeddingBackend
Core embedding backend trait. All backends must be Send + Sync so they can be held behind an Arc and called from async tasks.

Functions§

select_backend
Select an embedding backend based on environment variables.