pub struct BatchMetrics {
pub average_overall_score: Option<f32>,
pub average_safety_score: Option<f32>,
pub average_factuality_score: Option<f32>,
pub average_alignment_score: Option<f32>,
pub flagged_responses_count: usize,
pub critical_issues_count: usize,
pub responses_analyzed: usize,
pub performance_summary: Option<PerformanceAnalysisResult>,
/* private fields */
}Expand description
Aggregate view of one LLMDebugger::analyze_batch run.
Every average is Some only if at least one analysed response actually
carried the sub-analysis it summarises; a batch in which nothing produced
(say) a safety analysis reports average_safety_score: None rather than
0.0. Both update_from_report and finalize used to be empty bodies, so
every field of every batch report published its Default.
Fields§
§average_overall_score: Option<f32>Mean of every analysed response’s overall_score.
average_safety_score: Option<f32>Mean safety_score over the responses that carried a safety analysis.
average_factuality_score: Option<f32>Mean factuality_score over the responses that carried one. Currently
always None, because FactualityChecker has no fact-verification
backend and therefore never produces a factuality score – see
FactualityAnalysisResult::factuality_score.
average_alignment_score: Option<f32>Mean alignment_score over the responses that carried one. Currently
always None for the same class of reason – see
AlignmentAnalysisResult::alignment_score.
flagged_responses_count: usizeNumber of responses whose safety analysis flagged content or detected a harm category.
critical_issues_count: usizeNumber of responses whose safety analysis rated the risk
RiskLevel::Critical.
responses_analyzed: usizeNumber of responses folded in, set by Self::finalize.
performance_summary: Option<PerformanceAnalysisResult>Implementations§
Source§impl BatchMetrics
impl BatchMetrics
Sourcepub fn update_from_report(&mut self, report: &LLMAnalysisReport)
pub fn update_from_report(&mut self, report: &LLMAnalysisReport)
Fold one per-response report into the running accumulators.
Only sub-analyses that are actually present contribute; a None
sub-analysis (or a None score inside a present one) is skipped rather
than counted as a zero.
Sourcepub fn finalize(&mut self, batch_size: usize)
pub fn finalize(&mut self, batch_size: usize)
Publish the averages computed from everything folded in so far.
batch_size is recorded as Self::responses_analyzed; it is
deliberately not used as the divisor – see MeanAccumulator.
Trait Implementations§
Source§impl Clone for BatchMetrics
impl Clone for BatchMetrics
Source§fn clone(&self) -> BatchMetrics
fn clone(&self) -> BatchMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BatchMetrics
impl Debug for BatchMetrics
Source§impl Default for BatchMetrics
impl Default for BatchMetrics
Source§fn default() -> BatchMetrics
fn default() -> BatchMetrics
Source§impl<'de> Deserialize<'de> for BatchMetrics
impl<'de> Deserialize<'de> for BatchMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BatchMetrics
impl RefUnwindSafe for BatchMetrics
impl Send for BatchMetrics
impl Sync for BatchMetrics
impl Unpin for BatchMetrics
impl UnsafeUnpin for BatchMetrics
impl UnwindSafe for BatchMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Source§fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
Source§fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.