use anyhow::Result;
pub struct EmbeddingResult {
pub prompt_tokens: u32,
pub total_tokens: u32,
pub embeddings: Vec<Vec<f32>>,
}
#[derive(Default, Debug)]
pub struct GenerateResult {
pub prompt_tokens: u32,
pub completion_tokens: u32,
pub total_tokens: u32,
pub generation: String,
}
pub struct ChatResult {
pub role: String,
pub content: String,
}
#[async_trait::async_trait]
pub trait LLM: Send + Sync {
async fn embedding(&self, inputs: Vec<String>) -> Result<EmbeddingResult>;
async fn generate(&self, input: &str) -> Result<GenerateResult>;
async fn chat(&self, _input: Vec<String>) -> Result<Vec<ChatResult>> {
unimplemented!("")
}
}