import{ClosedQA,Factuality,Sql,Summary}from"../../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.0/node_modules/autoevals/jsdist/index.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import"ai";import{markModelBackedScorer}from"#evals/scorers/model-marker.js";import{createAutoevalsClient}from"#evals/scorers/autoevals-client.js";function factuality(e={}){return languageScorer(`Autoevals.factuality`,Factuality,e)}function summary(e={}){return languageScorer(`Autoevals.summary`,Summary,e)}function sql(e={}){return languageScorer(`Autoevals.sql`,Sql,e)}function closedQA(t){return markWhenEvalModelRequired(`Autoevals.closedQA`,async n=>{let r=resolveJudgeModel(`Autoevals.closedQA`,t,n);return toScorerResult(await ClosedQA({input:n.input,output:n.output,criteria:t.criteria,model:formatLanguageModelGatewayId(r),client:createAutoevalsClient({languageModel:r,providerOptions:mergeProviderOptions(n,t.modelOptions)})}))},t)}function languageScorer(e,t,n){return markWhenEvalModelRequired(e,async r=>{let i=resolveJudgeModel(e,n,r);return toScorerResult(await t({input:r.input,output:r.output,expected:r.expected,model:formatLanguageModelGatewayId(i),client:createAutoevalsClient({languageModel:i,providerOptions:mergeProviderOptions(r,n.modelOptions)})}))},n)}function markWhenEvalModelRequired(e,t,n){return n.model===void 0?markModelBackedScorer(e,t):t}function resolveJudgeModel(e,t,n){let r=t.model??n.model;if(r===void 0)throw Error(`${e} needs a judge model. Set the eval-level \`model\` or pass \`model\` to the scorer.`);return r}function mergeProviderOptions(e,t){let n=e.modelOptions?.providerOptions,r=t?.providerOptions;if(!(n===void 0&&r===void 0))return{...n,...r}}function toScorerResult(e){return{name:e.name,score:e.score,metadata:e.metadata}}export{closedQA,factuality,sql,summary};