UNPKG

@arizeai/phoenix-evals

Version:
18 lines 620 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asEvaluatorFn = asEvaluatorFn; const typeUtils_1 = require("../utils/typeUtils"); const toEvaluationResult_1 = require("./toEvaluationResult"); /** * A function that converts a generic function into an evaluator function */ function asEvaluatorFn(fn) { return async (...args) => { let result = fn(...args); if ((0, typeUtils_1.isPromise)(result)) { result = await result; } return (0, toEvaluationResult_1.toEvaluationResult)(result); }; } //# sourceMappingURL=asEvaluatorFn.js.map