ScoreModelGrader class
Uses an AI model to assign numeric scores.
The model evaluates inputs and returns a score, which is compared against the passThreshold.
Example
final grader = EvalGrader.scoreModel(
name: 'quality_score',
model: 'gpt-4o-mini',
input: [
ScoreModelInput.system('Rate the quality of this response from 0-10.'),
ScoreModelInput.user('Response: {{sample.output_text}}'),
],
passThreshold: 7.0,
);
- Inheritance
-
- Object
- EvalGrader
- ScoreModelGrader
- Annotations
-
- @immutable
Constructors
-
ScoreModelGrader({required String name, required String model, required List<
ScoreModelInput> input, double? passThreshold, String? samplingParams}) -
Creates a ScoreModelGrader.
const
-
ScoreModelGrader.fromJson(Map<
String, dynamic> json) -
Creates a ScoreModelGrader from JSON.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
-
input
→ List<
ScoreModelInput> -
The input messages for the model.
final
- model → String
-
The model to use for scoring.
final
- name → String
-
The name of this grader.
final
- passThreshold → double?
-
The minimum score required to pass.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- samplingParams → String?
-
Optional sampling parameters as JSON string.
final
- type → String
-
The type of grader.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Converts this to JSON.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override