use async_trait::async_trait;
use crate::error::Result;
#[async_trait]
pub trait EmbeddingBase: Send + Sync {
async fn embed(&self, text: &str) -> Result<Vec<f32>>;
async fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>> {
let mut results = Vec::with_capacity(texts.len());
for text in texts {
results.push(self.embed(text).await?);
}
Ok(results)
}
fn embedding_dims(&self) -> usize;
}