vyctor 0.1.0

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

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

/// A document to be reranked
#[derive(Debug, Clone)]
pub struct DocumentToRerank {
    /// Unique identifier for the document (used to track after reranking)
    pub id: usize,
    /// The document content to evaluate for relevance
    pub content: String,
}

/// Result of a reranking operation for a single document
#[derive(Debug, Clone)]
pub struct RerankResult {
    /// The original document ID
    pub id: usize,
    /// Relevance score (higher = more relevant)
    pub relevance_score: f64,
}

/// Trait for reranker providers
#[async_trait]
pub trait Reranker: Send + Sync + Debug {
    /// Rerank documents based on their relevance to a query
    ///
    /// Takes a query and a list of documents, returns the documents
    /// with relevance scores, sorted by descending relevance.
    async fn rerank(
        &self,
        query: &str,
        documents: Vec<DocumentToRerank>,
    ) -> Result<Vec<RerankResult>>;

    /// Get the name of the model being used
    fn model_name(&self) -> &str;
}