UNPKG

@arizeai/phoenix-evals

Version:
15 lines 468 B
import { isPromise } from "../utils/typeUtils.js"; import { toEvaluationResult } from "./toEvaluationResult.js"; /** * A function that converts a generic function into an evaluator function */ export function asEvaluatorFn(fn) { return async (...args) => { let result = fn(...args); if (isPromise(result)) { result = await result; } return toEvaluationResult(result); }; } //# sourceMappingURL=asEvaluatorFn.js.map