* Medium Complexity Judge Consistency Tests * * These tests verify that judges produce consistent scores on more complex scenarios: * - Nested loops with error handling * - State mutations across methods * - Multi-file API changes * - Import reorganizations * * All tests run 3 evaluations an
( judge: Judge, systemPrompt: string, userPrompt: string, )
| 36 | */ |
| 37 | |
| 38 | async function evaluateWithJudge( |
| 39 | judge: Judge, |
| 40 | systemPrompt: string, |
| 41 | userPrompt: string, |
| 42 | ): Promise<ScoreResult> { |
| 43 | try { |
| 44 | const { object } = await generateObject({ |
| 45 | model: judge.model, |
| 46 | schema: scoreResultSchema, |
| 47 | system: systemPrompt, |
| 48 | temperature: 0, |
| 49 | prompt: userPrompt, |
| 50 | }); |
| 51 | |
| 52 | return object; |
| 53 | } catch (error) { |
| 54 | const message = error instanceof Error ? error.message : String(error); |
| 55 | throw new Error(`Judge evaluation failed: ${message}`); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | function createDiffComparisonPrompt( |
| 60 | diffPair: DiffPair, |