rusty-llm-jury 0.1.0

A Rust CLI tool for estimating success rates when using LLM judges for evaluation
Documentation
//! Error types for the llm-jury library.

use thiserror::Error;

/// Main error type for the library
#[derive(Error, Debug)]
pub enum JudgyError {
    #[error("Input validation error: {0}")]
    InputValidation(String),

    #[error("Judge accuracy too low for correction: TPR + TNR = {tpr_plus_tnr:.3} <= 1. Judge must be better than random")]
    JudgeAccuracyTooLow { tpr_plus_tnr: f64 },

    #[error("Bootstrap error: {0}")]
    Bootstrap(String),

    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("CSV error: {0}")]
    Csv(#[from] csv::Error),

    #[error("JSON error: {0}")]
    Json(#[from] serde_json::Error),

    #[error("Parse error: {0}")]
    Parse(String),

    #[error("Configuration error: {0}")]
    Config(String),
}

/// Result type alias for convenience
pub type Result<T> = std::result::Result<T, JudgyError>;

impl JudgyError {
    /// Create a new input validation error
    pub fn input_validation(msg: impl Into<String>) -> Self {
        Self::InputValidation(msg.into())
    }

    /// Create a new bootstrap error
    pub fn bootstrap(msg: impl Into<String>) -> Self {
        Self::Bootstrap(msg.into())
    }

    /// Create a new parse error
    pub fn parse(msg: impl Into<String>) -> Self {
        Self::Parse(msg.into())
    }

    /// Create a new configuration error
    pub fn config(msg: impl Into<String>) -> Self {
        Self::Config(msg.into())
    }
}