Skip to main content

load_backend

Function load_backend 

Source
pub fn load_backend(
    kind: BackendKind,
    model_repo: &str,
    device_hint: DeviceHint,
) -> Result<Box<dyn EmbedBackend>>
Expand description

Construct an embedding backend of the given kind.

Downloads model weights on first use via hf-hub. The device_hint is advisory — backends that don’t support GPU fall back to CPU.

§Errors

Returns an error if the requested backend was not compiled in (missing feature flag) or if model loading fails.