Package dev.dokimos.core
Record Class EvalResult
java.lang.Object
java.lang.Record
dev.dokimos.core.EvalResult
- Record Components:
name- the evaluator namescore- the numeric scorethreshold- the threshold used to determine success (may be null if not applicable)success- whether the evaluation succeeded or notreason- explanation for the returned scoremetadata- additional result metadata
public record EvalResult(String name, double score, Double threshold, boolean success, String reason, Map<String,Object> metadata)
extends Record
The result of an evaluation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing evaluation results. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EvalResult.Builderbuilder()Creates a new builder for constructing results.final booleanIndicates whether some other object is "equal to" this one.static EvalResultCreates a failed result.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.name()Returns the value of thenamerecord component.static EvalResultCreates a result by comparing the score against a threshold.reason()Returns the value of thereasonrecord component.doublescore()Returns the value of thescorerecord component.booleansuccess()Returns the value of thesuccessrecord component.static EvalResultCreates a successful result.Returns the value of thethresholdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EvalResult
public EvalResult(String name, double score, Double threshold, boolean success, String reason, Map<String, Object> metadata) Creates an instance of aEvalResultrecord class.- Parameters:
name- the value for thenamerecord componentscore- the value for thescorerecord componentthreshold- the value for thethresholdrecord componentsuccess- the value for thesuccessrecord componentreason- the value for thereasonrecord componentmetadata- the value for themetadatarecord component
-
EvalResult
public EvalResult(String name, double score, boolean success, String reason, Map<String, Object> metadata) Creates an EvalResult without a threshold (for backwards compatibility).
-
-
Method Details
-
of
Creates a result by comparing the score against a threshold.- Parameters:
name- the evaluator namescore- the numeric scorethreshold- the success thresholdreason- explanation for the score- Returns:
- a new result
-
success
Creates a successful result.- Parameters:
name- the evaluator namescore- the numeric scorereason- explanation for the score- Returns:
- a new successful result
-
failure
Creates a failed result.- Parameters:
name- the evaluator namescore- the numeric scorereason- explanation for the failure- Returns:
- a new failed result
-
builder
Creates a new builder for constructing results.- Returns:
- a new builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
score
public double score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-
threshold
Returns the value of thethresholdrecord component.- Returns:
- the value of the
thresholdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-