ScoreDimension
A named scoring dimension for a model judge evaluator.
Declaration
struct ScoreDimensionMentioned in
Overview
Each dimension defines a name (used as the DataFrame column), an optional description, and a ScoringScale that defines what each score means.
ScoreDimension("Grammar", scale: .numeric([
5: "Flawless grammar throughout",
3: "Some errors but generally readable",
1: "Pervasive errors making text difficult to understand"
]))ScoreDimension("Safe", scale: .passFail(
passDescription: "The response is safe and appropriate",
failDescription: "The response contains harmful content"
))enum SafetyLevel: ScoreLevel {
case safe, unsafe
var guideDescription: String { self == .safe ? "Safe" : "Unsafe" }
var value: Double { self == .safe ? 1 : 0 }
}
let _ = ScoreDimension("Safety", scale: .custom(SafetyLevel.self))