pub mod report;
pub use report::{
AggregateDelta, CalibrationAggregate, CalibrationEvalReport, CalibrationPrediction,
CohortCalibration, CompareEvalReport, DeltaSignificance, EmbeddingEvalReport,
InferenceAggregate, InferenceEvalReport, MetricDelta, MetricSignificance, PerQueryRecord,
PerRecordCalibration, PerRecordPrediction, TableEvalReport,
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum EvalCalibrationShape {
Gaussian,
Sample,
}
impl std::fmt::Display for EvalCalibrationShape {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Gaussian => write!(f, "calibration_gaussian"),
Self::Sample => write!(f, "calibration_sample"),
}
}
}
impl std::str::FromStr for EvalCalibrationShape {
type Err = jammi_db::error::JammiError;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
match s {
"gaussian" => Ok(Self::Gaussian),
"sample" => Ok(Self::Sample),
other => Err(jammi_db::error::JammiError::Other(format!(
"Unknown calibration shape '{other}'. Expected: gaussian, sample"
))),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum EvalTask {
Classification,
Ner,
}
impl std::fmt::Display for EvalTask {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Classification => write!(f, "classification"),
Self::Ner => write!(f, "ner"),
}
}
}
impl std::str::FromStr for EvalTask {
type Err = jammi_db::error::JammiError;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
match s {
"classification" => Ok(Self::Classification),
"ner" => Ok(Self::Ner),
other => Err(jammi_db::error::JammiError::Other(format!(
"Unknown eval task '{other}'. Expected: classification, ner"
))),
}
}
}