Skip to main content

maybe_embed

Function maybe_embed 

Source
pub async fn maybe_embed(
    service: Option<&dyn EmbeddingService>,
    content: &str,
) -> (Option<Vec<f32>>, Option<String>)
Expand description

Attempt to generate an embedding for content using the optional service.

Returns (Some(vector), Some(model_name)) on success, (None, None) when the service is absent or the call fails (graceful degradation).