raindrop-ai 1.0.0 → 1.0.1-otelv2
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/README.md +7 -3
- package/dist/{chunk-MVJNJ4TS.mjs → chunk-K427YJE7.mjs} +52 -10
- package/dist/{chunk-GQKFYSJ5.mjs → chunk-M6RTFC5O.mjs} +1 -1
- package/dist/{chunk-X637VXF6.mjs → chunk-OZMT7UW4.mjs} +14 -4
- package/dist/evals/cli.js +58 -9
- package/dist/evals/cli.mjs +3 -3
- package/dist/{index-BBP9eqvk.d.ts → index-Dwn_0jsy.d.mts} +242 -13
- package/dist/{index-BBP9eqvk.d.mts → index-Dwn_0jsy.d.ts} +242 -13
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +66 -13
- package/dist/index.mjs +5 -3
- package/dist/{portable-runtime-IIFK7U5Q.mjs → portable-runtime-SHDZJP7W.mjs} +2 -2
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -167,6 +167,10 @@ Use the returned `runId` with `readEvalRun`, `evaluateEvalRun`, or `compareEvalR
|
|
|
167
167
|
|
|
168
168
|
### Run eval agents on your server
|
|
169
169
|
|
|
170
|
+
POST requests accept `{ runId, agent, parameters, concurrency? }`. Set `concurrency` to an integer from 1 to 100 to limit simultaneous rows in that run; omitting it keeps the default of four. The request body may contain up to 1 MiB of UTF-8 JSON, including long prompt parameters.
|
|
171
|
+
|
|
172
|
+
GET includes `concurrencySupported: true`. Clients can check this before sending a concurrency limit because older handlers ignore that field.
|
|
173
|
+
|
|
170
174
|
Protect the route with your existing authentication before calling `handleEval`. The handler does not authenticate incoming requests. Run it on a server that can await the entire execution. Do not return early from a serverless request.
|
|
171
175
|
|
|
172
176
|
The simplest agent is a slug and a `run` function:
|
|
@@ -187,7 +191,7 @@ export async function route(request: Request): Promise<Response> {
|
|
|
187
191
|
}
|
|
188
192
|
```
|
|
189
193
|
|
|
190
|
-
Declare `parameters` to vary the agent per run without redeploying. Each key is a `z.string()`, `z.number()`, `z.boolean()`, or `z.enum()` schema, optionally with `.default()`, `.optional()`, and `.describe()`. Raindrop reads the schema from `GET`, renders one form control per key, and saves each edit as a new version of a named parameter set, so runs pin an exact version. The handler validates incoming values and applies defaults before any row runs; a mismatch returns 400 with the schema error instead of claiming the run. `context.parameters`
|
|
194
|
+
Declare `parameters` to vary the agent per run without redeploying. Each key is a `z.string()`, `z.number()`, `z.boolean()`, or `z.enum()` schema, optionally with `.default()`, `.optional()`, and `.describe()`. Raindrop reads the schema from `GET`, renders one form control per key, and saves each edit as a new version of a named parameter set, so runs pin an exact version. The handler validates incoming values and applies defaults before any row runs; a mismatch returns 400 with the schema error instead of claiming the run. `context.parameters` includes the typed declared fields and any additional string, finite number, or boolean values. Agents without a `parameters` declaration also accept these custom values. Extra values cannot be objects, arrays, or `null`.
|
|
191
195
|
|
|
192
196
|
```ts
|
|
193
197
|
import { z } from "zod";
|
|
@@ -315,7 +319,7 @@ After the traces land, `replay` starts each requested evaluator against the
|
|
|
315
319
|
replay and waits for its result. Each item in `result.rows` contains the
|
|
316
320
|
original dataset row, its trace status, and one verdict per evaluator in
|
|
317
321
|
`row.verdicts`. A verdict identifies its `evaluator` and contains either the
|
|
318
|
-
grade (`pass`, `score`, or `
|
|
322
|
+
grade (`pass`, `score`, `value`, or `preference`), an evaluator error, or the reason it was
|
|
319
323
|
not graded.
|
|
320
324
|
|
|
321
325
|
`result.evaluators` contains aggregate status, summary, error, and URL for each
|
|
@@ -347,7 +351,7 @@ const result = await replay(raindrop, {
|
|
|
347
351
|
|
|
348
352
|
The callback receives the dataset `row` and the value returned by `run`. It
|
|
349
353
|
runs immediately after the row finishes, while the local environment is still
|
|
350
|
-
available. Return `{ pass, note? }`, `{ score, note? }`, or `{
|
|
354
|
+
available. Return `{ pass, note? }`, `{ score, note? }`, `{ value, note? }`, or `{ preference: "A" | "B" | "tie", note? }`
|
|
351
355
|
to match the saved evaluator's output type. A thrown error is stored as that
|
|
352
356
|
row's errored verdict. Raindrop marks the resulting run as `local` in the UI.
|
|
353
357
|
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
withReplayTraceDestination,
|
|
37
37
|
withRoutingContext,
|
|
38
38
|
withTask
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-M6RTFC5O.mjs";
|
|
40
40
|
import {
|
|
41
41
|
CapturedTraceSnapshotSchema,
|
|
42
42
|
EvalCaseExpectationSchema,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
traceToolCalls,
|
|
58
58
|
validateEvaluatorOutput,
|
|
59
59
|
verifyPortableEvalArtifact
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-OZMT7UW4.mjs";
|
|
61
61
|
import {
|
|
62
62
|
__commonJS,
|
|
63
63
|
__toESM
|
|
@@ -10247,6 +10247,12 @@ var ReplayEvaluatorStatsSchema = z3.object({
|
|
|
10247
10247
|
skippedReason: z3.literal("no trace").nullable()
|
|
10248
10248
|
});
|
|
10249
10249
|
var ReplayEvaluatorSummarySchema = z3.discriminatedUnion("outputType", [
|
|
10250
|
+
z3.object({
|
|
10251
|
+
outputType: z3.literal("preference"),
|
|
10252
|
+
counts: ReplayEvaluatorCountsSchema,
|
|
10253
|
+
stats: ReplayEvaluatorStatsSchema,
|
|
10254
|
+
preferences: z3.object({ A: z3.number(), B: z3.number(), tie: z3.number() })
|
|
10255
|
+
}),
|
|
10250
10256
|
z3.object({
|
|
10251
10257
|
outputType: z3.literal("boolean"),
|
|
10252
10258
|
counts: ReplayEvaluatorCountsSchema,
|
|
@@ -10288,6 +10294,7 @@ var ReplayVerdictSchema = z3.union([
|
|
|
10288
10294
|
ReplayVerdictGradedSchema.extend({ pass: z3.boolean() }),
|
|
10289
10295
|
ReplayVerdictGradedSchema.extend({ score: EvalScoreSchema }),
|
|
10290
10296
|
ReplayVerdictGradedSchema.extend({ value: z3.number().finite() }),
|
|
10297
|
+
ReplayVerdictGradedSchema.extend({ preference: z3.enum(["A", "B", "tie"]) }),
|
|
10291
10298
|
ReplayVerdictIdentitySchema.extend({
|
|
10292
10299
|
state: z3.literal("errored"),
|
|
10293
10300
|
message: z3.string()
|
|
@@ -10335,10 +10342,15 @@ var LocalScoreVerdictSchema = z3.object({
|
|
|
10335
10342
|
note: z3.string().trim().min(1).max(600).optional()
|
|
10336
10343
|
}).strict();
|
|
10337
10344
|
var LocalNumberVerdictSchema = z3.object({ value: z3.number().finite(), note: z3.string().trim().min(1).max(600).optional() }).strict();
|
|
10345
|
+
var LocalPreferenceVerdictSchema = z3.object({
|
|
10346
|
+
preference: z3.enum(["A", "B", "tie"]),
|
|
10347
|
+
note: z3.string().trim().min(1).max(600).optional()
|
|
10348
|
+
}).strict();
|
|
10338
10349
|
var LocalVerdictSchema = z3.union([
|
|
10339
10350
|
LocalBooleanVerdictSchema,
|
|
10340
10351
|
LocalScoreVerdictSchema,
|
|
10341
|
-
LocalNumberVerdictSchema
|
|
10352
|
+
LocalNumberVerdictSchema,
|
|
10353
|
+
LocalPreferenceVerdictSchema
|
|
10342
10354
|
]);
|
|
10343
10355
|
async function queryApi(request) {
|
|
10344
10356
|
var _a, _b;
|
|
@@ -10452,7 +10464,7 @@ var EvalRunDetailSchema = WireReplayDetailSchema.extend({
|
|
|
10452
10464
|
id: z3.string().uuid(),
|
|
10453
10465
|
eval_id: z3.string().uuid(),
|
|
10454
10466
|
program_version: z3.number().int().positive(),
|
|
10455
|
-
output_type: z3.enum(["boolean", "score", "number"]),
|
|
10467
|
+
output_type: z3.enum(["boolean", "score", "number", "preference"]),
|
|
10456
10468
|
executed_by: z3.enum(["hosted", "local"]),
|
|
10457
10469
|
status: z3.enum(["running", "completed", "failed"])
|
|
10458
10470
|
})
|
|
@@ -10484,7 +10496,7 @@ var WireLocalEvaluatorSchema = z3.object({
|
|
|
10484
10496
|
id: z3.string().uuid(),
|
|
10485
10497
|
slug: z3.string(),
|
|
10486
10498
|
name: z3.string(),
|
|
10487
|
-
output: z3.enum(["boolean", "score", "number"]),
|
|
10499
|
+
output: z3.enum(["boolean", "score", "number", "preference"]),
|
|
10488
10500
|
kind: z3.literal("local"),
|
|
10489
10501
|
programVersion: z3.number().int().positive()
|
|
10490
10502
|
})
|
|
@@ -10525,6 +10537,12 @@ var WireEvalRunSchema = z3.object({
|
|
|
10525
10537
|
value: z3.number().finite(),
|
|
10526
10538
|
note: z3.string().optional()
|
|
10527
10539
|
}),
|
|
10540
|
+
z3.object({
|
|
10541
|
+
state: z3.literal("graded"),
|
|
10542
|
+
traceId: z3.string(),
|
|
10543
|
+
preference: z3.enum(["A", "B", "tie"]),
|
|
10544
|
+
note: z3.string().optional()
|
|
10545
|
+
}),
|
|
10528
10546
|
z3.object({ state: z3.literal("errored"), traceId: z3.string(), message: z3.string() }),
|
|
10529
10547
|
z3.object({
|
|
10530
10548
|
state: z3.literal("ungraded"),
|
|
@@ -11562,6 +11580,8 @@ function parseLocalVerdict(evaluator, verdict) {
|
|
|
11562
11580
|
return LocalScoreVerdictSchema.parse(verdict);
|
|
11563
11581
|
case "number":
|
|
11564
11582
|
return LocalNumberVerdictSchema.parse(verdict);
|
|
11583
|
+
case "preference":
|
|
11584
|
+
return LocalPreferenceVerdictSchema.parse(verdict);
|
|
11565
11585
|
}
|
|
11566
11586
|
}
|
|
11567
11587
|
async function submitLocalEvaluator(client, replayId, state, queryUrl, traceEvidence) {
|
|
@@ -11679,6 +11699,9 @@ function replayVerdict(evaluator, outcome) {
|
|
|
11679
11699
|
if ("score" in outcome) {
|
|
11680
11700
|
return { ...identity, state: outcome.state, score: outcome.score, note: outcome.note };
|
|
11681
11701
|
}
|
|
11702
|
+
if ("preference" in outcome) {
|
|
11703
|
+
return { ...identity, state: outcome.state, preference: outcome.preference, note: outcome.note };
|
|
11704
|
+
}
|
|
11682
11705
|
return { ...identity, state: outcome.state, value: outcome.value, note: outcome.note };
|
|
11683
11706
|
}
|
|
11684
11707
|
function replayResultRows(handle, reading, evaluators) {
|
|
@@ -11919,6 +11942,7 @@ function describeError(cause) {
|
|
|
11919
11942
|
|
|
11920
11943
|
// src/evals/agent.ts
|
|
11921
11944
|
import { z as z4 } from "zod";
|
|
11945
|
+
var ParameterValueSchema = z4.union([z4.string(), z4.number().finite(), z4.boolean()]);
|
|
11922
11946
|
var EvalParameterError = class extends Error {
|
|
11923
11947
|
constructor(agent, issues) {
|
|
11924
11948
|
super(
|
|
@@ -12005,7 +12029,7 @@ function defineAgent(definition) {
|
|
|
12005
12029
|
if (entries.length > MAX_PARAMETERS)
|
|
12006
12030
|
throw new Error(`Agent ${slug} declares more than ${MAX_PARAMETERS} parameters`);
|
|
12007
12031
|
const parameters = entries.map(([key, schema2]) => describeParameterField(key, schema2));
|
|
12008
|
-
const schema = z4.object(fields).
|
|
12032
|
+
const schema = z4.object(fields).catchall(ParameterValueSchema);
|
|
12009
12033
|
return {
|
|
12010
12034
|
slug,
|
|
12011
12035
|
name,
|
|
@@ -12075,9 +12099,10 @@ import { z as z5 } from "zod";
|
|
|
12075
12099
|
var InvocationSchema = z5.object({
|
|
12076
12100
|
runId: z5.string().uuid(),
|
|
12077
12101
|
agent: z5.string().min(1).max(64),
|
|
12078
|
-
parameters: z5.record(z5.unknown()).default({})
|
|
12102
|
+
parameters: z5.record(z5.unknown()).default({}),
|
|
12103
|
+
concurrency: z5.number().int().min(1).max(100).optional()
|
|
12079
12104
|
});
|
|
12080
|
-
var MAX_BODY_BYTES =
|
|
12105
|
+
var MAX_BODY_BYTES = 1024 * 1024;
|
|
12081
12106
|
async function parseInvocation(request) {
|
|
12082
12107
|
var _a;
|
|
12083
12108
|
if (Number((_a = request.headers.get("content-length")) != null ? _a : 0) > MAX_BODY_BYTES) return void 0;
|
|
@@ -12115,7 +12140,8 @@ function createEvalHandler(client, options) {
|
|
|
12115
12140
|
parameters
|
|
12116
12141
|
}));
|
|
12117
12142
|
return async (request) => {
|
|
12118
|
-
if (request.method === "GET")
|
|
12143
|
+
if (request.method === "GET")
|
|
12144
|
+
return Response.json({ agents: catalog, concurrencySupported: true });
|
|
12119
12145
|
if (request.method !== "POST") {
|
|
12120
12146
|
return Response.json(
|
|
12121
12147
|
{ error: "Method not allowed" },
|
|
@@ -12148,6 +12174,7 @@ function createEvalHandler(client, options) {
|
|
|
12148
12174
|
execution,
|
|
12149
12175
|
() => runEvalReplay(client, handle, {
|
|
12150
12176
|
run: execution.run,
|
|
12177
|
+
concurrency: invocation.concurrency,
|
|
12151
12178
|
queryUrl: options.queryUrl,
|
|
12152
12179
|
replayIngestUrl: options.replayIngestUrl
|
|
12153
12180
|
})
|
|
@@ -12367,7 +12394,7 @@ var EvaluatorIdentitySchema = z6.object({
|
|
|
12367
12394
|
id: z6.string().uuid(),
|
|
12368
12395
|
slug: z6.string(),
|
|
12369
12396
|
programVersion: z6.number().int().positive(),
|
|
12370
|
-
outputType: z6.enum(["boolean", "score", "number"])
|
|
12397
|
+
outputType: z6.enum(["boolean", "score", "number", "preference"])
|
|
12371
12398
|
});
|
|
12372
12399
|
var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
|
|
12373
12400
|
name: z6.string(),
|
|
@@ -12740,6 +12767,12 @@ function assessEvalVerdict(evaluator, verdict, resolvedOutput) {
|
|
|
12740
12767
|
if (output === void 0) {
|
|
12741
12768
|
throw new Error(`Raindrop hosted evaluator ${name} requires its canonical output type`);
|
|
12742
12769
|
}
|
|
12770
|
+
if (output === "preference") {
|
|
12771
|
+
if (!("preference" in verdict)) throw outputMismatch(name, output);
|
|
12772
|
+
if (evaluator.threshold !== void 0)
|
|
12773
|
+
throw new Error("Preference evaluators do not accept thresholds");
|
|
12774
|
+
return { state: "measurement", evaluator: name, verdict };
|
|
12775
|
+
}
|
|
12743
12776
|
if (output === "boolean") {
|
|
12744
12777
|
if (!("pass" in verdict)) throw outputMismatch(name, output);
|
|
12745
12778
|
const threshold2 = evaluator.threshold;
|
|
@@ -13200,6 +13233,14 @@ function replayEvaluator(entry) {
|
|
|
13200
13233
|
judge: ({ case: pair, ...context2 }) => evaluator.judge({ ...context2, reference: pair == null ? void 0 : pair.reference }),
|
|
13201
13234
|
requiresReference: evaluator.requiresReference
|
|
13202
13235
|
};
|
|
13236
|
+
case "preference":
|
|
13237
|
+
return {
|
|
13238
|
+
slug: evaluator.slug,
|
|
13239
|
+
name: evaluator.name,
|
|
13240
|
+
output: evaluator.output,
|
|
13241
|
+
judge: ({ case: pair, ...context2 }) => evaluator.judge({ ...context2, reference: pair == null ? void 0 : pair.reference }),
|
|
13242
|
+
requiresReference: evaluator.requiresReference
|
|
13243
|
+
};
|
|
13203
13244
|
}
|
|
13204
13245
|
}
|
|
13205
13246
|
function validateDefinition(definition) {
|
|
@@ -14608,6 +14649,7 @@ export {
|
|
|
14608
14649
|
LocalBooleanVerdictSchema,
|
|
14609
14650
|
LocalScoreVerdictSchema,
|
|
14610
14651
|
LocalNumberVerdictSchema,
|
|
14652
|
+
LocalPreferenceVerdictSchema,
|
|
14611
14653
|
LocalVerdictSchema,
|
|
14612
14654
|
createReplay,
|
|
14613
14655
|
claimReplay,
|
|
@@ -1784,7 +1784,7 @@ installTracingSuppressionHook();
|
|
|
1784
1784
|
// package.json
|
|
1785
1785
|
var package_default = {
|
|
1786
1786
|
name: "raindrop-ai",
|
|
1787
|
-
version: "1.0.
|
|
1787
|
+
version: "1.0.1",
|
|
1788
1788
|
main: "dist/index.js",
|
|
1789
1789
|
module: "dist/index.mjs",
|
|
1790
1790
|
types: "dist/index.d.ts",
|
|
@@ -912,7 +912,7 @@ function defineDataset(dataset) {
|
|
|
912
912
|
function isEvalDataset(value) {
|
|
913
913
|
return typeof value === "object" && value !== null && EVAL_DATASET in value && value[EVAL_DATASET] === true;
|
|
914
914
|
}
|
|
915
|
-
var EvalOutputSchema = z3.enum(["boolean", "score", "number"]);
|
|
915
|
+
var EvalOutputSchema = z3.enum(["boolean", "score", "number", "preference"]);
|
|
916
916
|
function defineEvaluatorProgram(program) {
|
|
917
917
|
var _a, _b, _c, _d;
|
|
918
918
|
const slug = program.slug.trim();
|
|
@@ -1029,6 +1029,10 @@ function validateEvaluatorOutput(evaluator, rawOutput) {
|
|
|
1029
1029
|
throw new Error(`Raindrop local evaluator ${name} expected ${localOutput}, received ${output}`);
|
|
1030
1030
|
}
|
|
1031
1031
|
switch (output) {
|
|
1032
|
+
case "preference":
|
|
1033
|
+
if (evaluator.threshold !== void 0)
|
|
1034
|
+
throw new Error("Preference evaluators do not accept thresholds");
|
|
1035
|
+
break;
|
|
1032
1036
|
case "boolean":
|
|
1033
1037
|
parseBooleanThreshold(evaluator.threshold);
|
|
1034
1038
|
break;
|
|
@@ -1117,7 +1121,7 @@ var PortableEvalArtifactSchema = z4.object({
|
|
|
1117
1121
|
slug: z4.string().min(1),
|
|
1118
1122
|
programVersion: z4.number().int().positive(),
|
|
1119
1123
|
executionMode: z4.enum(["deterministic", "judge"]),
|
|
1120
|
-
outputType: z4.enum(["boolean", "score", "number"]),
|
|
1124
|
+
outputType: z4.enum(["boolean", "score", "number", "preference"]),
|
|
1121
1125
|
scope: z4.literal("trace")
|
|
1122
1126
|
}).strict(),
|
|
1123
1127
|
traceProjectionVersion: z4.literal(1),
|
|
@@ -1155,6 +1159,12 @@ var PortableEvalResultSchema = z4.object({
|
|
|
1155
1159
|
value: z4.number().finite(),
|
|
1156
1160
|
note: z4.string().optional()
|
|
1157
1161
|
}),
|
|
1162
|
+
z4.object({
|
|
1163
|
+
state: z4.literal("graded"),
|
|
1164
|
+
traceId: z4.string(),
|
|
1165
|
+
preference: z4.enum(["A", "B", "tie"]),
|
|
1166
|
+
note: z4.string().optional()
|
|
1167
|
+
}),
|
|
1158
1168
|
z4.object({ state: z4.literal("errored"), traceId: z4.string(), message: z4.string() }),
|
|
1159
1169
|
z4.object({
|
|
1160
1170
|
state: z4.literal("ungraded"),
|
|
@@ -1204,7 +1214,7 @@ async function evaluatePortableEvaluator(evaluator, input) {
|
|
|
1204
1214
|
if (new Set(input.traces.map((trace) => trace.event.id)).size !== input.traces.length) {
|
|
1205
1215
|
throw new Error("Raindrop portable evaluator input trace ids must be unique");
|
|
1206
1216
|
}
|
|
1207
|
-
const { runPortableEvaluator } = await import("./portable-runtime-
|
|
1217
|
+
const { runPortableEvaluator } = await import("./portable-runtime-SHDZJP7W.mjs");
|
|
1208
1218
|
const cases = ((_a = input.rows) != null ? _a : []).map(({ rowId, ...pair }) => ({ ...pair, caseId: rowId }));
|
|
1209
1219
|
if (cases.length > 0 && (cases.length !== input.traces.length || cases.some(
|
|
1210
1220
|
(entry, index) => {
|
|
@@ -1254,7 +1264,7 @@ function validatePortableResult(artifact, traces, result) {
|
|
|
1254
1264
|
}
|
|
1255
1265
|
returned.add(outcome.traceId);
|
|
1256
1266
|
if (outcome.state !== "graded") continue;
|
|
1257
|
-
const valid = artifact.evaluator.outputType === "boolean" ? "pass" in outcome : artifact.evaluator.outputType === "score" ? "score" in outcome : "value" in outcome;
|
|
1267
|
+
const valid = artifact.evaluator.outputType === "boolean" ? "pass" in outcome : artifact.evaluator.outputType === "score" ? "score" in outcome : artifact.evaluator.outputType === "preference" ? "preference" in outcome : "value" in outcome;
|
|
1258
1268
|
if (!valid) {
|
|
1259
1269
|
throw new Error(
|
|
1260
1270
|
`Raindrop portable evaluator ${artifact.evaluator.slug} returned the wrong graded value`
|
package/dist/evals/cli.js
CHANGED
|
@@ -6518,6 +6518,10 @@ function validateEvaluatorOutput(evaluator, rawOutput) {
|
|
|
6518
6518
|
throw new Error(`Raindrop local evaluator ${name} expected ${localOutput}, received ${output}`);
|
|
6519
6519
|
}
|
|
6520
6520
|
switch (output) {
|
|
6521
|
+
case "preference":
|
|
6522
|
+
if (evaluator.threshold !== void 0)
|
|
6523
|
+
throw new Error("Preference evaluators do not accept thresholds");
|
|
6524
|
+
break;
|
|
6521
6525
|
case "boolean":
|
|
6522
6526
|
parseBooleanThreshold(evaluator.threshold);
|
|
6523
6527
|
break;
|
|
@@ -6618,7 +6622,7 @@ var init_definition = __esm({
|
|
|
6618
6622
|
output: JsonValueSchema.default(null),
|
|
6619
6623
|
properties: import_zod4.z.record(import_zod4.z.string()).default({})
|
|
6620
6624
|
});
|
|
6621
|
-
EvalOutputSchema = import_zod4.z.enum(["boolean", "score", "number"]);
|
|
6625
|
+
EvalOutputSchema = import_zod4.z.enum(["boolean", "score", "number", "preference"]);
|
|
6622
6626
|
EVAL_DEFINITION = /* @__PURE__ */ Symbol.for("raindrop.evalDefinition");
|
|
6623
6627
|
}
|
|
6624
6628
|
});
|
|
@@ -6640,7 +6644,7 @@ var init_portable = __esm({
|
|
|
6640
6644
|
slug: import_zod10.z.string().min(1),
|
|
6641
6645
|
programVersion: import_zod10.z.number().int().positive(),
|
|
6642
6646
|
executionMode: import_zod10.z.enum(["deterministic", "judge"]),
|
|
6643
|
-
outputType: import_zod10.z.enum(["boolean", "score", "number"]),
|
|
6647
|
+
outputType: import_zod10.z.enum(["boolean", "score", "number", "preference"]),
|
|
6644
6648
|
scope: import_zod10.z.literal("trace")
|
|
6645
6649
|
}).strict(),
|
|
6646
6650
|
traceProjectionVersion: import_zod10.z.literal(1),
|
|
@@ -6678,6 +6682,12 @@ var init_portable = __esm({
|
|
|
6678
6682
|
value: import_zod10.z.number().finite(),
|
|
6679
6683
|
note: import_zod10.z.string().optional()
|
|
6680
6684
|
}),
|
|
6685
|
+
import_zod10.z.object({
|
|
6686
|
+
state: import_zod10.z.literal("graded"),
|
|
6687
|
+
traceId: import_zod10.z.string(),
|
|
6688
|
+
preference: import_zod10.z.enum(["A", "B", "tie"]),
|
|
6689
|
+
note: import_zod10.z.string().optional()
|
|
6690
|
+
}),
|
|
6681
6691
|
import_zod10.z.object({ state: import_zod10.z.literal("errored"), traceId: import_zod10.z.string(), message: import_zod10.z.string() }),
|
|
6682
6692
|
import_zod10.z.object({
|
|
6683
6693
|
state: import_zod10.z.literal("ungraded"),
|
|
@@ -12605,7 +12615,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
12605
12615
|
// package.json
|
|
12606
12616
|
var package_default = {
|
|
12607
12617
|
name: "raindrop-ai",
|
|
12608
|
-
version: "1.0.
|
|
12618
|
+
version: "1.0.1",
|
|
12609
12619
|
main: "dist/index.js",
|
|
12610
12620
|
module: "dist/index.mjs",
|
|
12611
12621
|
types: "dist/index.d.ts",
|
|
@@ -16818,6 +16828,12 @@ var ReplayEvaluatorStatsSchema = import_zod6.z.object({
|
|
|
16818
16828
|
skippedReason: import_zod6.z.literal("no trace").nullable()
|
|
16819
16829
|
});
|
|
16820
16830
|
var ReplayEvaluatorSummarySchema = import_zod6.z.discriminatedUnion("outputType", [
|
|
16831
|
+
import_zod6.z.object({
|
|
16832
|
+
outputType: import_zod6.z.literal("preference"),
|
|
16833
|
+
counts: ReplayEvaluatorCountsSchema,
|
|
16834
|
+
stats: ReplayEvaluatorStatsSchema,
|
|
16835
|
+
preferences: import_zod6.z.object({ A: import_zod6.z.number(), B: import_zod6.z.number(), tie: import_zod6.z.number() })
|
|
16836
|
+
}),
|
|
16821
16837
|
import_zod6.z.object({
|
|
16822
16838
|
outputType: import_zod6.z.literal("boolean"),
|
|
16823
16839
|
counts: ReplayEvaluatorCountsSchema,
|
|
@@ -16859,6 +16875,7 @@ var ReplayVerdictSchema = import_zod6.z.union([
|
|
|
16859
16875
|
ReplayVerdictGradedSchema.extend({ pass: import_zod6.z.boolean() }),
|
|
16860
16876
|
ReplayVerdictGradedSchema.extend({ score: EvalScoreSchema }),
|
|
16861
16877
|
ReplayVerdictGradedSchema.extend({ value: import_zod6.z.number().finite() }),
|
|
16878
|
+
ReplayVerdictGradedSchema.extend({ preference: import_zod6.z.enum(["A", "B", "tie"]) }),
|
|
16862
16879
|
ReplayVerdictIdentitySchema.extend({
|
|
16863
16880
|
state: import_zod6.z.literal("errored"),
|
|
16864
16881
|
message: import_zod6.z.string()
|
|
@@ -16906,10 +16923,15 @@ var LocalScoreVerdictSchema = import_zod6.z.object({
|
|
|
16906
16923
|
note: import_zod6.z.string().trim().min(1).max(600).optional()
|
|
16907
16924
|
}).strict();
|
|
16908
16925
|
var LocalNumberVerdictSchema = import_zod6.z.object({ value: import_zod6.z.number().finite(), note: import_zod6.z.string().trim().min(1).max(600).optional() }).strict();
|
|
16926
|
+
var LocalPreferenceVerdictSchema = import_zod6.z.object({
|
|
16927
|
+
preference: import_zod6.z.enum(["A", "B", "tie"]),
|
|
16928
|
+
note: import_zod6.z.string().trim().min(1).max(600).optional()
|
|
16929
|
+
}).strict();
|
|
16909
16930
|
var LocalVerdictSchema = import_zod6.z.union([
|
|
16910
16931
|
LocalBooleanVerdictSchema,
|
|
16911
16932
|
LocalScoreVerdictSchema,
|
|
16912
|
-
LocalNumberVerdictSchema
|
|
16933
|
+
LocalNumberVerdictSchema,
|
|
16934
|
+
LocalPreferenceVerdictSchema
|
|
16913
16935
|
]);
|
|
16914
16936
|
async function queryApi(request) {
|
|
16915
16937
|
var _a, _b;
|
|
@@ -17023,7 +17045,7 @@ var EvalRunDetailSchema = WireReplayDetailSchema.extend({
|
|
|
17023
17045
|
id: import_zod6.z.string().uuid(),
|
|
17024
17046
|
eval_id: import_zod6.z.string().uuid(),
|
|
17025
17047
|
program_version: import_zod6.z.number().int().positive(),
|
|
17026
|
-
output_type: import_zod6.z.enum(["boolean", "score", "number"]),
|
|
17048
|
+
output_type: import_zod6.z.enum(["boolean", "score", "number", "preference"]),
|
|
17027
17049
|
executed_by: import_zod6.z.enum(["hosted", "local"]),
|
|
17028
17050
|
status: import_zod6.z.enum(["running", "completed", "failed"])
|
|
17029
17051
|
})
|
|
@@ -17055,7 +17077,7 @@ var WireLocalEvaluatorSchema = import_zod6.z.object({
|
|
|
17055
17077
|
id: import_zod6.z.string().uuid(),
|
|
17056
17078
|
slug: import_zod6.z.string(),
|
|
17057
17079
|
name: import_zod6.z.string(),
|
|
17058
|
-
output: import_zod6.z.enum(["boolean", "score", "number"]),
|
|
17080
|
+
output: import_zod6.z.enum(["boolean", "score", "number", "preference"]),
|
|
17059
17081
|
kind: import_zod6.z.literal("local"),
|
|
17060
17082
|
programVersion: import_zod6.z.number().int().positive()
|
|
17061
17083
|
})
|
|
@@ -17096,6 +17118,12 @@ var WireEvalRunSchema = import_zod6.z.object({
|
|
|
17096
17118
|
value: import_zod6.z.number().finite(),
|
|
17097
17119
|
note: import_zod6.z.string().optional()
|
|
17098
17120
|
}),
|
|
17121
|
+
import_zod6.z.object({
|
|
17122
|
+
state: import_zod6.z.literal("graded"),
|
|
17123
|
+
traceId: import_zod6.z.string(),
|
|
17124
|
+
preference: import_zod6.z.enum(["A", "B", "tie"]),
|
|
17125
|
+
note: import_zod6.z.string().optional()
|
|
17126
|
+
}),
|
|
17099
17127
|
import_zod6.z.object({ state: import_zod6.z.literal("errored"), traceId: import_zod6.z.string(), message: import_zod6.z.string() }),
|
|
17100
17128
|
import_zod6.z.object({
|
|
17101
17129
|
state: import_zod6.z.literal("ungraded"),
|
|
@@ -18105,6 +18133,8 @@ function parseLocalVerdict(evaluator, verdict) {
|
|
|
18105
18133
|
return LocalScoreVerdictSchema.parse(verdict);
|
|
18106
18134
|
case "number":
|
|
18107
18135
|
return LocalNumberVerdictSchema.parse(verdict);
|
|
18136
|
+
case "preference":
|
|
18137
|
+
return LocalPreferenceVerdictSchema.parse(verdict);
|
|
18108
18138
|
}
|
|
18109
18139
|
}
|
|
18110
18140
|
async function submitLocalEvaluator(client, replayId, state2, queryUrl, traceEvidence) {
|
|
@@ -18218,6 +18248,9 @@ function replayVerdict(evaluator, outcome) {
|
|
|
18218
18248
|
if ("score" in outcome) {
|
|
18219
18249
|
return { ...identity, state: outcome.state, score: outcome.score, note: outcome.note };
|
|
18220
18250
|
}
|
|
18251
|
+
if ("preference" in outcome) {
|
|
18252
|
+
return { ...identity, state: outcome.state, preference: outcome.preference, note: outcome.note };
|
|
18253
|
+
}
|
|
18221
18254
|
return { ...identity, state: outcome.state, value: outcome.value, note: outcome.note };
|
|
18222
18255
|
}
|
|
18223
18256
|
function replayResultRows(handle, reading, evaluators) {
|
|
@@ -18461,6 +18494,7 @@ init_manifest();
|
|
|
18461
18494
|
|
|
18462
18495
|
// src/evals/agent.ts
|
|
18463
18496
|
var import_zod7 = require("zod");
|
|
18497
|
+
var ParameterValueSchema = import_zod7.z.union([import_zod7.z.string(), import_zod7.z.number().finite(), import_zod7.z.boolean()]);
|
|
18464
18498
|
var AgentMetadataSchema = import_zod7.z.object({
|
|
18465
18499
|
slug: import_zod7.z.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
18466
18500
|
name: import_zod7.z.string().trim().min(1).max(120),
|
|
@@ -18483,9 +18517,10 @@ var import_zod8 = require("zod");
|
|
|
18483
18517
|
var InvocationSchema = import_zod8.z.object({
|
|
18484
18518
|
runId: import_zod8.z.string().uuid(),
|
|
18485
18519
|
agent: import_zod8.z.string().min(1).max(64),
|
|
18486
|
-
parameters: import_zod8.z.record(import_zod8.z.unknown()).default({})
|
|
18520
|
+
parameters: import_zod8.z.record(import_zod8.z.unknown()).default({}),
|
|
18521
|
+
concurrency: import_zod8.z.number().int().min(1).max(100).optional()
|
|
18487
18522
|
});
|
|
18488
|
-
var MAX_BODY_BYTES =
|
|
18523
|
+
var MAX_BODY_BYTES = 1024 * 1024;
|
|
18489
18524
|
|
|
18490
18525
|
// src/evals/index.ts
|
|
18491
18526
|
init_definition();
|
|
@@ -18690,7 +18725,7 @@ var EvaluatorIdentitySchema = import_zod9.z.object({
|
|
|
18690
18725
|
id: import_zod9.z.string().uuid(),
|
|
18691
18726
|
slug: import_zod9.z.string(),
|
|
18692
18727
|
programVersion: import_zod9.z.number().int().positive(),
|
|
18693
|
-
outputType: import_zod9.z.enum(["boolean", "score", "number"])
|
|
18728
|
+
outputType: import_zod9.z.enum(["boolean", "score", "number", "preference"])
|
|
18694
18729
|
});
|
|
18695
18730
|
var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
|
|
18696
18731
|
name: import_zod9.z.string(),
|
|
@@ -18923,6 +18958,12 @@ function assessEvalVerdict(evaluator, verdict, resolvedOutput) {
|
|
|
18923
18958
|
if (output === void 0) {
|
|
18924
18959
|
throw new Error(`Raindrop hosted evaluator ${name} requires its canonical output type`);
|
|
18925
18960
|
}
|
|
18961
|
+
if (output === "preference") {
|
|
18962
|
+
if (!("preference" in verdict)) throw outputMismatch(name, output);
|
|
18963
|
+
if (evaluator.threshold !== void 0)
|
|
18964
|
+
throw new Error("Preference evaluators do not accept thresholds");
|
|
18965
|
+
return { state: "measurement", evaluator: name, verdict };
|
|
18966
|
+
}
|
|
18926
18967
|
if (output === "boolean") {
|
|
18927
18968
|
if (!("pass" in verdict)) throw outputMismatch(name, output);
|
|
18928
18969
|
const threshold2 = evaluator.threshold;
|
|
@@ -19370,6 +19411,14 @@ function replayEvaluator(entry) {
|
|
|
19370
19411
|
judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
|
|
19371
19412
|
requiresReference: evaluator.requiresReference
|
|
19372
19413
|
};
|
|
19414
|
+
case "preference":
|
|
19415
|
+
return {
|
|
19416
|
+
slug: evaluator.slug,
|
|
19417
|
+
name: evaluator.name,
|
|
19418
|
+
output: evaluator.output,
|
|
19419
|
+
judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
|
|
19420
|
+
requiresReference: evaluator.requiresReference
|
|
19421
|
+
};
|
|
19373
19422
|
}
|
|
19374
19423
|
}
|
|
19375
19424
|
function validateDefinition(definition) {
|
package/dist/evals/cli.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
publishEvalSuite,
|
|
6
6
|
readEvaluator,
|
|
7
7
|
runEvalSuite
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-K427YJE7.mjs";
|
|
9
|
+
import "../chunk-M6RTFC5O.mjs";
|
|
10
10
|
import {
|
|
11
11
|
isEvalSuiteDefinition
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-OZMT7UW4.mjs";
|
|
13
13
|
import "../chunk-UJCSKKID.mjs";
|
|
14
14
|
|
|
15
15
|
// src/evals/cli.ts
|