All files / api/src/connectors/evaluations/task-completion/templates verdict.ts

100% Statements 12/12
100% Branches 1/1
100% Functions 1/1
100% Lines 12/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 38 39 40          1x     2x 2x                             2x   2x       2x 2x 2x 2x 2x 2x     1x  
import type { TaskCompletionTemplateConfig } from '@api/connectors/evaluations/task-completion/types';
 
/**
 * Template for generating verdict on task completion
 */
export function getTaskCompletionVerdictTemplate(data: {
  task: string;
  outcome: string;
}): TaskCompletionTemplateConfig {
  const systemPrompt = `You are an expert evaluator assessing whether a task was successfully completed.
 
Your job is to evaluate how well the outcome fulfills the task requirements.
 
Evaluate based on:
1. Task Understanding: Was the task properly understood?
2. Outcome Achievement: Does the outcome fulfill the task requirements?
3. Quality: How well was the task executed?
 
Return your response as a JSON object with this exact structure:
{
  "score": <number between 0.0 and 1.0>,
  "reasoning": "<detailed explanation of your evaluation>"
}`;
 
  const userPrompt = `Task: ${data.task}
 
Outcome: ${data.outcome}
 
Please evaluate how well the outcome fulfills the task requirements and provide a score between 0.0 and 1.0.`;
 
  return {
    systemPrompt,
    userPrompt,
    outputFormat: 'json',
  };
}
 
// Export as default for template loader compatibility
export default getTaskCompletionVerdictTemplate;