kernelx_core/capabilities/embed.rs
1use crate::{capabilities::HasCapability, models::ModelConfig, Result};
2use async_trait::async_trait;
3
4#[async_trait]
5pub trait Embed: HasCapability {
6 async fn embed_data(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>> {
7 self.embed_impl(self.model_id(), texts, self.config()).await
8 }
9
10 #[doc(hidden)]
11 async fn embed_impl(
12 &self,
13 model: &str,
14 texts: Vec<String>,
15 config: &ModelConfig,
16 ) -> Result<Vec<Vec<f32>>>;
17}