-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathBENCH_PACK_TEMPLATE.ts
More file actions
89 lines (78 loc) · 2.16 KB
/
Copy pathBENCH_PACK_TEMPLATE.ts
File metadata and controls
89 lines (78 loc) · 2.16 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import {
createHostHelpers,
defineBenchPack,
loadBenchPackManifest,
requireScoredResults,
type ProgressEmitter,
type ScenarioResult,
type ScenarioRunInput
} from "@benchlocal/sdk";
const SCENARIOS = [
{
id: "EX-01",
title: "Example Scenario",
description: "Replace this with real benchmark metadata.",
successCase: "Describe what a correct answer should do.",
failureCase: "Describe the common miss that should fail."
}
] as const;
export const manifest = loadBenchPackManifest(__dirname);
export default defineBenchPack({
manifest,
async listScenarios() {
return SCENARIOS.map((scenario) => ({
id: scenario.id,
title: scenario.title,
description: scenario.description,
detailCards: [
{
title: "What this tests",
content: scenario.description
},
{
title: "Success case",
content: scenario.successCase
},
{
title: "Failure case",
content: scenario.failureCase
}
]
}));
},
async prepare(context) {
const helpers = createHostHelpers(context);
return {
async runScenario(input: ScenarioRunInput, emit: ProgressEmitter): Promise<ScenarioResult> {
const scenario = helpers.getScenarioById(SCENARIOS, input.scenario.id);
await emit({
type: "model_progress",
modelId: input.model.id,
scenarioId: scenario.id,
message: "Running example scenario"
});
return {
scenarioId: scenario.id,
status: "pass",
score: 1,
summary: "Replace this with real benchmark logic.",
rawLog: `scenario=${scenario.id}\nmodel=${input.model.id}`
};
},
async dispose() {}
};
},
scoreModelResults(results) {
const scored = requireScoredResults(results);
return {
totalScore: scored.reduce((total, result) => total + result.score, 0),
categories: [
{
id: "overall",
label: "Overall",
score: scored.length === 0 ? 0 : scored.reduce((total, result) => total + result.score, 0) / scored.length
}
]
};
}
});