MCPcopy Create free account
hub / github.com/acking-you/static_flow / embed_text_with_model

Function embed_text_with_model

crates/embedding/src/text.rs:117–129  ·  view source on GitHub ↗

Generate a semantic embedding for text using an explicit model selection.

(text: &str, model: TextEmbeddingModel)

Source from the content-addressed store, hash-verified

115
116/// Generate a semantic embedding for text using an explicit model selection.
117pub fn embed_text_with_model(text: &str, model: TextEmbeddingModel) -> anyhow::Result<Vec<f32>> {
118 #[cfg(not(target_arch = "wasm32"))]
119 {
120 fastembed_embedding(text, model)
121 }
122
123 #[cfg(target_arch = "wasm32")]
124 {
125 let _ = text;
126 let _ = model;
127 anyhow::bail!("text embedding is not supported on wasm32")
128 }
129}
130
131/// Detect language with a lightweight heuristic.
132///

Callers 2

embed_text_with_languageFunction · 0.85

Calls 1

fastembed_embeddingFunction · 0.85

Tested by

no test coverage detected