pub enum EvalScorer {
ExactMatch,
Contains,
Regex,
LlmJudge,
SemanticSimilarity,
}Expand description
The scorer for an eval case (DW-086, AI-10/#199).
Variants§
ExactMatch
Exact string match between the output and expected.
Contains
The output must CONTAIN the expected string.
Regex
The output must MATCH the expected regex pattern.
LlmJudge
AI-10 (#199): LLM-judge scorer. An LLM evaluates whether the
output is a good response to the input, comparing against the
expected value as a reference. The judge prompt is a simple
yes/no comparison. This scorer requires a provider URL and
auth to be configured at eval-run time.
SemanticSimilarity
AI-10 (#199): Semantic-similarity scorer. Uses a simple token-overlap heuristic (Jaccard similarity) as a proxy for semantic similarity. Passes when the Jaccard index between the output and expected tokens exceeds 0.5. This avoids adding a new embedding dependency; a future enhancement can plug in a real embedding model.
Implementations§
Source§impl EvalScorer
impl EvalScorer
Sourcepub fn parse(s: Option<&str>) -> Self
pub fn parse(s: Option<&str>) -> Self
Parse a scorer name string. Defaults to ExactMatch for an
unrecognized or None value.
Sourcepub fn score(&self, output: &str, expected: &str) -> bool
pub fn score(&self, output: &str, expected: &str) -> bool
Score an output against an expected value. For LlmJudge,
this is a fallback heuristic (the real LLM judge runs
asynchronously in the eval runner); the fallback uses
Contains semantics. For SemanticSimilarity, uses Jaccard
token overlap with a 0.5 threshold.
Trait Implementations§
Source§impl Clone for EvalScorer
impl Clone for EvalScorer
Source§fn clone(&self) -> EvalScorer
fn clone(&self) -> EvalScorer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvalScorer
impl Debug for EvalScorer
Source§impl PartialEq for EvalScorer
impl PartialEq for EvalScorer
impl Copy for EvalScorer
impl Eq for EvalScorer
impl StructuralPartialEq for EvalScorer
Auto Trait Implementations§
impl Freeze for EvalScorer
impl RefUnwindSafe for EvalScorer
impl Send for EvalScorer
impl Sync for EvalScorer
impl Unpin for EvalScorer
impl UnwindSafe for EvalScorer
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more