import { evaluate, DynamicMetric, DynamicEvaluationCriteria } from '@evalkit/core';
const criteria = [
{ type: "Accuracy" },
{ type: "Relevance" }
];
evaluate({
// Original input question provided to the model
input: "What is the economic impact of renewable energy?",
// Actual output generated by the model
actualOutput: "Renewable energy creates jobs and reduces greenhouse gas emissions.",
// Expected output ideally generated from the input
expectedOutput: "Renewable energy significantly contributes to the economy by creating jobs and driving sustainable practices.",
// The evaluation criteria
criteria: criteria,
}, [DynamicMetric])
// outputs
{
passed: false,
// The score is based on number of passed criteria divided by total criteria
score: 0,
results: [
{
criteria: 'Accuracy',
score: 0.5,
reason: 'The actual output partially addresses the economic impact by mentioning job creation but misses the point of driving sustainable practices.',
passed: false
},
{
criteria: 'Relevance',
score: 0.5,
reason: 'The actual output addresses part of the economic impact by mentioning job creation but lacks information about driving sustainable practices which is mentioned in the expected output.',
passed: false
}
]
}