| 14 | const judge = judges[0]; // claude-4.5 |
| 15 | |
| 16 | async function evaluateAndShow( |
| 17 | name: string, |
| 18 | systemPrompt: string, |
| 19 | reference: string, |
| 20 | candidate: string, |
| 21 | scoreType: string, |
| 22 | ) { |
| 23 | console.log(`\n${"=".repeat(80)}`); |
| 24 | console.log(`TEST: ${name}`); |
| 25 | console.log(`${"=".repeat(80)}\n`); |
| 26 | |
| 27 | const userPrompt = |
| 28 | scoreType === "logic" |
| 29 | ? `Reference diff:\n${reference}\n\nCandidate diff:\n${candidate}\n\nCompare ONLY the logical behavior (conditions, edge cases, side effects). Ignore code structure and style. Respond with JSON.` |
| 30 | : `Reference diff:\n${reference}\n\nCandidate diff:\n${candidate}\n\nCompare ONLY the API signatures (function names, parameter order, parameter names). Ignore implementation details. Respond with JSON.`; |
| 31 | |
| 32 | for (let i = 1; i <= 3; i++) { |
| 33 | console.log(`\n--- Run ${i} ---\n`); |
| 34 | |
| 35 | const { object } = await generateObject({ |
| 36 | model: judge.model, |
| 37 | schema: scoreResultSchema, |
| 38 | system: systemPrompt, |
| 39 | temperature: 0, |
| 40 | prompt: userPrompt, |
| 41 | }); |
| 42 | |
| 43 | console.log(`Score: ${object.score}`); |
| 44 | console.log(`\nRationale:\n${object.rationale}`); |
| 45 | console.log(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // Run tests |
| 50 | (async () => { |