openpond-sdk 0.8.0 → 0.8.1
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/TRAINING_PROTOCOL.md +28 -0
- package/dist/{chunk-CGIMLZE5.js → chunk-5KA6NN6I.js} +277 -188
- package/dist/chunk-5KA6NN6I.js.map +7 -0
- package/dist/dataset-workspaces.js +1 -1
- package/dist/model-starter-catalog.js +1 -1
- package/dist/model-starters.js +1 -1
- package/dist/taskset-drafts.js +1 -1
- package/dist/taskset-packages.js +1 -1
- package/dist/training-bundle.js +1 -1
- package/dist/training.js +13 -1
- package/dist/types/packages/sdk/src/training-preparations.d.ts +639 -0
- package/dist/types/packages/sdk/src/training-preparations.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/training.d.ts +309 -0
- package/dist/types/packages/sdk/src/training.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CGIMLZE5.js.map +0 -7
|
@@ -20,15 +20,97 @@ import {
|
|
|
20
20
|
} from "./chunk-QUOW6URQ.js";
|
|
21
21
|
|
|
22
22
|
// src/training.ts
|
|
23
|
-
import { z as
|
|
23
|
+
import { z as z7 } from "zod";
|
|
24
24
|
|
|
25
|
-
// src/training-
|
|
25
|
+
// src/training-preparations.ts
|
|
26
26
|
import { z } from "zod";
|
|
27
|
-
var
|
|
28
|
-
|
|
27
|
+
var Id = z.string().trim().min(1).max(191);
|
|
28
|
+
var Hash = z.string().regex(/^[a-f0-9]{64}$/);
|
|
29
|
+
var TrainingPreparationRequestSchema = z.object({
|
|
30
|
+
schemaVersion: z.literal("openpond.trainingPreparationRequest.v1"),
|
|
31
|
+
teamId: Id,
|
|
32
|
+
operationId: Id,
|
|
33
|
+
projectId: Id.nullable(),
|
|
34
|
+
configuration: z.object({ id: Id, expectedRevision: z.number().int().positive(), expectedEtag: Hash }).strict(),
|
|
35
|
+
batch: ModelProjectVersionedRefSchema,
|
|
36
|
+
name: z.string().trim().min(1).max(191),
|
|
37
|
+
maximumSpendUsd: z.number().finite().positive().max(1e6)
|
|
38
|
+
}).strict();
|
|
39
|
+
var TrainingPreparationPlanContentSchema = z.object({
|
|
40
|
+
schemaVersion: z.literal("openpond.trainingPreparationPlan.v1"),
|
|
41
|
+
id: Id,
|
|
42
|
+
creatorUserId: Id,
|
|
43
|
+
request: TrainingPreparationRequestSchema,
|
|
44
|
+
requestHash: Hash,
|
|
45
|
+
source: z.lazy(() => TrainingJobSourceSchema),
|
|
46
|
+
submissionHash: Hash,
|
|
47
|
+
createdAt: z.string().datetime({ offset: true })
|
|
48
|
+
}).strict();
|
|
49
|
+
var TrainingPreparationPlanSchema = TrainingPreparationPlanContentSchema.extend({ contentHash: Hash }).strict();
|
|
50
|
+
var TrainingPreparationReceiptSchema = z.object({
|
|
51
|
+
schemaVersion: z.literal("openpond.trainingPreparationReceipt.v1"),
|
|
52
|
+
plan: TrainingPreparationPlanSchema,
|
|
53
|
+
revision: z.number().int().positive(),
|
|
54
|
+
state: z.enum(["prepared", "submitted", "cancelled"]),
|
|
55
|
+
jobId: Id.nullable()
|
|
56
|
+
}).strict().superRefine((value, context) => {
|
|
57
|
+
if (value.state === "submitted" !== Boolean(value.jobId)) context.addIssue({ code: "custom", path: ["jobId"], message: "Only submitted preparations identify a job." });
|
|
58
|
+
});
|
|
59
|
+
var TrainingPreparationControlSchema = z.object({
|
|
60
|
+
teamId: Id,
|
|
61
|
+
planHash: Hash,
|
|
62
|
+
expectedRevision: z.number().int().positive()
|
|
63
|
+
}).strict();
|
|
64
|
+
async function parseAndVerifyTrainingPreparationReceipt(value) {
|
|
65
|
+
const receipt = TrainingPreparationReceiptSchema.parse(value);
|
|
66
|
+
const { contentHash, ...plan } = receipt.plan;
|
|
67
|
+
if (await canonicalSha256(plan) !== contentHash || await canonicalSha256(plan.request) !== plan.requestHash || plan.source.modelProject.id !== plan.request.configuration.id) {
|
|
68
|
+
throw new OpenPondProtocolError("training_preparation_mismatch", "The prepared training inputs changed.");
|
|
69
|
+
}
|
|
70
|
+
return receipt;
|
|
71
|
+
}
|
|
72
|
+
function createTrainingPreparationClient(request) {
|
|
73
|
+
async function read(value, teamId, id) {
|
|
74
|
+
const receipt = await parseAndVerifyTrainingPreparationReceipt(value);
|
|
75
|
+
if (receipt.plan.request.teamId !== teamId || id && receipt.plan.id !== id)
|
|
76
|
+
throw new OpenPondProtocolError("training_preparation_scope_mismatch", "The training preparation belongs to a different workspace or request.");
|
|
77
|
+
return receipt;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
async prepareRun(input) {
|
|
81
|
+
const parsed = TrainingPreparationRequestSchema.parse(input);
|
|
82
|
+
const receipt = await read(await request("/v1/training/preparations", { method: "POST", body: JSON.stringify(parsed) }), parsed.teamId);
|
|
83
|
+
if (receipt.plan.requestHash !== await canonicalSha256(parsed))
|
|
84
|
+
throw new OpenPondProtocolError("training_preparation_request_mismatch", "The preparation does not match the requested run.");
|
|
85
|
+
return receipt;
|
|
86
|
+
},
|
|
87
|
+
async getPreparation(teamId, id) {
|
|
88
|
+
return read(await request(`/v1/training/preparations/${encodeURIComponent(Id.parse(id))}`), Id.parse(teamId), id);
|
|
89
|
+
},
|
|
90
|
+
async startPreparation(id, input) {
|
|
91
|
+
const parsed = TrainingPreparationControlSchema.parse(input);
|
|
92
|
+
const receipt = await read(await request(`/v1/training/preparations/${encodeURIComponent(Id.parse(id))}/start`, { method: "POST", body: JSON.stringify(parsed) }), parsed.teamId, id);
|
|
93
|
+
if (receipt.plan.contentHash !== parsed.planHash || receipt.state !== "submitted")
|
|
94
|
+
throw new OpenPondProtocolError("training_preparation_start_mismatch", "The submitted run does not match the approved preparation.");
|
|
95
|
+
return receipt;
|
|
96
|
+
},
|
|
97
|
+
async cancelPreparation(id, input) {
|
|
98
|
+
const parsed = TrainingPreparationControlSchema.parse(input);
|
|
99
|
+
const receipt = await read(await request(`/v1/training/preparations/${encodeURIComponent(Id.parse(id))}/cancel`, { method: "POST", body: JSON.stringify(parsed) }), parsed.teamId, id);
|
|
100
|
+
if (receipt.plan.contentHash !== parsed.planHash || receipt.state !== "cancelled")
|
|
101
|
+
throw new OpenPondProtocolError("training_preparation_cancel_mismatch", "The preparation cancellation could not be verified.");
|
|
102
|
+
return receipt;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/training-harness-sources.ts
|
|
108
|
+
import { z as z2 } from "zod";
|
|
109
|
+
var TrainingHarnessSourcePublicationSchema = z2.object({
|
|
110
|
+
schemaVersion: z2.literal("openpond.trainingHarnessSourcePublication.v1"),
|
|
29
111
|
harnessRelease: ImmutableReleaseRefSchema,
|
|
30
|
-
sourcePackageHash:
|
|
31
|
-
sizeBytes:
|
|
112
|
+
sourcePackageHash: z2.string().regex(/^[a-f0-9]{64}$/),
|
|
113
|
+
sizeBytes: z2.number().int().positive().max(TRAINING_INPUT_ARTIFACT_MAX_BYTES)
|
|
32
114
|
}).strict();
|
|
33
115
|
function createTrainingHarnessSourceClient(request) {
|
|
34
116
|
const route = (reference) => {
|
|
@@ -58,28 +140,28 @@ function createTrainingHarnessSourceClient(request) {
|
|
|
58
140
|
}
|
|
59
141
|
|
|
60
142
|
// src/training-candidate-decisions.ts
|
|
61
|
-
import { z as
|
|
62
|
-
var IdSchema = /* @__PURE__ */ (() =>
|
|
63
|
-
var HashSchema = /* @__PURE__ */ (() =>
|
|
64
|
-
var TrainingCandidateDecisionRequestSchema = /* @__PURE__ */ (() =>
|
|
65
|
-
schemaVersion:
|
|
143
|
+
import { z as z3 } from "zod";
|
|
144
|
+
var IdSchema = /* @__PURE__ */ (() => z3.string().trim().min(1).max(500))();
|
|
145
|
+
var HashSchema = /* @__PURE__ */ (() => z3.string().regex(/^[a-f0-9]{64}$/))();
|
|
146
|
+
var TrainingCandidateDecisionRequestSchema = /* @__PURE__ */ (() => z3.object({
|
|
147
|
+
schemaVersion: z3.literal("openpond.trainingCandidateDecisionRequest.v1"),
|
|
66
148
|
teamId: IdSchema,
|
|
67
149
|
jobId: IdSchema,
|
|
68
150
|
artifact: ModelProjectImmutableRefSchema,
|
|
69
151
|
evaluation: ModelProjectImmutableRefSchema,
|
|
70
152
|
executionReceipt: ModelProjectImmutableRefSchema,
|
|
71
|
-
decision:
|
|
72
|
-
reason:
|
|
153
|
+
decision: z3.enum(["accepted", "rejected"]),
|
|
154
|
+
reason: z3.string().trim().min(1).max(5e3),
|
|
73
155
|
idempotencyKey: IdSchema,
|
|
74
156
|
expectedDecision: ModelProjectImmutableRefSchema.nullable()
|
|
75
157
|
}).strict())();
|
|
76
|
-
var TrainingCandidateDecisionSchema = /* @__PURE__ */ (() =>
|
|
77
|
-
schemaVersion:
|
|
158
|
+
var TrainingCandidateDecisionSchema = /* @__PURE__ */ (() => z3.object({
|
|
159
|
+
schemaVersion: z3.literal("openpond.trainingCandidateDecision.v1"),
|
|
78
160
|
id: IdSchema,
|
|
79
161
|
request: TrainingCandidateDecisionRequestSchema,
|
|
80
|
-
revision:
|
|
81
|
-
actor:
|
|
82
|
-
decidedAt:
|
|
162
|
+
revision: z3.number().int().positive(),
|
|
163
|
+
actor: z3.object({ userId: IdSchema, kind: z3.enum(["user", "api_key", "agent_delegate"]), id: IdSchema }).strict(),
|
|
164
|
+
decidedAt: z3.string().datetime({ offset: true }),
|
|
83
165
|
contentHash: HashSchema
|
|
84
166
|
}).strict().superRefine((value, context) => {
|
|
85
167
|
if (value.revision === 1 !== (value.request.expectedDecision === null)) {
|
|
@@ -116,7 +198,7 @@ function createTrainingCandidateDecisionClient(request) {
|
|
|
116
198
|
IdSchema.parse(target.teamId);
|
|
117
199
|
const reference = options.decision ? ModelProjectImmutableRefSchema.parse(options.decision) : void 0;
|
|
118
200
|
const query = reference ? `?decisionId=${encodeURIComponent(reference.id)}` : "";
|
|
119
|
-
const response =
|
|
201
|
+
const response = z3.object({ decision: z3.unknown().nullable() }).strict().parse(await request(`${route(target)}${query}`));
|
|
120
202
|
if (response.decision === null && !reference) return null;
|
|
121
203
|
const decision = await parseAndVerifyTrainingCandidateDecision(response.decision, target);
|
|
122
204
|
if (reference && (decision.id !== reference.id || decision.contentHash !== reference.contentHash)) {
|
|
@@ -133,38 +215,38 @@ function createTrainingCandidateDecisionClient(request) {
|
|
|
133
215
|
}
|
|
134
216
|
|
|
135
217
|
// src/training-evaluation-results.ts
|
|
136
|
-
import { z as
|
|
137
|
-
var IdSchema2 = /* @__PURE__ */ (() =>
|
|
138
|
-
var HashSchema2 = /* @__PURE__ */ (() =>
|
|
139
|
-
var TrainingEvaluationTaskResultSchema = /* @__PURE__ */ (() =>
|
|
218
|
+
import { z as z4 } from "zod";
|
|
219
|
+
var IdSchema2 = /* @__PURE__ */ (() => z4.string().trim().min(1).max(500))();
|
|
220
|
+
var HashSchema2 = /* @__PURE__ */ (() => z4.string().regex(/^[a-f0-9]{64}$/))();
|
|
221
|
+
var TrainingEvaluationTaskResultSchema = /* @__PURE__ */ (() => z4.object({
|
|
140
222
|
taskId: IdSchema2,
|
|
141
223
|
taskSha256: HashSchema2,
|
|
142
224
|
resultSha256: HashSchema2,
|
|
143
|
-
input:
|
|
144
|
-
instruction:
|
|
145
|
-
context:
|
|
225
|
+
input: z4.object({
|
|
226
|
+
instruction: z4.string().max(1e6),
|
|
227
|
+
context: z4.record(z4.string(), z4.unknown())
|
|
146
228
|
}).strict(),
|
|
147
|
-
output:
|
|
229
|
+
output: z4.string().max(1e6),
|
|
148
230
|
outputSha256: HashSchema2,
|
|
149
|
-
score:
|
|
150
|
-
evidence:
|
|
151
|
-
kind:
|
|
231
|
+
score: z4.number().finite().min(0).max(1),
|
|
232
|
+
evidence: z4.object({
|
|
233
|
+
kind: z4.enum(["worker_command", "hosted_trace", "local_trace"]),
|
|
152
234
|
id: IdSchema2
|
|
153
235
|
}).strict()
|
|
154
236
|
}).strict())();
|
|
155
|
-
var TrainingEvaluationTaskPageSchema = /* @__PURE__ */ (() =>
|
|
156
|
-
schemaVersion:
|
|
237
|
+
var TrainingEvaluationTaskPageSchema = /* @__PURE__ */ (() => z4.object({
|
|
238
|
+
schemaVersion: z4.literal("openpond.trainingEvaluationTaskPage.v1"),
|
|
157
239
|
jobId: IdSchema2,
|
|
158
240
|
teamId: IdSchema2,
|
|
159
241
|
evaluation: ModelProjectImmutableRefSchema,
|
|
160
|
-
kind:
|
|
161
|
-
policyVersion:
|
|
242
|
+
kind: z4.enum(["baseline", "candidate"]),
|
|
243
|
+
policyVersion: z4.number().int().nonnegative(),
|
|
162
244
|
taskset: ModelProjectVersionedRefSchema,
|
|
163
245
|
panelSha256: HashSchema2,
|
|
164
|
-
offset:
|
|
165
|
-
total:
|
|
166
|
-
tasks:
|
|
167
|
-
nextCursor:
|
|
246
|
+
offset: z4.number().int().nonnegative(),
|
|
247
|
+
total: z4.number().int().min(1).max(1e4),
|
|
248
|
+
tasks: z4.array(TrainingEvaluationTaskResultSchema).min(1).max(100),
|
|
249
|
+
nextCursor: z4.string().regex(/^[1-9]\d*$/).nullable(),
|
|
168
250
|
contentHash: HashSchema2
|
|
169
251
|
}).strict().superRefine((page, context) => {
|
|
170
252
|
const end = page.offset + page.tasks.length;
|
|
@@ -199,12 +281,12 @@ async function parseAndVerifyTrainingEvaluationTaskPage(value, expected) {
|
|
|
199
281
|
}
|
|
200
282
|
|
|
201
283
|
// src/training-grading-plan.ts
|
|
202
|
-
import { z as
|
|
284
|
+
import { z as z5 } from "zod";
|
|
203
285
|
import { compileBoundGraders, RewardBindingSchema, RewardReleaseSchema } from "@openpond/evals/rewards";
|
|
204
|
-
var GradersSchema =
|
|
205
|
-
var RewardExecutionSchema =
|
|
286
|
+
var GradersSchema = z5.array(z5.object({ id: z5.string().trim().min(1) }).catchall(z5.unknown())).min(1).max(1e3);
|
|
287
|
+
var RewardExecutionSchema = z5.object({
|
|
206
288
|
binding: RewardBindingSchema,
|
|
207
|
-
rewards:
|
|
289
|
+
rewards: z5.array(RewardReleaseSchema).min(1).max(100)
|
|
208
290
|
}).strict();
|
|
209
291
|
async function deterministicTrainingRewardSource(input) {
|
|
210
292
|
const execution = input.rewardExecution ? RewardExecutionSchema.parse(input.rewardExecution) : null;
|
|
@@ -221,23 +303,23 @@ async function deterministicTrainingRewardSource(input) {
|
|
|
221
303
|
}
|
|
222
304
|
|
|
223
305
|
// src/training-evaluation-source.ts
|
|
224
|
-
import { z as
|
|
306
|
+
import { z as z6 } from "zod";
|
|
225
307
|
var TRAINING_EVALUATION_SOURCE_PATH = "evaluation-source.json";
|
|
226
|
-
var TaskIdentitySchema =
|
|
227
|
-
id:
|
|
228
|
-
clusterKey:
|
|
229
|
-
split:
|
|
308
|
+
var TaskIdentitySchema = z6.object({
|
|
309
|
+
id: z6.string().trim().min(1),
|
|
310
|
+
clusterKey: z6.string().trim().min(1),
|
|
311
|
+
split: z6.enum(["train", "validation", "frozen_eval"])
|
|
230
312
|
}).passthrough();
|
|
231
|
-
var TrainingEvaluationSourceSchema =
|
|
232
|
-
schemaVersion:
|
|
313
|
+
var TrainingEvaluationSourceSchema = z6.object({
|
|
314
|
+
schemaVersion: z6.literal("openpond.trainingEvaluationSource.v1"),
|
|
233
315
|
taskset: ModelProjectVersionedRefSchema,
|
|
234
|
-
tasks:
|
|
235
|
-
assets:
|
|
236
|
-
path:
|
|
237
|
-
sha256:
|
|
238
|
-
sizeBytes:
|
|
239
|
-
encoding:
|
|
240
|
-
content:
|
|
316
|
+
tasks: z6.array(TaskIdentitySchema).min(1).max(1e4),
|
|
317
|
+
assets: z6.array(z6.object({
|
|
318
|
+
path: z6.string().trim().min(1).max(2e3),
|
|
319
|
+
sha256: z6.string().regex(/^[a-f0-9]{64}$/),
|
|
320
|
+
sizeBytes: z6.number().int().nonnegative(),
|
|
321
|
+
encoding: z6.literal("base64"),
|
|
322
|
+
content: z6.string().max(32 * 1024 * 1024)
|
|
241
323
|
}).strict()).max(1e4)
|
|
242
324
|
}).strict().superRefine((source, context) => {
|
|
243
325
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -248,8 +330,8 @@ var TrainingEvaluationSourceSchema = z5.object({
|
|
|
248
330
|
});
|
|
249
331
|
});
|
|
250
332
|
function assertTrainingEvaluationIsolation(trainingTasks, evaluationTasks) {
|
|
251
|
-
const training =
|
|
252
|
-
const evaluation =
|
|
333
|
+
const training = z6.array(TaskIdentitySchema).min(1).max(1e4).parse(trainingTasks);
|
|
334
|
+
const evaluation = z6.array(TaskIdentitySchema).min(1).max(1e4).parse(evaluationTasks);
|
|
253
335
|
const trainIds = /* @__PURE__ */ new Set();
|
|
254
336
|
const trainFamilies = /* @__PURE__ */ new Set();
|
|
255
337
|
for (const task of training) {
|
|
@@ -275,24 +357,24 @@ async function trainingEvaluationSourceRef(input) {
|
|
|
275
357
|
}
|
|
276
358
|
|
|
277
359
|
// src/training.ts
|
|
278
|
-
var IdSchema3 =
|
|
279
|
-
var HashSchema3 =
|
|
280
|
-
var TimestampSchema =
|
|
281
|
-
var TrainingInputArtifactUploadSchema =
|
|
282
|
-
schemaVersion:
|
|
283
|
-
kind:
|
|
284
|
-
idempotencyKey:
|
|
360
|
+
var IdSchema3 = z7.string().trim().min(1).max(500);
|
|
361
|
+
var HashSchema3 = z7.string().regex(/^[a-f0-9]{64}$/);
|
|
362
|
+
var TimestampSchema = z7.string().datetime({ offset: true });
|
|
363
|
+
var TrainingInputArtifactUploadSchema = z7.object({
|
|
364
|
+
schemaVersion: z7.literal("openpond.trainingInputArtifactUpload.v2"),
|
|
365
|
+
kind: z7.enum(["portable_training_bundle", "reward_model_dataset"]),
|
|
366
|
+
idempotencyKey: z7.string().trim().min(1).max(500),
|
|
285
367
|
sourceManifest: ModelProjectImmutableRefSchema,
|
|
286
|
-
payload:
|
|
368
|
+
payload: z7.unknown(),
|
|
287
369
|
contentHash: HashSchema3
|
|
288
370
|
}).strict();
|
|
289
|
-
var TrainingInputArtifactSchema =
|
|
290
|
-
schemaVersion:
|
|
291
|
-
kind:
|
|
371
|
+
var TrainingInputArtifactSchema = z7.object({
|
|
372
|
+
schemaVersion: z7.literal("openpond.trainingInputArtifact.v2"),
|
|
373
|
+
kind: z7.enum(["portable_training_bundle", "reward_model_dataset"]),
|
|
292
374
|
sourceManifest: ModelProjectImmutableRefSchema,
|
|
293
|
-
artifactRef:
|
|
375
|
+
artifactRef: z7.string().trim().min(1).max(2e3),
|
|
294
376
|
contentHash: HashSchema3,
|
|
295
|
-
sizeBytes:
|
|
377
|
+
sizeBytes: z7.number().int().positive(),
|
|
296
378
|
createdAt: TimestampSchema
|
|
297
379
|
}).strict();
|
|
298
380
|
async function trainingInputArtifactUploadHash(upload) {
|
|
@@ -315,11 +397,11 @@ async function parseAndVerifyTrainingInputArtifactUpload(value) {
|
|
|
315
397
|
}
|
|
316
398
|
return parsed;
|
|
317
399
|
}
|
|
318
|
-
var TrainingJobKindSchema =
|
|
400
|
+
var TrainingJobKindSchema = z7.enum([
|
|
319
401
|
"reward_model_train",
|
|
320
402
|
"policy_optimize"
|
|
321
403
|
]);
|
|
322
|
-
var TrainingJobStateSchema =
|
|
404
|
+
var TrainingJobStateSchema = z7.enum([
|
|
323
405
|
"queued",
|
|
324
406
|
"admitting",
|
|
325
407
|
"provisioning",
|
|
@@ -330,91 +412,91 @@ var TrainingJobStateSchema = z6.enum([
|
|
|
330
412
|
"failed",
|
|
331
413
|
"cancelled"
|
|
332
414
|
]);
|
|
333
|
-
var TrainingCapabilityRequirementSchema =
|
|
415
|
+
var TrainingCapabilityRequirementSchema = z7.object({
|
|
334
416
|
id: IdSchema3,
|
|
335
|
-
version:
|
|
336
|
-
required:
|
|
417
|
+
version: z7.string().trim().min(1).max(200).nullable().default(null),
|
|
418
|
+
required: z7.boolean().default(true)
|
|
337
419
|
}).strict();
|
|
338
|
-
var TrainingJobSourceSchema =
|
|
339
|
-
modelProject:
|
|
420
|
+
var TrainingJobSourceSchema = z7.object({
|
|
421
|
+
modelProject: z7.object({
|
|
340
422
|
id: IdSchema3,
|
|
341
423
|
portableProjectId: IdSchema3,
|
|
342
|
-
revision:
|
|
424
|
+
revision: z7.number().int().positive(),
|
|
343
425
|
contentHash: HashSchema3
|
|
344
426
|
}).strict(),
|
|
345
427
|
harnessRunManifest: ModelProjectImmutableRefSchema,
|
|
346
428
|
harnessRelease: ModelProjectImmutableRefSchema,
|
|
347
429
|
taskset: ModelProjectVersionedRefSchema,
|
|
348
430
|
tasksetRelease: ModelProjectImmutableRefSchema,
|
|
349
|
-
evaluation:
|
|
431
|
+
evaluation: z7.object({
|
|
350
432
|
taskset: ModelProjectVersionedRefSchema,
|
|
351
433
|
dataset: ModelProjectImmutableRefSchema
|
|
352
434
|
}).strict().nullable().optional(),
|
|
353
435
|
dataset: ModelProjectImmutableRefSchema,
|
|
354
|
-
evidenceSets:
|
|
436
|
+
evidenceSets: z7.array(ModelProjectImmutableRefSchema).max(1e4)
|
|
355
437
|
}).strict();
|
|
356
|
-
var RewardModelTrainingRequestSchema =
|
|
357
|
-
kind:
|
|
438
|
+
var RewardModelTrainingRequestSchema = z7.object({
|
|
439
|
+
kind: z7.literal("reward_model_train"),
|
|
358
440
|
baseModel: ModelProjectBaseModelSchema,
|
|
359
441
|
preferenceDatasetRelease: ModelProjectImmutableRefSchema,
|
|
360
442
|
processorRelease: ModelProjectImmutableRefSchema,
|
|
361
|
-
recipe:
|
|
362
|
-
schemaVersion:
|
|
363
|
-
method:
|
|
364
|
-
parameterization:
|
|
365
|
-
}).catchall(
|
|
443
|
+
recipe: z7.object({
|
|
444
|
+
schemaVersion: z7.literal("openpond.rewardModelRecipe.v1"),
|
|
445
|
+
method: z7.literal("reward_model"),
|
|
446
|
+
parameterization: z7.literal("lora_with_scalar_head")
|
|
447
|
+
}).catchall(z7.unknown())
|
|
366
448
|
}).strict();
|
|
367
|
-
var DeterministicRewardSourceSchema =
|
|
368
|
-
kind:
|
|
449
|
+
var DeterministicRewardSourceSchema = z7.object({
|
|
450
|
+
kind: z7.literal("deterministic"),
|
|
369
451
|
grader: ModelProjectImmutableRefSchema,
|
|
370
452
|
composer: ModelProjectImmutableRefSchema.nullable().default(null)
|
|
371
453
|
}).strict();
|
|
372
|
-
var LearnedRewardSourceSchema =
|
|
373
|
-
kind:
|
|
454
|
+
var LearnedRewardSourceSchema = z7.object({
|
|
455
|
+
kind: z7.literal("learned_reward"),
|
|
374
456
|
rewardModelVersion: ModelProjectImmutableRefSchema,
|
|
375
457
|
qualificationReport: ModelProjectImmutableRefSchema.nullable().default(null),
|
|
376
|
-
evaluationReferences:
|
|
377
|
-
scorerArtifact:
|
|
378
|
-
artifactRef:
|
|
458
|
+
evaluationReferences: z7.array(ModelProjectImmutableRefSchema).max(1e3).default([]),
|
|
459
|
+
scorerArtifact: z7.object({
|
|
460
|
+
artifactRef: z7.string().trim().min(1).max(2e3),
|
|
379
461
|
contentHash: HashSchema3,
|
|
380
462
|
executionReceipt: ModelProjectImmutableRefSchema
|
|
381
463
|
}).strict(),
|
|
382
464
|
processorRelease: ModelProjectImmutableRefSchema,
|
|
383
465
|
rewardComposerRelease: ModelProjectImmutableRefSchema
|
|
384
466
|
}).strict();
|
|
385
|
-
var PolicyOptimizationRequestSchema =
|
|
386
|
-
kind:
|
|
467
|
+
var PolicyOptimizationRequestSchema = z7.object({
|
|
468
|
+
kind: z7.literal("policy_optimize"),
|
|
387
469
|
baseModel: ModelProjectBaseModelSchema,
|
|
388
470
|
recipe: ModelProjectRecipeDocumentSchema,
|
|
389
|
-
rewardSource:
|
|
471
|
+
rewardSource: z7.discriminatedUnion("kind", [
|
|
390
472
|
DeterministicRewardSourceSchema,
|
|
391
473
|
LearnedRewardSourceSchema
|
|
392
474
|
]),
|
|
393
475
|
resumeFrom: ModelProjectImmutableRefSchema.nullable().default(null)
|
|
394
476
|
}).strict();
|
|
395
|
-
var TrainingJobRequestSchema =
|
|
477
|
+
var TrainingJobRequestSchema = z7.discriminatedUnion("kind", [
|
|
396
478
|
RewardModelTrainingRequestSchema,
|
|
397
479
|
PolicyOptimizationRequestSchema
|
|
398
480
|
]);
|
|
399
|
-
var TrainingJobApprovalSchema =
|
|
481
|
+
var TrainingJobApprovalSchema = z7.object({
|
|
400
482
|
approvalHash: HashSchema3,
|
|
401
483
|
approvedAt: TimestampSchema,
|
|
402
|
-
exportApproved:
|
|
403
|
-
maximumSpendUsd:
|
|
404
|
-
retentionDays:
|
|
405
|
-
region:
|
|
484
|
+
exportApproved: z7.boolean(),
|
|
485
|
+
maximumSpendUsd: z7.number().nonnegative(),
|
|
486
|
+
retentionDays: z7.number().int().nonnegative().nullable(),
|
|
487
|
+
region: z7.string().trim().min(1).max(200).nullable().default(null)
|
|
406
488
|
}).strict();
|
|
407
|
-
var TrainingJobSubmissionSchema =
|
|
408
|
-
schemaVersion:
|
|
409
|
-
idempotencyKey:
|
|
410
|
-
name:
|
|
489
|
+
var TrainingJobSubmissionSchema = z7.object({
|
|
490
|
+
schemaVersion: z7.literal("openpond.trainingJobSubmission.v2"),
|
|
491
|
+
idempotencyKey: z7.string().trim().min(1).max(500),
|
|
492
|
+
name: z7.string().trim().min(1).max(200),
|
|
411
493
|
source: TrainingJobSourceSchema,
|
|
412
494
|
job: TrainingJobRequestSchema,
|
|
413
|
-
requestedCapabilities:
|
|
414
|
-
placementObjective:
|
|
415
|
-
budget:
|
|
416
|
-
maximumSpendUsd:
|
|
417
|
-
maximumWallSeconds:
|
|
495
|
+
requestedCapabilities: z7.array(TrainingCapabilityRequirementSchema).max(1e3),
|
|
496
|
+
placementObjective: z7.enum(["fast", "balanced", "economical"]),
|
|
497
|
+
budget: z7.object({
|
|
498
|
+
maximumSpendUsd: z7.number().nonnegative(),
|
|
499
|
+
maximumWallSeconds: z7.number().int().positive()
|
|
418
500
|
}).strict(),
|
|
419
501
|
approval: TrainingJobApprovalSchema,
|
|
420
502
|
contentHash: HashSchema3
|
|
@@ -447,61 +529,61 @@ async function parseAndVerifyTrainingJobSubmission(value) {
|
|
|
447
529
|
}
|
|
448
530
|
return parsed;
|
|
449
531
|
}
|
|
450
|
-
var TrainingJobSchema =
|
|
451
|
-
schemaVersion:
|
|
532
|
+
var TrainingJobSchema = z7.object({
|
|
533
|
+
schemaVersion: z7.literal("openpond.trainingJob.v2"),
|
|
452
534
|
id: IdSchema3,
|
|
453
535
|
teamId: IdSchema3,
|
|
454
536
|
kind: TrainingJobKindSchema,
|
|
455
537
|
modelProjectId: IdSchema3,
|
|
456
538
|
portableProjectId: IdSchema3,
|
|
457
|
-
sourceProjectRevision:
|
|
539
|
+
sourceProjectRevision: z7.number().int().positive(),
|
|
458
540
|
submissionHash: HashSchema3,
|
|
459
541
|
state: TrainingJobStateSchema,
|
|
460
|
-
phase:
|
|
461
|
-
version:
|
|
462
|
-
progress:
|
|
463
|
-
rolloutProgress:
|
|
464
|
-
groupsCompleted:
|
|
465
|
-
groupsTarget:
|
|
466
|
-
optimizerUpdatesApplied:
|
|
467
|
-
optimizerUpdatesSkipped:
|
|
542
|
+
phase: z7.string().trim().min(1).max(200),
|
|
543
|
+
version: z7.number().int().nonnegative(),
|
|
544
|
+
progress: z7.number().min(0).max(1),
|
|
545
|
+
rolloutProgress: z7.object({
|
|
546
|
+
groupsCompleted: z7.number().int().nonnegative(),
|
|
547
|
+
groupsTarget: z7.number().int().nonnegative(),
|
|
548
|
+
optimizerUpdatesApplied: z7.number().int().nonnegative(),
|
|
549
|
+
optimizerUpdatesSkipped: z7.number().int().nonnegative()
|
|
468
550
|
}).strict(),
|
|
469
|
-
accruedSpendUsd:
|
|
470
|
-
terminalReason:
|
|
551
|
+
accruedSpendUsd: z7.number().nonnegative(),
|
|
552
|
+
terminalReason: z7.string().trim().min(1).max(5e3).nullable(),
|
|
471
553
|
createdAt: TimestampSchema,
|
|
472
554
|
updatedAt: TimestampSchema,
|
|
473
555
|
completedAt: TimestampSchema.nullable()
|
|
474
556
|
}).strict();
|
|
475
|
-
var TrainingJobPageSchema =
|
|
476
|
-
schemaVersion:
|
|
477
|
-
jobs:
|
|
478
|
-
nextCursor:
|
|
557
|
+
var TrainingJobPageSchema = z7.object({
|
|
558
|
+
schemaVersion: z7.literal("openpond.trainingJobPage.v2"),
|
|
559
|
+
jobs: z7.array(TrainingJobSchema).max(1e3),
|
|
560
|
+
nextCursor: z7.string().trim().min(1).max(2e3).nullable()
|
|
479
561
|
}).strict();
|
|
480
|
-
var TrainingJobEventSchema =
|
|
481
|
-
schemaVersion:
|
|
562
|
+
var TrainingJobEventSchema = z7.object({
|
|
563
|
+
schemaVersion: z7.literal("openpond.trainingJobEvent.v2"),
|
|
482
564
|
id: IdSchema3,
|
|
483
565
|
jobId: IdSchema3,
|
|
484
|
-
sequence:
|
|
566
|
+
sequence: z7.number().int().nonnegative(),
|
|
485
567
|
type: IdSchema3,
|
|
486
|
-
phase:
|
|
487
|
-
message:
|
|
488
|
-
data:
|
|
568
|
+
phase: z7.string().trim().min(1).max(200),
|
|
569
|
+
message: z7.string().trim().min(1).max(5e3).nullable(),
|
|
570
|
+
data: z7.record(z7.string(), z7.unknown()).default({}),
|
|
489
571
|
createdAt: TimestampSchema
|
|
490
572
|
}).strict();
|
|
491
|
-
var TrainingJobLogSchema =
|
|
492
|
-
schemaVersion:
|
|
573
|
+
var TrainingJobLogSchema = z7.object({
|
|
574
|
+
schemaVersion: z7.literal("openpond.trainingJobLog.v2"),
|
|
493
575
|
jobId: IdSchema3,
|
|
494
|
-
sequence:
|
|
495
|
-
level:
|
|
496
|
-
message:
|
|
576
|
+
sequence: z7.number().int().nonnegative(),
|
|
577
|
+
level: z7.enum(["debug", "info", "warning", "error"]),
|
|
578
|
+
message: z7.string().max(2e4),
|
|
497
579
|
createdAt: TimestampSchema
|
|
498
580
|
}).strict();
|
|
499
|
-
var TrainingJobControlRequestSchema =
|
|
500
|
-
var TrainingJobOutputSchema =
|
|
501
|
-
schemaVersion:
|
|
581
|
+
var TrainingJobControlRequestSchema = z7.object({ expectedVersion: z7.number().int().nonnegative() }).strict();
|
|
582
|
+
var TrainingJobOutputSchema = z7.object({
|
|
583
|
+
schemaVersion: z7.literal("openpond.trainingJobOutput.v2"),
|
|
502
584
|
id: IdSchema3,
|
|
503
585
|
jobId: IdSchema3,
|
|
504
|
-
kind:
|
|
586
|
+
kind: z7.enum([
|
|
505
587
|
"checkpoint",
|
|
506
588
|
"adapter",
|
|
507
589
|
"scorer",
|
|
@@ -510,14 +592,14 @@ var TrainingJobOutputSchema = z6.object({
|
|
|
510
592
|
"trace",
|
|
511
593
|
"receipt"
|
|
512
594
|
]),
|
|
513
|
-
artifactRef:
|
|
595
|
+
artifactRef: z7.string().trim().min(1).max(2e3),
|
|
514
596
|
contentHash: HashSchema3,
|
|
515
|
-
sizeBytes:
|
|
516
|
-
metadata:
|
|
597
|
+
sizeBytes: z7.number().int().nonnegative(),
|
|
598
|
+
metadata: z7.record(z7.string(), z7.unknown()).default({}),
|
|
517
599
|
createdAt: TimestampSchema
|
|
518
600
|
}).strict();
|
|
519
|
-
var TrainingExecutionReceiptSchema =
|
|
520
|
-
schemaVersion:
|
|
601
|
+
var TrainingExecutionReceiptSchema = z7.object({
|
|
602
|
+
schemaVersion: z7.literal("openpond.trainingExecutionReceipt.v2"),
|
|
521
603
|
id: IdSchema3,
|
|
522
604
|
teamId: IdSchema3,
|
|
523
605
|
jobId: IdSchema3,
|
|
@@ -526,14 +608,14 @@ var TrainingExecutionReceiptSchema = z6.object({
|
|
|
526
608
|
recipeHash: HashSchema3,
|
|
527
609
|
capabilityHash: HashSchema3,
|
|
528
610
|
runtimeRelease: ModelProjectImmutableRefSchema,
|
|
529
|
-
inputs:
|
|
530
|
-
outputs:
|
|
531
|
-
spendUsd:
|
|
532
|
-
durationSeconds:
|
|
533
|
-
cleanupComplete:
|
|
611
|
+
inputs: z7.array(ModelProjectImmutableRefSchema).max(1e4),
|
|
612
|
+
outputs: z7.array(ModelProjectImmutableRefSchema).max(1e4),
|
|
613
|
+
spendUsd: z7.number().nonnegative(),
|
|
614
|
+
durationSeconds: z7.number().nonnegative(),
|
|
615
|
+
cleanupComplete: z7.boolean(),
|
|
534
616
|
issuer: IdSchema3,
|
|
535
617
|
issuedAt: TimestampSchema,
|
|
536
|
-
signature:
|
|
618
|
+
signature: z7.string().trim().min(1).max(1e4).nullable()
|
|
537
619
|
}).strict();
|
|
538
620
|
async function trainingExecutionReceiptHash(receipt) {
|
|
539
621
|
return canonicalSha256(TrainingExecutionReceiptSchema.parse(receipt));
|
|
@@ -569,18 +651,18 @@ async function parseAndVerifyTrainingExecutionReceipt(value, expected) {
|
|
|
569
651
|
}
|
|
570
652
|
return receipt;
|
|
571
653
|
}
|
|
572
|
-
var TrainingJobOutputsSchema =
|
|
573
|
-
schemaVersion:
|
|
574
|
-
outputs:
|
|
654
|
+
var TrainingJobOutputsSchema = z7.object({
|
|
655
|
+
schemaVersion: z7.literal("openpond.trainingJobOutputs.v2"),
|
|
656
|
+
outputs: z7.array(TrainingJobOutputSchema).max(1e4),
|
|
575
657
|
receipt: TrainingExecutionReceiptSchema.nullable()
|
|
576
658
|
}).strict();
|
|
577
|
-
var TrainingApiErrorSchema =
|
|
578
|
-
schemaVersion:
|
|
579
|
-
code:
|
|
580
|
-
message:
|
|
581
|
-
retryable:
|
|
582
|
-
requestId:
|
|
583
|
-
details:
|
|
659
|
+
var TrainingApiErrorSchema = z7.object({
|
|
660
|
+
schemaVersion: z7.literal("openpond.trainingApiError.v2"),
|
|
661
|
+
code: z7.string().trim().min(1).max(200),
|
|
662
|
+
message: z7.string().trim().min(1).max(5e3),
|
|
663
|
+
retryable: z7.boolean().default(false),
|
|
664
|
+
requestId: z7.string().trim().min(1).max(500).nullable().default(null),
|
|
665
|
+
details: z7.record(z7.string(), z7.unknown()).default({})
|
|
584
666
|
}).strict();
|
|
585
667
|
var OpenPondTrainingApiError = class extends Error {
|
|
586
668
|
status;
|
|
@@ -598,23 +680,23 @@ var OpenPondTrainingApiError = class extends Error {
|
|
|
598
680
|
this.details = error.details;
|
|
599
681
|
}
|
|
600
682
|
};
|
|
601
|
-
var TrainingCapabilitiesSchema =
|
|
602
|
-
schemaVersion:
|
|
683
|
+
var TrainingCapabilitiesSchema = z7.object({
|
|
684
|
+
schemaVersion: z7.literal("openpond.trainingCapabilities.v2"),
|
|
603
685
|
capabilityHash: HashSchema3,
|
|
604
|
-
jobKinds:
|
|
605
|
-
methods:
|
|
606
|
-
placements:
|
|
607
|
-
|
|
686
|
+
jobKinds: z7.array(TrainingJobKindSchema),
|
|
687
|
+
methods: z7.array(z7.string().trim().min(1).max(200)),
|
|
688
|
+
placements: z7.array(
|
|
689
|
+
z7.enum(["local", "remote", "colocated", "provider_native"])
|
|
608
690
|
),
|
|
609
|
-
controls:
|
|
610
|
-
cancel:
|
|
611
|
-
stopAfterGroup:
|
|
612
|
-
resumeFromCheckpoint:
|
|
691
|
+
controls: z7.object({
|
|
692
|
+
cancel: z7.boolean(),
|
|
693
|
+
stopAfterGroup: z7.boolean(),
|
|
694
|
+
resumeFromCheckpoint: z7.boolean()
|
|
613
695
|
}).strict(),
|
|
614
|
-
limits:
|
|
615
|
-
maximumSpendUsd:
|
|
616
|
-
maximumWallSeconds:
|
|
617
|
-
maximumArtifactBytes:
|
|
696
|
+
limits: z7.object({
|
|
697
|
+
maximumSpendUsd: z7.number().nonnegative(),
|
|
698
|
+
maximumWallSeconds: z7.number().int().positive(),
|
|
699
|
+
maximumArtifactBytes: z7.number().int().positive()
|
|
618
700
|
}).strict(),
|
|
619
701
|
checkedAt: TimestampSchema,
|
|
620
702
|
expiresAt: TimestampSchema
|
|
@@ -670,6 +752,7 @@ function createTrainingClient(input) {
|
|
|
670
752
|
);
|
|
671
753
|
}
|
|
672
754
|
return {
|
|
755
|
+
...createTrainingPreparationClient(request),
|
|
673
756
|
...createTrainingHarnessSourceClient(request),
|
|
674
757
|
...createTrainingCandidateDecisionClient(request),
|
|
675
758
|
async capabilities() {
|
|
@@ -707,12 +790,12 @@ function createTrainingClient(input) {
|
|
|
707
790
|
parameters.set("modelProjectId", IdSchema3.parse(options.modelProjectId));
|
|
708
791
|
}
|
|
709
792
|
if (options.cursor) {
|
|
710
|
-
parameters.set("cursor",
|
|
793
|
+
parameters.set("cursor", z7.string().trim().min(1).max(2e3).parse(options.cursor));
|
|
711
794
|
}
|
|
712
795
|
if (options.limit !== void 0) {
|
|
713
796
|
parameters.set(
|
|
714
797
|
"limit",
|
|
715
|
-
String(
|
|
798
|
+
String(z7.number().int().min(1).max(1e3).parse(options.limit))
|
|
716
799
|
);
|
|
717
800
|
}
|
|
718
801
|
const query = parameters.size > 0 ? `?${parameters.toString()}` : "";
|
|
@@ -753,7 +836,7 @@ function createTrainingClient(input) {
|
|
|
753
836
|
);
|
|
754
837
|
},
|
|
755
838
|
async events(jobId) {
|
|
756
|
-
return
|
|
839
|
+
return z7.array(TrainingJobEventSchema).parse(
|
|
757
840
|
unwrapObject(
|
|
758
841
|
await request(
|
|
759
842
|
`/v1/training/jobs/${encodeURIComponent(IdSchema3.parse(jobId))}/events`
|
|
@@ -773,10 +856,10 @@ function createTrainingClient(input) {
|
|
|
773
856
|
const id = IdSchema3.parse(jobId);
|
|
774
857
|
const reference = ModelProjectImmutableRefSchema.parse(evaluation);
|
|
775
858
|
const parameters = new URLSearchParams();
|
|
776
|
-
const cursor = options.cursor === void 0 ? void 0 :
|
|
777
|
-
const offset = cursor === void 0 ? 0 :
|
|
859
|
+
const cursor = options.cursor === void 0 ? void 0 : z7.string().regex(/^[1-9]\d*$/).parse(options.cursor);
|
|
860
|
+
const offset = cursor === void 0 ? 0 : z7.number().int().min(1).max(9999).parse(Number(cursor));
|
|
778
861
|
if (cursor !== void 0) parameters.set("cursor", cursor);
|
|
779
|
-
if (options.limit !== void 0) parameters.set("limit", String(
|
|
862
|
+
if (options.limit !== void 0) parameters.set("limit", String(z7.number().int().min(1).max(100).parse(options.limit)));
|
|
780
863
|
const query = parameters.size ? `?${parameters.toString()}` : "";
|
|
781
864
|
return parseAndVerifyTrainingEvaluationTaskPage(
|
|
782
865
|
await request(`/v1/training/jobs/${encodeURIComponent(id)}/evaluations/${encodeURIComponent(reference.id)}/tasks${query}`),
|
|
@@ -784,7 +867,7 @@ function createTrainingClient(input) {
|
|
|
784
867
|
);
|
|
785
868
|
},
|
|
786
869
|
async logs(jobId) {
|
|
787
|
-
return
|
|
870
|
+
return z7.array(TrainingJobLogSchema).max(1e5).parse(
|
|
788
871
|
unwrapObject(
|
|
789
872
|
await request(
|
|
790
873
|
`/v1/training/jobs/${encodeURIComponent(IdSchema3.parse(jobId))}/logs`
|
|
@@ -821,6 +904,12 @@ function trainingApiError(value, status) {
|
|
|
821
904
|
}
|
|
822
905
|
|
|
823
906
|
export {
|
|
907
|
+
TrainingPreparationRequestSchema,
|
|
908
|
+
TrainingPreparationPlanContentSchema,
|
|
909
|
+
TrainingPreparationPlanSchema,
|
|
910
|
+
TrainingPreparationReceiptSchema,
|
|
911
|
+
TrainingPreparationControlSchema,
|
|
912
|
+
parseAndVerifyTrainingPreparationReceipt,
|
|
824
913
|
TrainingHarnessSourcePublicationSchema,
|
|
825
914
|
TrainingCandidateDecisionRequestSchema,
|
|
826
915
|
TrainingCandidateDecisionSchema,
|
|
@@ -865,4 +954,4 @@ export {
|
|
|
865
954
|
TrainingCapabilitiesSchema,
|
|
866
955
|
createTrainingClient
|
|
867
956
|
};
|
|
868
|
-
//# sourceMappingURL=chunk-
|
|
957
|
+
//# sourceMappingURL=chunk-5KA6NN6I.js.map
|