All files / api/src/connectors/evaluations/argument-correctness/templates verdict.ts

0% Statements 0/12
100% Branches 1/1
100% Functions 1/1
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                                                                     
import type { ArgumentCorrectnessTemplateConfig } from '@api/connectors/evaluations/argument-correctness/types';
 
/**
 * Template for generating overall verdict on argument correctness
 */
export function getArgumentCorrectnessVerdictTemplate(data: {
  per_tool: Array<{ name: string; correct: boolean; explanation?: string }>;
}): ArgumentCorrectnessTemplateConfig {
  const systemPrompt = `You are an expert evaluator assessing overall argument correctness across tool calls.
 
Instructions:
- Use the per-tool analysis to compute an overall score as (# of correct tool calls) / (total tool calls).
- Provide a concise reasoning summarizing the main strengths and weaknesses.
 
Return a JSON object with this exact structure:
{
  "score": <number between 0.0 and 1.0>,
  "reasoning": "<concise explanation>",
  "per_tool": [ { "name": "...", "correct": true|false, "explanation": "..." } ]
}`;
 
  const userPrompt = `Per-Tool Analysis:
${JSON.stringify(data.per_tool, null, 2)}
 
Provide an overall score and reasoning. The score may be computed as (# correct tool calls) / (total tool calls).`;
 
  return {
    systemPrompt,
    userPrompt,
    outputFormat: 'json',
  };
}
 
export default getArgumentCorrectnessVerdictTemplate;