@openpond/evals 0.12.7 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/RELEASING.md
CHANGED
|
@@ -36,3 +36,9 @@ leave the lockfile unchanged. The helper reports the selected path before commit
|
|
|
36
36
|
A dry run requires clean, current master and prints the commands without changing
|
|
37
37
|
Git or package versions. Existing trusted publishing, registry verification,
|
|
38
38
|
package tags, and retry behavior are unchanged.
|
|
39
|
+
|
|
40
|
+
Version `0.12.8` gives newly authored Reward support files content-addressed
|
|
41
|
+
paths so training and evaluation Rewards, including different revisions of one
|
|
42
|
+
Reward, can coexist in one private export. Existing published assets and checked
|
|
43
|
+
Reward revisions remain immutable; edit, recheck and publish a new revision to
|
|
44
|
+
use the new paths. Asset visibility and reference-integrity checks are unchanged.
|
|
@@ -5,6 +5,7 @@ import { createLearningTextAsset, verifyLearningTextAsset } from "./assets.js";
|
|
|
5
5
|
import { LearningJsonObjectSchema } from "./contracts.js";
|
|
6
6
|
import { LearningDomainError } from "./errors.js";
|
|
7
7
|
import { HumanFormSchema } from "../human-review/contracts.js";
|
|
8
|
+
import { sha256 } from "@openpond/harness";
|
|
8
9
|
export const DEFAULT_REWARD_VERIFIER_SOURCE = `export function verify({ output, expectedOutput }) {
|
|
9
10
|
if (!expectedOutput || !Object.hasOwn(expectedOutput, "answer")) {
|
|
10
11
|
throw new Error("An expected answer is required.");
|
|
@@ -19,19 +20,19 @@ export function compileRewardAuthoring(input) {
|
|
|
19
20
|
const base = input.base ? RewardReleaseSchema.parse(input.base) : null;
|
|
20
21
|
if (base && base.id !== input.id)
|
|
21
22
|
throw new LearningDomainError("reward_authoring_base_mismatch", 422);
|
|
22
|
-
const fixtureAsset = fields.fixtures?.length ?
|
|
23
|
+
const fixtureAsset = fields.fixtures?.length ? rewardAsset(JSON.stringify(fields.fixtures), "reward-fixtures.json", "application/json") : null;
|
|
23
24
|
let asset = null;
|
|
24
25
|
let implementation;
|
|
25
26
|
let calibrationCheckRef;
|
|
26
27
|
if (fields.kind === "custom_verifier") {
|
|
27
|
-
asset =
|
|
28
|
+
asset = rewardAsset(fields.code, "verifier.mjs", "application/javascript");
|
|
28
29
|
implementation = { kind: fields.kind, verifierRef: asset.asset, exportName: fields.exportName, timeoutMs: authoringNumber(fields.timeout, "Time limit"), networkPolicy: "none",
|
|
29
30
|
...((fields.verifierRuntime ?? (base?.implementation.kind === "custom_verifier" ? base.implementation.runtime : undefined)) ? { runtime: fields.verifierRuntime ?? (base?.implementation.kind === "custom_verifier" ? base.implementation.runtime : undefined) } : {}) };
|
|
30
31
|
}
|
|
31
32
|
else if (fields.kind === "model_judge" || fields.kind === "human") {
|
|
32
33
|
if (!fields.rubric.trim())
|
|
33
34
|
throw new LearningDomainError("reward_rubric_required", 422, "Write the rubric before checking or publishing this Reward.");
|
|
34
|
-
asset =
|
|
35
|
+
asset = rewardAsset(fields.rubric, "rubric.md", "text/markdown");
|
|
35
36
|
if (fields.kind === "human")
|
|
36
37
|
implementation = { kind: fields.kind, rubricRef: asset.asset, reviewerRole: fields.reviewerRole, form: HumanFormSchema.parse(JSON.parse(fields.humanForm || JSON.stringify({ schemaVersion: "openpond.humanForm.v1", mode: "individual", instructions: fields.rubric, criteria: [{ id: "quality", label: "Quality", instructions: fields.rubric, required: true, allowAbstain: true, kind: "score", minimum: 0, maximum: 1, step: 0.1 }] }))) };
|
|
37
38
|
else {
|
|
@@ -49,7 +50,7 @@ export function compileRewardAuthoring(input) {
|
|
|
49
50
|
}
|
|
50
51
|
else if (fields.kind === "learned_model") {
|
|
51
52
|
parseRewardAuthoringObject(fields.inputContract, "Model input contract");
|
|
52
|
-
asset =
|
|
53
|
+
asset = rewardAsset(fields.inputContract, "input-contract.json", "application/json");
|
|
53
54
|
implementation = { kind: fields.kind, modelVersion: { id: fields.learnedId, contentHash: fields.learnedHash }, inputContract: asset.asset };
|
|
54
55
|
}
|
|
55
56
|
else if (fields.kind === "state")
|
|
@@ -74,6 +75,11 @@ export function compileRewardAuthoring(input) {
|
|
|
74
75
|
});
|
|
75
76
|
return { reward, assets };
|
|
76
77
|
}
|
|
78
|
+
// Training and evaluation Rewards (including different revisions of one Reward)
|
|
79
|
+
// share a private asset directory. Different bytes must never claim one path.
|
|
80
|
+
function rewardAsset(text, filename, mediaType) {
|
|
81
|
+
return createLearningTextAsset({ text, path: `reward-assets/${sha256(text)}/${filename}`, mediaType, visibility: "verifier" });
|
|
82
|
+
}
|
|
77
83
|
export function rewardAuthoringFields(reward, sourceAsset, fixtureAsset = null) {
|
|
78
84
|
const implementation = reward?.implementation;
|
|
79
85
|
const ref = implementation && "verifierRef" in implementation ? implementation.verifierRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward-authoring.d.ts","sourceRoot":"","sources":["../../../src/learning/reward-authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAmE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzH,OAAO,EAAoD,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"reward-authoring.d.ts","sourceRoot":"","sources":["../../../src/learning/reward-authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAmE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzH,OAAO,EAAoD,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMvG,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC1E,eAAO,MAAM,8BAA8B,yWAMzC,CAAC;AAEH,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAC;IAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAgD/K;AAQD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,EAAE,YAAY,GAAE,iBAAiB,GAAG,IAAW,GAAG,qBAAqB,CAgC/K;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,0CAMtE;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpE"}
|
package/package.json
CHANGED