raindrop-ai 0.7.1 → 0.8.0
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 +69 -1
- package/dist/{chunk-6WL655QL.mjs → chunk-22CNYHSA.mjs} +399 -110
- package/dist/{chunk-RMP6BZSY.mjs → chunk-EFATLUNL.mjs} +6 -4
- package/dist/{chunk-SHH4SYVY.mjs → chunk-EWHJ2YBW.mjs} +1 -1
- package/dist/evals/cli.js +207 -153
- package/dist/evals/cli.mjs +3 -3
- package/dist/{index-DuJkG47V.d.ts → index-gf1epf_P.d.mts} +186 -86
- package/dist/{index-DuJkG47V.d.mts → index-gf1epf_P.d.ts} +186 -86
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +466 -172
- package/dist/index.mjs +9 -3
- package/dist/{portable-runtime-MFVOVFPB.mjs → portable-runtime-6X2HHB4Y.mjs} +1 -1
- 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 +2 -2
|
@@ -44,8 +44,7 @@ function defineDataset(dataset) {
|
|
|
44
44
|
if (!id) throw new Error("Raindrop eval dataset ids cannot be empty");
|
|
45
45
|
if (!name) throw new Error("Raindrop eval dataset names cannot be empty");
|
|
46
46
|
if (!version) throw new Error("Raindrop eval dataset versions cannot be empty");
|
|
47
|
-
if (dataset.rows.length === 0)
|
|
48
|
-
throw new Error("Raindrop eval datasets require at least one row");
|
|
47
|
+
if (dataset.rows.length === 0) throw new Error("Raindrop eval datasets require at least one row");
|
|
49
48
|
const ids = rows.map((entry) => entry.id);
|
|
50
49
|
if (ids.some((rowId) => !rowId)) throw new Error("Raindrop eval row ids cannot be empty");
|
|
51
50
|
if (new Set(ids).size !== ids.length) throw new Error("Raindrop eval row ids must be unique");
|
|
@@ -139,7 +138,10 @@ function defineEvalSuite(definition) {
|
|
|
139
138
|
if (typeof dataset !== "string")
|
|
140
139
|
throw new Error("A dataset version pin requires a published dataset slug");
|
|
141
140
|
}
|
|
142
|
-
if (
|
|
141
|
+
if (definition.agent !== void 0 && definition.run !== void 0) {
|
|
142
|
+
throw new Error("An eval suite accepts either agent or run, not both");
|
|
143
|
+
}
|
|
144
|
+
if (definition.agent === void 0 && typeof definition.run !== "function") {
|
|
143
145
|
throw new Error("Raindrop eval suite run must be a function");
|
|
144
146
|
}
|
|
145
147
|
if (!Array.isArray(definition.evaluators) || definition.evaluators.length === 0) {
|
|
@@ -1136,7 +1138,7 @@ async function evaluatePortableEvaluator(evaluator, input) {
|
|
|
1136
1138
|
const artifact = await verifyPortableEvalArtifact(evaluator.artifact, {
|
|
1137
1139
|
expectedSha256: evaluator.expectedSha256
|
|
1138
1140
|
});
|
|
1139
|
-
const { runPortableEvaluator } = await import("./portable-runtime-
|
|
1141
|
+
const { runPortableEvaluator } = await import("./portable-runtime-6X2HHB4Y.mjs");
|
|
1140
1142
|
const cases = ((_a = input.rows) != null ? _a : []).map(({ rowId, ...pair }) => ({ ...pair, caseId: rowId }));
|
|
1141
1143
|
if (cases.length > 0 && (cases.length !== input.traces.length || cases.some(
|
|
1142
1144
|
(entry, index) => {
|
|
@@ -1612,7 +1612,7 @@ installTracingSuppressionHook();
|
|
|
1612
1612
|
// package.json
|
|
1613
1613
|
var package_default = {
|
|
1614
1614
|
name: "raindrop-ai",
|
|
1615
|
-
version: "0.
|
|
1615
|
+
version: "0.8.0",
|
|
1616
1616
|
main: "dist/index.js",
|
|
1617
1617
|
module: "dist/index.mjs",
|
|
1618
1618
|
types: "dist/index.d.ts",
|
package/dist/evals/cli.js
CHANGED
|
@@ -5794,8 +5794,7 @@ function defineDataset(dataset) {
|
|
|
5794
5794
|
if (!id) throw new Error("Raindrop eval dataset ids cannot be empty");
|
|
5795
5795
|
if (!name) throw new Error("Raindrop eval dataset names cannot be empty");
|
|
5796
5796
|
if (!version) throw new Error("Raindrop eval dataset versions cannot be empty");
|
|
5797
|
-
if (dataset.rows.length === 0)
|
|
5798
|
-
throw new Error("Raindrop eval datasets require at least one row");
|
|
5797
|
+
if (dataset.rows.length === 0) throw new Error("Raindrop eval datasets require at least one row");
|
|
5799
5798
|
const ids = rows.map((entry) => entry.id);
|
|
5800
5799
|
if (ids.some((rowId) => !rowId)) throw new Error("Raindrop eval row ids cannot be empty");
|
|
5801
5800
|
if (new Set(ids).size !== ids.length) throw new Error("Raindrop eval row ids must be unique");
|
|
@@ -5874,7 +5873,10 @@ function defineEvalSuite(definition) {
|
|
|
5874
5873
|
if (typeof dataset !== "string")
|
|
5875
5874
|
throw new Error("A dataset version pin requires a published dataset slug");
|
|
5876
5875
|
}
|
|
5877
|
-
if (
|
|
5876
|
+
if (definition.agent !== void 0 && definition.run !== void 0) {
|
|
5877
|
+
throw new Error("An eval suite accepts either agent or run, not both");
|
|
5878
|
+
}
|
|
5879
|
+
if (definition.agent === void 0 && typeof definition.run !== "function") {
|
|
5878
5880
|
throw new Error("Raindrop eval suite run must be a function");
|
|
5879
5881
|
}
|
|
5880
5882
|
if (!Array.isArray(definition.evaluators) || definition.evaluators.length === 0) {
|
|
@@ -6999,13 +7001,13 @@ function rowTracePair(pair) {
|
|
|
6999
7001
|
const { caseId, ...evidence } = pair;
|
|
7000
7002
|
return { ...evidence, rowId: caseId };
|
|
7001
7003
|
}
|
|
7002
|
-
var import_quickjs_singlefile_cjs_release_sync, import_quickjs_emscripten_core,
|
|
7004
|
+
var import_quickjs_singlefile_cjs_release_sync, import_quickjs_emscripten_core, import_zod9, DEFAULT_MEMORY_BYTES, DEFAULT_STACK_BYTES, DEFAULT_TIMEOUT_MS, DEFAULT_JUDGE_TIMEOUT_MS, DEFAULT_JUDGE_REQUEST_TIMEOUT_MS, DEFAULT_JUDGE_CONCURRENCY, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_BYTES, JudgeRequestSchema;
|
|
7003
7005
|
var init_portable_runtime = __esm({
|
|
7004
7006
|
"src/evals/portable-runtime.ts"() {
|
|
7005
7007
|
"use strict";
|
|
7006
7008
|
import_quickjs_singlefile_cjs_release_sync = __toESM(require("@jitl/quickjs-singlefile-cjs-release-sync"));
|
|
7007
7009
|
import_quickjs_emscripten_core = require("quickjs-emscripten-core");
|
|
7008
|
-
|
|
7010
|
+
import_zod9 = require("zod");
|
|
7009
7011
|
init_portable();
|
|
7010
7012
|
DEFAULT_MEMORY_BYTES = 32 * 1024 * 1024;
|
|
7011
7013
|
DEFAULT_STACK_BYTES = 64 * 1024;
|
|
@@ -7015,11 +7017,11 @@ var init_portable_runtime = __esm({
|
|
|
7015
7017
|
DEFAULT_JUDGE_CONCURRENCY = 4;
|
|
7016
7018
|
DEFAULT_MAX_INPUT_BYTES = 4 * 1024 * 1024;
|
|
7017
7019
|
DEFAULT_MAX_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
7018
|
-
JudgeRequestSchema =
|
|
7019
|
-
type:
|
|
7020
|
-
requestId:
|
|
7021
|
-
traceId:
|
|
7022
|
-
rubric:
|
|
7020
|
+
JudgeRequestSchema = import_zod9.z.object({
|
|
7021
|
+
type: import_zod9.z.literal("judge_request"),
|
|
7022
|
+
requestId: import_zod9.z.string(),
|
|
7023
|
+
traceId: import_zod9.z.string(),
|
|
7024
|
+
rubric: import_zod9.z.string()
|
|
7023
7025
|
});
|
|
7024
7026
|
}
|
|
7025
7027
|
});
|
|
@@ -7111,67 +7113,67 @@ function canonicalJson2(value) {
|
|
|
7111
7113
|
if (Array.isArray(value)) return `[${value.map(canonicalJson2).join(",")}]`;
|
|
7112
7114
|
return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson2(entry)}`).join(",")}}`;
|
|
7113
7115
|
}
|
|
7114
|
-
var
|
|
7116
|
+
var import_zod10, PortableEvalArtifactSchema, PortableEvalResultSchema;
|
|
7115
7117
|
var init_portable = __esm({
|
|
7116
7118
|
"src/evals/portable.ts"() {
|
|
7117
7119
|
"use strict";
|
|
7118
|
-
|
|
7120
|
+
import_zod10 = require("zod");
|
|
7119
7121
|
init_definition();
|
|
7120
7122
|
init_trace();
|
|
7121
|
-
PortableEvalArtifactSchema =
|
|
7122
|
-
format:
|
|
7123
|
-
formatVersion:
|
|
7124
|
-
runtimeAbi:
|
|
7125
|
-
evaluator:
|
|
7126
|
-
id:
|
|
7127
|
-
slug:
|
|
7128
|
-
programVersion:
|
|
7129
|
-
executionMode:
|
|
7130
|
-
outputType:
|
|
7131
|
-
scope:
|
|
7123
|
+
PortableEvalArtifactSchema = import_zod10.z.object({
|
|
7124
|
+
format: import_zod10.z.literal("raindrop.eval-program"),
|
|
7125
|
+
formatVersion: import_zod10.z.literal(1),
|
|
7126
|
+
runtimeAbi: import_zod10.z.literal("raindrop-eval-v2"),
|
|
7127
|
+
evaluator: import_zod10.z.object({
|
|
7128
|
+
id: import_zod10.z.string().uuid(),
|
|
7129
|
+
slug: import_zod10.z.string().min(1),
|
|
7130
|
+
programVersion: import_zod10.z.number().int().positive(),
|
|
7131
|
+
executionMode: import_zod10.z.enum(["deterministic", "judge"]),
|
|
7132
|
+
outputType: import_zod10.z.enum(["boolean", "score", "number"]),
|
|
7133
|
+
scope: import_zod10.z.literal("batch")
|
|
7132
7134
|
}).strict(),
|
|
7133
|
-
traceProjectionVersion:
|
|
7134
|
-
traceProjectionSha256:
|
|
7135
|
-
source:
|
|
7136
|
-
sha256:
|
|
7135
|
+
traceProjectionVersion: import_zod10.z.literal(1),
|
|
7136
|
+
traceProjectionSha256: import_zod10.z.string().regex(/^[a-f0-9]{64}$/),
|
|
7137
|
+
source: import_zod10.z.string().min(1),
|
|
7138
|
+
sha256: import_zod10.z.string().regex(/^[a-f0-9]{64}$/)
|
|
7137
7139
|
}).strict();
|
|
7138
|
-
PortableEvalResultSchema =
|
|
7139
|
-
outcomes:
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
state:
|
|
7143
|
-
traceId:
|
|
7144
|
-
pass:
|
|
7145
|
-
note:
|
|
7140
|
+
PortableEvalResultSchema = import_zod10.z.object({
|
|
7141
|
+
outcomes: import_zod10.z.array(
|
|
7142
|
+
import_zod10.z.union([
|
|
7143
|
+
import_zod10.z.object({
|
|
7144
|
+
state: import_zod10.z.literal("graded"),
|
|
7145
|
+
traceId: import_zod10.z.string(),
|
|
7146
|
+
pass: import_zod10.z.boolean(),
|
|
7147
|
+
note: import_zod10.z.string().optional()
|
|
7146
7148
|
}),
|
|
7147
|
-
|
|
7148
|
-
state:
|
|
7149
|
-
traceId:
|
|
7149
|
+
import_zod10.z.object({
|
|
7150
|
+
state: import_zod10.z.literal("graded"),
|
|
7151
|
+
traceId: import_zod10.z.string(),
|
|
7150
7152
|
score: EvalScoreSchema,
|
|
7151
|
-
note:
|
|
7153
|
+
note: import_zod10.z.string().optional()
|
|
7152
7154
|
}),
|
|
7153
|
-
|
|
7154
|
-
state:
|
|
7155
|
-
traceId:
|
|
7156
|
-
value:
|
|
7157
|
-
note:
|
|
7155
|
+
import_zod10.z.object({
|
|
7156
|
+
state: import_zod10.z.literal("graded"),
|
|
7157
|
+
traceId: import_zod10.z.string(),
|
|
7158
|
+
value: import_zod10.z.number().finite(),
|
|
7159
|
+
note: import_zod10.z.string().optional()
|
|
7158
7160
|
}),
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
state:
|
|
7162
|
-
traceId:
|
|
7163
|
-
reason:
|
|
7161
|
+
import_zod10.z.object({ state: import_zod10.z.literal("errored"), traceId: import_zod10.z.string(), message: import_zod10.z.string() }),
|
|
7162
|
+
import_zod10.z.object({
|
|
7163
|
+
state: import_zod10.z.literal("ungraded"),
|
|
7164
|
+
traceId: import_zod10.z.string(),
|
|
7165
|
+
reason: import_zod10.z.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
7164
7166
|
})
|
|
7165
7167
|
])
|
|
7166
7168
|
),
|
|
7167
|
-
failures:
|
|
7168
|
-
stats:
|
|
7169
|
-
traceCount:
|
|
7170
|
-
hydratedCount:
|
|
7171
|
-
judgeCalls:
|
|
7172
|
-
durationMs:
|
|
7173
|
-
skippedRows:
|
|
7174
|
-
skippedReason:
|
|
7169
|
+
failures: import_zod10.z.array(import_zod10.z.string()),
|
|
7170
|
+
stats: import_zod10.z.object({
|
|
7171
|
+
traceCount: import_zod10.z.number().int().nonnegative(),
|
|
7172
|
+
hydratedCount: import_zod10.z.number().int().nonnegative(),
|
|
7173
|
+
judgeCalls: import_zod10.z.number().int().nonnegative(),
|
|
7174
|
+
durationMs: import_zod10.z.number().nonnegative(),
|
|
7175
|
+
skippedRows: import_zod10.z.number().int().nonnegative(),
|
|
7176
|
+
skippedReason: import_zod10.z.literal("no trace").nullable()
|
|
7175
7177
|
})
|
|
7176
7178
|
});
|
|
7177
7179
|
}
|
|
@@ -7181,7 +7183,7 @@ var init_portable = __esm({
|
|
|
7181
7183
|
var import_node_path = require("path");
|
|
7182
7184
|
var import_node_url = require("url");
|
|
7183
7185
|
var import_node_util = require("util");
|
|
7184
|
-
var
|
|
7186
|
+
var import_zod13 = require("zod");
|
|
7185
7187
|
|
|
7186
7188
|
// src/lib/inject-als.ts
|
|
7187
7189
|
var import_node_async_hooks = require("async_hooks");
|
|
@@ -12911,7 +12913,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
12911
12913
|
// package.json
|
|
12912
12914
|
var package_default = {
|
|
12913
12915
|
name: "raindrop-ai",
|
|
12914
|
-
version: "0.
|
|
12916
|
+
version: "0.8.0",
|
|
12915
12917
|
main: "dist/index.js",
|
|
12916
12918
|
module: "dist/index.mjs",
|
|
12917
12919
|
types: "dist/index.d.ts",
|
|
@@ -16987,7 +16989,7 @@ function replayIngestEndpoint(value, trustedUrl) {
|
|
|
16987
16989
|
|
|
16988
16990
|
// src/replay/index.ts
|
|
16989
16991
|
var DEFAULT_QUERY_URL = "https://query.raindrop.ai";
|
|
16990
|
-
var DEFAULT_TRACE_WAIT_MS =
|
|
16992
|
+
var DEFAULT_TRACE_WAIT_MS = 6e4;
|
|
16991
16993
|
var DEFAULT_EVAL_WAIT_MS = 10 * 6e4;
|
|
16992
16994
|
var DEFAULT_EVAL_POLL_INTERVAL_MS = 2e3;
|
|
16993
16995
|
var MAX_EVAL_STATUS_RETRIES = 2;
|
|
@@ -17679,12 +17681,17 @@ async function runReplayRows(client, handle, options) {
|
|
|
17679
17681
|
}
|
|
17680
17682
|
}
|
|
17681
17683
|
};
|
|
17682
|
-
await Promise.
|
|
17684
|
+
const workers = await Promise.allSettled(
|
|
17683
17685
|
Array.from(
|
|
17684
17686
|
{ length: Math.min((_f = options.concurrency) != null ? _f : DEFAULT_CONCURRENCY, rows.length) },
|
|
17685
17687
|
() => worker()
|
|
17686
17688
|
)
|
|
17687
17689
|
);
|
|
17690
|
+
const failures = workers.flatMap(
|
|
17691
|
+
(result) => result.status === "rejected" ? [result.reason] : []
|
|
17692
|
+
);
|
|
17693
|
+
if (failures.length === 1) throw failures[0];
|
|
17694
|
+
if (failures.length > 1) throw new AggregateError(failures, "Replay row execution failed");
|
|
17688
17695
|
await client.forceFlush();
|
|
17689
17696
|
const traceEvidence = [];
|
|
17690
17697
|
for (const row of rows) {
|
|
@@ -18664,6 +18671,34 @@ function describeError(cause) {
|
|
|
18664
18671
|
return String(cause);
|
|
18665
18672
|
}
|
|
18666
18673
|
|
|
18674
|
+
// src/evals/agent.ts
|
|
18675
|
+
var import_zod6 = require("zod");
|
|
18676
|
+
var AgentMetadataSchema = import_zod6.z.object({
|
|
18677
|
+
slug: import_zod6.z.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
18678
|
+
name: import_zod6.z.string().trim().min(1).max(120),
|
|
18679
|
+
description: import_zod6.z.string().max(2e3).optional()
|
|
18680
|
+
});
|
|
18681
|
+
async function finishWith(execution, work) {
|
|
18682
|
+
let result;
|
|
18683
|
+
try {
|
|
18684
|
+
result = await work();
|
|
18685
|
+
} catch (error) {
|
|
18686
|
+
await execution.finish().catch(() => void 0);
|
|
18687
|
+
throw error;
|
|
18688
|
+
}
|
|
18689
|
+
await execution.finish();
|
|
18690
|
+
return result;
|
|
18691
|
+
}
|
|
18692
|
+
|
|
18693
|
+
// src/evals/server.ts
|
|
18694
|
+
var import_zod7 = require("zod");
|
|
18695
|
+
var InvocationSchema = import_zod7.z.object({
|
|
18696
|
+
runId: import_zod7.z.string().uuid(),
|
|
18697
|
+
agent: import_zod7.z.string().min(1).max(64),
|
|
18698
|
+
parameters: import_zod7.z.record(import_zod7.z.unknown()).default({})
|
|
18699
|
+
});
|
|
18700
|
+
var MAX_BODY_BYTES = 64 * 1024;
|
|
18701
|
+
|
|
18667
18702
|
// src/evals/index.ts
|
|
18668
18703
|
init_definition();
|
|
18669
18704
|
|
|
@@ -18816,7 +18851,7 @@ function sleep2(ms) {
|
|
|
18816
18851
|
}
|
|
18817
18852
|
|
|
18818
18853
|
// src/evals/publish.ts
|
|
18819
|
-
var
|
|
18854
|
+
var import_zod8 = require("zod");
|
|
18820
18855
|
init_definition();
|
|
18821
18856
|
|
|
18822
18857
|
// src/evals/runs.ts
|
|
@@ -18863,19 +18898,19 @@ async function readEvalRun(client, runId, options = {}) {
|
|
|
18863
18898
|
}
|
|
18864
18899
|
|
|
18865
18900
|
// src/evals/publish.ts
|
|
18866
|
-
var EvaluatorIdentitySchema =
|
|
18867
|
-
id:
|
|
18868
|
-
slug:
|
|
18869
|
-
programVersion:
|
|
18870
|
-
outputType:
|
|
18901
|
+
var EvaluatorIdentitySchema = import_zod8.z.object({
|
|
18902
|
+
id: import_zod8.z.string().uuid(),
|
|
18903
|
+
slug: import_zod8.z.string(),
|
|
18904
|
+
programVersion: import_zod8.z.number().int().positive(),
|
|
18905
|
+
outputType: import_zod8.z.enum(["boolean", "score", "number"])
|
|
18871
18906
|
});
|
|
18872
18907
|
var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
|
|
18873
|
-
name:
|
|
18874
|
-
description:
|
|
18875
|
-
intent:
|
|
18876
|
-
kind:
|
|
18877
|
-
programSource:
|
|
18878
|
-
rules:
|
|
18908
|
+
name: import_zod8.z.string(),
|
|
18909
|
+
description: import_zod8.z.string().nullable(),
|
|
18910
|
+
intent: import_zod8.z.string(),
|
|
18911
|
+
kind: import_zod8.z.enum(["judge", "deterministic"]),
|
|
18912
|
+
programSource: import_zod8.z.string(),
|
|
18913
|
+
rules: import_zod8.z.array(import_zod8.z.string())
|
|
18879
18914
|
});
|
|
18880
18915
|
var EvalPublishError = class extends Error {
|
|
18881
18916
|
constructor(status, message) {
|
|
@@ -18884,12 +18919,12 @@ var EvalPublishError = class extends Error {
|
|
|
18884
18919
|
this.name = "EvalPublishError";
|
|
18885
18920
|
}
|
|
18886
18921
|
};
|
|
18887
|
-
var ComparisonRunSchema =
|
|
18888
|
-
id:
|
|
18889
|
-
programVersion:
|
|
18922
|
+
var ComparisonRunSchema = import_zod8.z.object({
|
|
18923
|
+
id: import_zod8.z.string().uuid(),
|
|
18924
|
+
programVersion: import_zod8.z.number().int().positive()
|
|
18890
18925
|
});
|
|
18891
|
-
var ComparisonLinkSchema =
|
|
18892
|
-
url:
|
|
18926
|
+
var ComparisonLinkSchema = import_zod8.z.object({
|
|
18927
|
+
url: import_zod8.z.string().url(),
|
|
18893
18928
|
first: ComparisonRunSchema,
|
|
18894
18929
|
second: ComparisonRunSchema
|
|
18895
18930
|
});
|
|
@@ -18917,7 +18952,7 @@ async function compareEvalRuns(client, options) {
|
|
|
18917
18952
|
}
|
|
18918
18953
|
const before = selected.id;
|
|
18919
18954
|
const after = counterpart.id;
|
|
18920
|
-
const { data } =
|
|
18955
|
+
const { data } = import_zod8.z.object({ data: ComparisonLinkSchema }).parse(await evalRequest(client, `/v1/eval-runs/${before}/compare/${after}`, options));
|
|
18921
18956
|
if (data.first.id !== before || data.second.id !== after) {
|
|
18922
18957
|
throw new Error("Raindrop returned a different comparison pair");
|
|
18923
18958
|
}
|
|
@@ -18930,7 +18965,7 @@ async function compareEvalRuns(client, options) {
|
|
|
18930
18965
|
};
|
|
18931
18966
|
}
|
|
18932
18967
|
async function readEvaluator(client, slug, options = {}) {
|
|
18933
|
-
const { data } =
|
|
18968
|
+
const { data } = import_zod8.z.object({ data: EvaluatorSourceSchema }).parse(await evalRequest(client, `/v1/evals/${encodeURIComponent(slug)}`, options));
|
|
18934
18969
|
if (data.slug !== slug) throw new Error("Raindrop returned a different evaluator slug");
|
|
18935
18970
|
return defineEvaluatorProgram({
|
|
18936
18971
|
slug: data.slug,
|
|
@@ -19056,34 +19091,34 @@ init_trace();
|
|
|
19056
19091
|
init_portable();
|
|
19057
19092
|
|
|
19058
19093
|
// src/evals/pull.ts
|
|
19059
|
-
var
|
|
19094
|
+
var import_zod11 = require("zod");
|
|
19060
19095
|
init_definition();
|
|
19061
19096
|
init_portable();
|
|
19062
19097
|
var SNAPSHOT_VERSION = 1;
|
|
19063
|
-
var PulledEvaluatorSchema =
|
|
19064
|
-
slug:
|
|
19065
|
-
name:
|
|
19066
|
-
expectedSha256:
|
|
19067
|
-
artifact:
|
|
19098
|
+
var PulledEvaluatorSchema = import_zod11.z.object({
|
|
19099
|
+
slug: import_zod11.z.string().min(1),
|
|
19100
|
+
name: import_zod11.z.string().min(1),
|
|
19101
|
+
expectedSha256: import_zod11.z.string().regex(/^[a-f0-9]{64}$/),
|
|
19102
|
+
artifact: import_zod11.z.unknown()
|
|
19068
19103
|
});
|
|
19069
|
-
var EvalSnapshotSchema =
|
|
19070
|
-
schemaVersion:
|
|
19071
|
-
pulledAt:
|
|
19072
|
-
dataset:
|
|
19073
|
-
reference:
|
|
19074
|
-
datasetId:
|
|
19075
|
-
fingerprint:
|
|
19076
|
-
rows:
|
|
19077
|
-
|
|
19078
|
-
id:
|
|
19079
|
-
name:
|
|
19080
|
-
input:
|
|
19081
|
-
output:
|
|
19082
|
-
properties:
|
|
19104
|
+
var EvalSnapshotSchema = import_zod11.z.object({
|
|
19105
|
+
schemaVersion: import_zod11.z.literal(SNAPSHOT_VERSION),
|
|
19106
|
+
pulledAt: import_zod11.z.string().datetime(),
|
|
19107
|
+
dataset: import_zod11.z.object({
|
|
19108
|
+
reference: import_zod11.z.string().min(1),
|
|
19109
|
+
datasetId: import_zod11.z.string().uuid(),
|
|
19110
|
+
fingerprint: import_zod11.z.string().regex(/^[a-f0-9]{64}$/),
|
|
19111
|
+
rows: import_zod11.z.array(
|
|
19112
|
+
import_zod11.z.object({
|
|
19113
|
+
id: import_zod11.z.string(),
|
|
19114
|
+
name: import_zod11.z.string(),
|
|
19115
|
+
input: import_zod11.z.string().nullable(),
|
|
19116
|
+
output: import_zod11.z.string().nullable(),
|
|
19117
|
+
properties: import_zod11.z.record(import_zod11.z.string())
|
|
19083
19118
|
})
|
|
19084
19119
|
)
|
|
19085
19120
|
}),
|
|
19086
|
-
evaluators:
|
|
19121
|
+
evaluators: import_zod11.z.array(PulledEvaluatorSchema)
|
|
19087
19122
|
});
|
|
19088
19123
|
|
|
19089
19124
|
// src/evals/run.ts
|
|
@@ -19137,46 +19172,46 @@ function outputMismatch(name, output) {
|
|
|
19137
19172
|
init_portable();
|
|
19138
19173
|
|
|
19139
19174
|
// src/evals/workshop.ts
|
|
19140
|
-
var
|
|
19141
|
-
var WorkshopRunSchema =
|
|
19142
|
-
id:
|
|
19143
|
-
event_id:
|
|
19144
|
-
name:
|
|
19145
|
-
event_name:
|
|
19146
|
-
user_id:
|
|
19147
|
-
convo_id:
|
|
19148
|
-
started_at:
|
|
19149
|
-
last_updated_at:
|
|
19150
|
-
metadata:
|
|
19151
|
-
model:
|
|
19152
|
-
finished:
|
|
19175
|
+
var import_zod12 = require("zod");
|
|
19176
|
+
var WorkshopRunSchema = import_zod12.z.object({
|
|
19177
|
+
id: import_zod12.z.string(),
|
|
19178
|
+
event_id: import_zod12.z.string().nullable(),
|
|
19179
|
+
name: import_zod12.z.string().nullable(),
|
|
19180
|
+
event_name: import_zod12.z.string().nullable(),
|
|
19181
|
+
user_id: import_zod12.z.string().nullable(),
|
|
19182
|
+
convo_id: import_zod12.z.string().nullable(),
|
|
19183
|
+
started_at: import_zod12.z.number().nullable(),
|
|
19184
|
+
last_updated_at: import_zod12.z.number().nullable(),
|
|
19185
|
+
metadata: import_zod12.z.string().nullable(),
|
|
19186
|
+
model: import_zod12.z.string().nullable(),
|
|
19187
|
+
finished: import_zod12.z.number().nullable()
|
|
19153
19188
|
});
|
|
19154
|
-
var WorkshopSpanSchema =
|
|
19155
|
-
id:
|
|
19156
|
-
run_id:
|
|
19157
|
-
parent_span_id:
|
|
19158
|
-
name:
|
|
19159
|
-
span_type:
|
|
19160
|
-
status:
|
|
19161
|
-
input_payload:
|
|
19162
|
-
output_payload:
|
|
19163
|
-
start_time_ms:
|
|
19164
|
-
end_time_ms:
|
|
19165
|
-
duration_ms:
|
|
19166
|
-
model:
|
|
19167
|
-
provider:
|
|
19168
|
-
input_tokens:
|
|
19169
|
-
output_tokens:
|
|
19170
|
-
attributes:
|
|
19189
|
+
var WorkshopSpanSchema = import_zod12.z.object({
|
|
19190
|
+
id: import_zod12.z.string(),
|
|
19191
|
+
run_id: import_zod12.z.string(),
|
|
19192
|
+
parent_span_id: import_zod12.z.string().nullable(),
|
|
19193
|
+
name: import_zod12.z.string(),
|
|
19194
|
+
span_type: import_zod12.z.string().nullable(),
|
|
19195
|
+
status: import_zod12.z.string().nullable(),
|
|
19196
|
+
input_payload: import_zod12.z.string().nullable(),
|
|
19197
|
+
output_payload: import_zod12.z.string().nullable(),
|
|
19198
|
+
start_time_ms: import_zod12.z.number().nullable(),
|
|
19199
|
+
end_time_ms: import_zod12.z.number().nullable(),
|
|
19200
|
+
duration_ms: import_zod12.z.number().nullable(),
|
|
19201
|
+
model: import_zod12.z.string().nullable(),
|
|
19202
|
+
provider: import_zod12.z.string().nullable(),
|
|
19203
|
+
input_tokens: import_zod12.z.number().nullable(),
|
|
19204
|
+
output_tokens: import_zod12.z.number().nullable(),
|
|
19205
|
+
attributes: import_zod12.z.string().nullable()
|
|
19171
19206
|
});
|
|
19172
|
-
var WorkshopTraceEnvelopeSchema =
|
|
19173
|
-
status:
|
|
19174
|
-
correlationId:
|
|
19175
|
-
traceId:
|
|
19176
|
-
rootSpanId:
|
|
19177
|
-
spanCount:
|
|
19207
|
+
var WorkshopTraceEnvelopeSchema = import_zod12.z.object({
|
|
19208
|
+
status: import_zod12.z.literal("complete"),
|
|
19209
|
+
correlationId: import_zod12.z.string(),
|
|
19210
|
+
traceId: import_zod12.z.string(),
|
|
19211
|
+
rootSpanId: import_zod12.z.string(),
|
|
19212
|
+
spanCount: import_zod12.z.number().int().positive(),
|
|
19178
19213
|
run: WorkshopRunSchema,
|
|
19179
|
-
spans:
|
|
19214
|
+
spans: import_zod12.z.array(WorkshopSpanSchema).min(1)
|
|
19180
19215
|
});
|
|
19181
19216
|
async function readWorkshopTrace(input) {
|
|
19182
19217
|
if (!Number.isFinite(input.waitMs) || input.waitMs < 0)
|
|
@@ -19260,8 +19295,17 @@ function serializableOutput(value) {
|
|
|
19260
19295
|
|
|
19261
19296
|
// src/evals/run.ts
|
|
19262
19297
|
var DEFAULT_WORKSHOP_TRACE_WAIT_MS = 3e4;
|
|
19263
|
-
function
|
|
19264
|
-
|
|
19298
|
+
function bindSuite(definition, parameters) {
|
|
19299
|
+
if (definition.agent === void 0) {
|
|
19300
|
+
const { run } = definition;
|
|
19301
|
+
return {
|
|
19302
|
+
run: (row) => Promise.resolve().then(() => run(row)),
|
|
19303
|
+
finish: () => Promise.resolve()
|
|
19304
|
+
};
|
|
19305
|
+
}
|
|
19306
|
+
return definition.agent.start(parameters);
|
|
19307
|
+
}
|
|
19308
|
+
function createSuiteSession(client, validated, run, options) {
|
|
19265
19309
|
if (validated.datasetVersionId && "selection" in options && options.selection.dataset.version.id !== validated.datasetVersionId) {
|
|
19266
19310
|
throw new Error("Selected dataset version does not match the published suite");
|
|
19267
19311
|
}
|
|
@@ -19289,6 +19333,7 @@ function createEvalSuiteRun(client, definition, options) {
|
|
|
19289
19333
|
return new RaindropRowEvalRun(
|
|
19290
19334
|
client,
|
|
19291
19335
|
validated,
|
|
19336
|
+
run,
|
|
19292
19337
|
options.destination,
|
|
19293
19338
|
options.selection.dataset,
|
|
19294
19339
|
selection.rowIds,
|
|
@@ -19313,19 +19358,26 @@ function createEvalSuiteRun(client, definition, options) {
|
|
|
19313
19358
|
return new WorkshopEvalRun(
|
|
19314
19359
|
client,
|
|
19315
19360
|
{ ...validated, dataset: validated.dataset },
|
|
19361
|
+
run,
|
|
19316
19362
|
options.destination
|
|
19317
19363
|
);
|
|
19318
19364
|
}
|
|
19319
19365
|
async function runEvalSuite(client, definition, options = {}) {
|
|
19366
|
+
var _a;
|
|
19367
|
+
const validated = validateDefinition(definition);
|
|
19368
|
+
const execution = bindSuite(validated, (_a = options.parameters) != null ? _a : {});
|
|
19369
|
+
return finishWith(execution, () => runSuite(client, validated, execution.run, options));
|
|
19370
|
+
}
|
|
19371
|
+
async function runSuite(client, definition, run, options) {
|
|
19320
19372
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19321
|
-
let validated =
|
|
19373
|
+
let validated = definition;
|
|
19322
19374
|
const destination = (_a = options.destination) != null ? _a : { kind: "raindrop" };
|
|
19323
19375
|
if (validated.datasetVersionId && ((_b = options.selection) == null ? void 0 : _b.dataset) && options.selection.dataset.version.id !== validated.datasetVersionId) {
|
|
19324
19376
|
throw new Error("Selected dataset version does not match the published suite");
|
|
19325
19377
|
}
|
|
19326
19378
|
if (destination.kind === "workshop") {
|
|
19327
19379
|
if (options.runId !== void 0) throw new Error("Queued runs are only supported in Raindrop");
|
|
19328
|
-
const session =
|
|
19380
|
+
const session = createSuiteSession(client, validated, run, { destination });
|
|
19329
19381
|
await session.run({ selection: options.selection, attempt: options.attempt });
|
|
19330
19382
|
return session.finish();
|
|
19331
19383
|
}
|
|
@@ -19359,7 +19411,7 @@ async function runEvalSuite(client, definition, options = {}) {
|
|
|
19359
19411
|
rowIds: (_h = (_g = options.selection) == null ? void 0 : _g.rowIds) != null ? _h : dataset.rows.map((entry) => entry.id)
|
|
19360
19412
|
});
|
|
19361
19413
|
if (!selection) throw new Error("Raindrop remote eval requires selected rows");
|
|
19362
|
-
const session =
|
|
19414
|
+
const session = createSuiteSession(client, validated, run, {
|
|
19363
19415
|
destination,
|
|
19364
19416
|
selection: { dataset, rowIds: selection.rowIds }
|
|
19365
19417
|
});
|
|
@@ -19393,7 +19445,7 @@ async function runEvalSuite(client, definition, options = {}) {
|
|
|
19393
19445
|
}
|
|
19394
19446
|
return finished;
|
|
19395
19447
|
}
|
|
19396
|
-
return runRaindropEval(client, validated, destination, options);
|
|
19448
|
+
return runRaindropEval(client, validated, run, destination, options);
|
|
19397
19449
|
}
|
|
19398
19450
|
function isRowScopedLocalEval(definition) {
|
|
19399
19451
|
return definition.evaluators.every(
|
|
@@ -19401,9 +19453,10 @@ function isRowScopedLocalEval(definition) {
|
|
|
19401
19453
|
);
|
|
19402
19454
|
}
|
|
19403
19455
|
var RaindropRowEvalRun = class {
|
|
19404
|
-
constructor(client, definition, destination, dataset, rowIds, evaluators) {
|
|
19456
|
+
constructor(client, definition, runRow, destination, dataset, rowIds, evaluators) {
|
|
19405
19457
|
this.client = client;
|
|
19406
19458
|
this.definition = definition;
|
|
19459
|
+
this.runRow = runRow;
|
|
19407
19460
|
this.destination = destination;
|
|
19408
19461
|
this.dataset = dataset;
|
|
19409
19462
|
this.rowIds = rowIds;
|
|
@@ -19453,7 +19506,7 @@ var RaindropRowEvalRun = class {
|
|
|
19453
19506
|
const attemptResult = await replay2.run({
|
|
19454
19507
|
rowId,
|
|
19455
19508
|
attempt,
|
|
19456
|
-
run: this.
|
|
19509
|
+
run: this.runRow,
|
|
19457
19510
|
traceWaitMs: this.definition.traceWaitMs
|
|
19458
19511
|
});
|
|
19459
19512
|
const configured = new Map(
|
|
@@ -19558,9 +19611,10 @@ function replayEvaluatorsFromVerdicts(verdicts) {
|
|
|
19558
19611
|
return [...evaluators.values()];
|
|
19559
19612
|
}
|
|
19560
19613
|
var WorkshopEvalRun = class {
|
|
19561
|
-
constructor(client, definition, destination) {
|
|
19614
|
+
constructor(client, definition, runRow, destination) {
|
|
19562
19615
|
this.client = client;
|
|
19563
19616
|
this.definition = definition;
|
|
19617
|
+
this.runRow = runRow;
|
|
19564
19618
|
this.destination = destination;
|
|
19565
19619
|
this.id = randomId();
|
|
19566
19620
|
this.startedAt = /* @__PURE__ */ new Date();
|
|
@@ -19690,7 +19744,7 @@ var WorkshopEvalRun = class {
|
|
|
19690
19744
|
() => {
|
|
19691
19745
|
var _a2;
|
|
19692
19746
|
const parent = (_a2 = import_api8.trace.getSpan(import_api8.context.active())) == null ? void 0 : _a2.spanContext();
|
|
19693
|
-
if (!parent) return this.
|
|
19747
|
+
if (!parent) return this.runRow(row);
|
|
19694
19748
|
return withReplayTraceDestination(
|
|
19695
19749
|
{
|
|
19696
19750
|
...destination,
|
|
@@ -19700,7 +19754,7 @@ var WorkshopEvalRun = class {
|
|
|
19700
19754
|
eventId: parent.traceId
|
|
19701
19755
|
}
|
|
19702
19756
|
},
|
|
19703
|
-
() => this.
|
|
19757
|
+
() => this.runRow(row)
|
|
19704
19758
|
);
|
|
19705
19759
|
}
|
|
19706
19760
|
)
|
|
@@ -19878,7 +19932,7 @@ var WorkshopEvalRun = class {
|
|
|
19878
19932
|
return current;
|
|
19879
19933
|
}
|
|
19880
19934
|
};
|
|
19881
|
-
async function runRaindropEval(client, definition, destination, options) {
|
|
19935
|
+
async function runRaindropEval(client, definition, run, destination, options) {
|
|
19882
19936
|
var _a, _b, _c, _d;
|
|
19883
19937
|
if (typeof definition.dataset !== "string") {
|
|
19884
19938
|
throw new Error(
|
|
@@ -19905,7 +19959,7 @@ async function runRaindropEval(client, definition, destination, options) {
|
|
|
19905
19959
|
dataset: pinnedDataset ? datasetToWire(pinnedDataset) : datasetReference,
|
|
19906
19960
|
evaluators: definition.evaluators.map((entry) => replayEvaluator(entry)),
|
|
19907
19961
|
evaluatorPins: hostedEvaluatorPins(definition.evaluators),
|
|
19908
|
-
run
|
|
19962
|
+
run,
|
|
19909
19963
|
concurrency: definition.concurrency,
|
|
19910
19964
|
traceWaitMs: definition.traceWaitMs,
|
|
19911
19965
|
evalWaitMs: definition.evalWaitMs,
|
|
@@ -21555,8 +21609,8 @@ var index_default = Raindrop;
|
|
|
21555
21609
|
|
|
21556
21610
|
// src/evals/cli.ts
|
|
21557
21611
|
init_definition();
|
|
21558
|
-
var SuiteModuleSchema =
|
|
21559
|
-
default:
|
|
21612
|
+
var SuiteModuleSchema = import_zod13.z.object({
|
|
21613
|
+
default: import_zod13.z.custom(isEvalSuiteDefinition)
|
|
21560
21614
|
});
|
|
21561
21615
|
async function main() {
|
|
21562
21616
|
var _a, _b;
|