MCPcopy Create free account
hub / github.com/anomalyco/opencode-bench / evaluateAndShow

Function evaluateAndShow

scripts/show-test-outputs.ts:16–47  ·  view source on GitHub ↗
(
  name: string,
  systemPrompt: string,
  reference: string,
  candidate: string,
  scoreType: string,
)

Source from the content-addressed store, hash-verified

14const judge = judges[0]; // claude-4.5
15
16async 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 () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected