@arizeai/phoenix-evals
Version:
A library for running evaluations for AI use cases
19 lines • 1.09 kB
JavaScript
import { FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates/index.js";
import { createClassificationEvaluator } from "./createClassificationEvaluator.js";
/**
* Creates a function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
*
* @param args - The arguments for creating the faithfulness evaluator.
* @returns A function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
*/
export function createFaithfulnessEvaluator(args) {
const { choices = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.name, ...rest } = args;
return createClassificationEvaluator({
...rest,
promptTemplate,
choices,
optimizationDirection,
name,
});
}
//# sourceMappingURL=createFaithfulnessEvaluator.js.map