Open History to see the last commit
function score<TLevels>(options): object;
Defined in: packages/ai/src/activities/evaluate/index.ts:393
Build a score question. The model rates state on ordered levels.
You must pass at least two levels. .value is the nearest level label.
The raw fraction stays on .score. On the wire, levels is sent as
TypeSafe criteria.
Type Parameters#
TLevels#
TLevels extends readonly string[]
Parameters#
options#
instructions#
EvaluateJsonValue
What the model should rate.
levels#
TLevels
Ordered labels, lowest first. At least two.
Returns#
object
criteria#
criteria: TLevels = options.levels;
instructions#
instructions: EvaluateJsonValue = options.instructions;
type#
type: "score";
Example#
const urgency = score({
instructions: 'How urgent is this ticket?',
levels: ['low', 'medium', 'high'],
})