All files / api/src/connectors/evaluations/argument-correctness/templates extraction-trace.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 36 37                                                                         
import type { ArgumentCorrectnessTemplateConfig } from '@api/connectors/evaluations/argument-correctness/types';
 
/**
 * Template for extracting per-tool argument correctness from trace data
 */
export function getArgumentCorrectnessExtractionTraceTemplate(data: {
  trace: unknown;
}): ArgumentCorrectnessTemplateConfig {
  const systemPrompt = `You are an expert at analyzing workflow traces to evaluate the correctness of tool call arguments.
 
Instructions:
- Review the sequence of steps and tool calls in the trace.
- For each tool call, judge whether its input arguments are appropriate and sufficient for the task.
 
Return a JSON object with this exact structure:
{
  "per_tool": [
    { "name": "<tool name>", "correct": <true|false>, "explanation": "<brief reason>" }
  ]
}`;
 
  const userPrompt = `Analyze this trace and evaluate per-tool argument correctness:
 
TRACE:
${JSON.stringify(data.trace, null, 2)}
 
For each tool call, decide if the arguments are correct and explain briefly.`;
 
  return {
    systemPrompt,
    userPrompt,
    outputFormat: 'json',
  };
}
 
export default getArgumentCorrectnessExtractionTraceTemplate;