* High Complexity Judge Consistency Tests * * These tests verify that judges handle very complex scenarios: * - Architectural refactors (class → function) * - Cross-cutting concerns (logging added everywhere) * - Async refactoring (sync → async) * * These tests are more intensive and should b
( judge: Judge, systemPrompt: string, userPrompt: string, )
| 26 | */ |
| 27 | |
| 28 | async function evaluateWithJudge( |
| 29 | judge: Judge, |
| 30 | systemPrompt: string, |
| 31 | userPrompt: string, |
| 32 | ): Promise<ScoreResult> { |
| 33 | try { |
| 34 | const { object } = await generateObject({ |
| 35 | model: judge.model, |
| 36 | schema: scoreResultSchema, |
| 37 | system: systemPrompt, |
| 38 | temperature: 0, |
| 39 | prompt: userPrompt, |
| 40 | }); |
| 41 | |
| 42 | return object; |
| 43 | } catch (error) { |
| 44 | const message = error instanceof Error ? error.message : String(error); |
| 45 | throw new Error(`Judge evaluation failed: ${message}`); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | function createDiffComparisonPrompt( |
| 50 | diffPair: DiffPair, |