pub async fn get_embedder() -> Box<dyn Embedder>Expand description
Resolve the configured embedder from settings.
Priority chain (first match wins):
OpenAICompatEmbedder— if the user explicitly configured a BYOK provider (semantic_embedding=true+ a realembedding_provider_url, i.e. not the cloud-managed sentinel). This takes precedence over a stored cloud token: a user who randifflore embeddings setupto bring their own key wants that provider used even while logged in.CloudEmbedder— if the user is logged in to cloud. Best-effort: we don’t probe the network here, we just trust the stored token. On request failure the caller falls back to local SHA1 viaembed_text_async.Sha1Embedder— deterministic offline fallback.
Falls back to Sha1Embedder on any settings error, so callers never
have to deal with embedder construction failures. Runtime paths should
treat SHA1 as a degraded fallback after cloud/BYOK retries, never as the
preferred path when cloud or BYOK is available. probe_active_embedder
mirrors this same order — keep the two in sync.