Generate a semantic embedding for text using an explicit model selection.
(text: &str, model: TextEmbeddingModel)
| 115 | |
| 116 | /// Generate a semantic embedding for text using an explicit model selection. |
| 117 | pub 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 | /// |
no test coverage detected