use tokio::sync::oneshot;
use uuid::Uuid;
#[derive(Debug)]
pub struct WorkerRequest {
pub id: Uuid,
pub model: String,
pub input: TextInput,
pub response_tx: oneshot::Sender<WorkerResponse>,
}
#[derive(Debug)]
pub struct WorkerResponse {
pub embeddings: Vec<Vec<f32>>,
pub token_count: usize,
pub processing_time_ms: u64,
}
#[derive(Debug, Clone)]
pub enum TextInput {
Single(String),
Batch(Vec<String>),
}
impl TextInput {
pub fn len(&self) -> usize {
match self {
Self::Single(_) => 1,
Self::Batch(texts) => texts.len(),
}
}
pub fn is_empty(&self) -> bool {
match self {
Self::Single(text) => text.is_empty(),
Self::Batch(texts) => texts.is_empty(),
}
}
}