import "../chunk-NSBPE2FW.js";

// src/adapters/langchain.ts
function langchainDispatch(opts) {
  return async (scenario, ctx) => {
    return opts.runnable.invoke(scenario, {
      ...opts.config,
      signal: ctx.signal
    });
  };
}
function langchainJudge(opts) {
  return {
    name: opts.name,
    dimensions: opts.dimensions,
    appliesTo: opts.appliesTo,
    async score({ artifact, scenario, signal }) {
      const result = await opts.runnable.invoke({ artifact, scenario }, { signal });
      const dims = result.dimensions ?? {};
      const dimValues = Object.values(dims);
      const composite = result.composite ?? (dimValues.length > 0 ? dimValues.reduce((a, b) => a + b, 0) / dimValues.length : 0);
      return {
        dimensions: dims,
        composite,
        notes: result.notes ?? ""
      };
    }
  };
}
export {
  langchainDispatch,
  langchainJudge
};
//# sourceMappingURL=langchain.js.map