vyctor 0.1.0

A fast CLI tool for semantic file search using vector embeddings
Documentation
//! Trait definition for embedding providers

use anyhow::Result;
use async_trait::async_trait;
use std::fmt::Debug;

/// Result of an embedding operation
#[derive(Debug, Clone)]
pub struct EmbeddingResult {
    /// The embedding vector
    pub embedding: Vec<f32>,
    /// Number of tokens in the input (if available)
    #[allow(dead_code)]
    pub token_count: Option<usize>,
}

/// Trait for embedding providers
#[async_trait]
pub trait EmbeddingProvider: Send + Sync + Debug {
    /// Get the dimensions of embeddings produced by this provider
    #[allow(dead_code)]
    fn dimensions(&self) -> usize;

    /// Generate an embedding for a single text
    async fn embed(&self, text: &str) -> Result<EmbeddingResult>;

    /// Generate embeddings for multiple texts (batched)
    async fn embed_batch(&self, texts: &[String]) -> Result<Vec<EmbeddingResult>>;

    /// Get the name of the model being used
    #[allow(dead_code)]
    fn model_name(&self) -> &str;
}