Skip to main content

embed_via_backend

Function embed_via_backend 

Source
pub fn embed_via_backend(
    models_dir: &Path,
    text: &str,
    backend: &LlmBackendKind,
) -> Result<(Vec<f32>, LlmBackendKind), AppError>
Expand description

Embeds a single text via the given backend. Used by embed_with_fallback and exposed to allow direct one-shot selection without a chain. Embeds a single text via the given backend. Used by embed_with_fallback and exposed to allow direct one-shot selection without a chain.

BUG-003 / v1.0.85: returns (Vec<f32>, LlmBackendKind). The second element reports the backend that ACTUALLY executed the embedding, not the chain position requested by the caller. When LlmBackendKind::Codex is requested but codex is absent from PATH, LlmEmbedding::detect_available substitutes claude and the tuple carries LlmBackendKind::Claude so the operator sees the truth in envelope.backend_invoked.