@velum-labs/routekit-eval-setup 1.0.2 → 1.0.4
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.
|
@@ -134,7 +134,9 @@ const DIMENSIONS_JSON_SCHEMA = {
|
|
|
134
134
|
properties: {
|
|
135
135
|
dimensions: {
|
|
136
136
|
type: "array",
|
|
137
|
-
minItems
|
|
137
|
+
// Anthropic structured outputs only accept minItems values of 0 or 1.
|
|
138
|
+
// assertRoutingBasis enforces the required 5–10 dimensions after parsing.
|
|
139
|
+
minItems: 1,
|
|
138
140
|
maxItems: 10,
|
|
139
141
|
items: {
|
|
140
142
|
type: "object",
|
|
@@ -4,8 +4,9 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import test from "node:test";
|
|
6
6
|
import { layer as NodeServicesLayer } from "@effect/platform-node/NodeServices";
|
|
7
|
-
import { Effect } from "effect";
|
|
8
|
-
import {
|
|
7
|
+
import { Effect, Layer } from "effect";
|
|
8
|
+
import { EvalProjectAuthoringError } from "../errors.js";
|
|
9
|
+
import { EvalAuthoringTransport, EvalProjectAuthor, EvalProjectAuthorLive, readProjectAuthoringSources } from "../project-authoring.js";
|
|
9
10
|
const withRepository = async (use) => {
|
|
10
11
|
const root = await mkdtemp(path.join(os.tmpdir(), "routekit-author-sources-"));
|
|
11
12
|
const outside = await mkdtemp(path.join(os.tmpdir(), "routekit-author-outside-"));
|
|
@@ -22,6 +23,46 @@ const withRepository = async (use) => {
|
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
const read = (input) => Effect.runPromise(readProjectAuthoringSources(input).pipe(Effect.provide(NodeServicesLayer)));
|
|
26
|
+
const configuration = {
|
|
27
|
+
workloadDescription: "Route production requests across separable workload dimensions.",
|
|
28
|
+
candidateModels: ["openai/candidate-a", "openai/candidate-b"],
|
|
29
|
+
classifierModel: "openai/classifier",
|
|
30
|
+
authorModel: "claude-code/claude-opus-5",
|
|
31
|
+
judgeModel: "openai/judge",
|
|
32
|
+
objective: { kind: "highest-quality" },
|
|
33
|
+
maximumUnknownWeight: 0.2
|
|
34
|
+
};
|
|
35
|
+
const dimensions = (count) => Array.from({ length: count }, (_, index) => ({
|
|
36
|
+
id: `dimension-${String(index + 1)}`,
|
|
37
|
+
description: `Production workload dimension ${String(index + 1)}`,
|
|
38
|
+
includes: [`Requests that exercise dimension ${String(index + 1)}`],
|
|
39
|
+
excludes: ["Requests that exercise a different dimension"]
|
|
40
|
+
}));
|
|
41
|
+
const proposeDimensions = (root, output, requests = []) => Effect.runPromise(Effect.gen(function* () {
|
|
42
|
+
const author = yield* EvalProjectAuthor;
|
|
43
|
+
return yield* author.proposeDimensions({
|
|
44
|
+
operationId: "eng-830",
|
|
45
|
+
repositoryRoot: root,
|
|
46
|
+
sourceInventory: ["source.md"],
|
|
47
|
+
configuration
|
|
48
|
+
});
|
|
49
|
+
}).pipe(Effect.provide(EvalProjectAuthorLive.pipe(Layer.provide(Layer.succeed(EvalAuthoringTransport, EvalAuthoringTransport.of({
|
|
50
|
+
complete: (input) => Effect.sync(() => {
|
|
51
|
+
requests.push(input);
|
|
52
|
+
return JSON.stringify(output);
|
|
53
|
+
})
|
|
54
|
+
}))), Layer.provide(NodeServicesLayer)))));
|
|
55
|
+
const collectMinimumItems = (value) => {
|
|
56
|
+
if (typeof value !== "object" || value === null)
|
|
57
|
+
return [];
|
|
58
|
+
if (Array.isArray(value))
|
|
59
|
+
return value.flatMap(collectMinimumItems);
|
|
60
|
+
const record = value;
|
|
61
|
+
return [
|
|
62
|
+
...(typeof record.minItems === "number" ? [record.minItems] : []),
|
|
63
|
+
...Object.values(record).flatMap(collectMinimumItems)
|
|
64
|
+
];
|
|
65
|
+
};
|
|
25
66
|
test("authoring reads an exact discovered regular source", async () => {
|
|
26
67
|
await withRepository(async ({ root }) => {
|
|
27
68
|
assert.deepEqual(await read({
|
|
@@ -65,3 +106,37 @@ test("authoring rejects a selected file absent from discovery inventory", async
|
|
|
65
106
|
}), /not in the bounded discovery inventory/u);
|
|
66
107
|
});
|
|
67
108
|
});
|
|
109
|
+
test("dimension authoring sends an Anthropic-compatible structured output schema", async () => {
|
|
110
|
+
await withRepository(async ({ root }) => {
|
|
111
|
+
const requests = [];
|
|
112
|
+
assert.equal((await proposeDimensions(root, { dimensions: dimensions(5) }, requests)).length, 5);
|
|
113
|
+
assert.equal(requests.length, 1);
|
|
114
|
+
const schema = requests[0]?.jsonSchema;
|
|
115
|
+
assert.ok(schema !== undefined);
|
|
116
|
+
assert.deepEqual(collectMinimumItems(schema), [1, 1, 1]);
|
|
117
|
+
const dimensionsSchema = schema.properties?.dimensions;
|
|
118
|
+
assert.equal(dimensionsSchema?.type, "array");
|
|
119
|
+
assert.equal(dimensionsSchema.minItems, 1);
|
|
120
|
+
assert.equal(dimensionsSchema.maxItems, 10);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
test("dimension authoring enforces routing basis counts after structured output parsing", async () => {
|
|
124
|
+
await withRepository(async ({ root }) => {
|
|
125
|
+
for (const count of [4, 11]) {
|
|
126
|
+
await assert.rejects(proposeDimensions(root, { dimensions: dimensions(count) }), (error) => {
|
|
127
|
+
assert.ok(error instanceof EvalProjectAuthoringError);
|
|
128
|
+
assert.equal(error.detail, "dimension proposal failed validation");
|
|
129
|
+
assert.match(String(error.cause), /between 5 and 10 dimensions/u);
|
|
130
|
+
return true;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const missingBoundary = dimensions(5);
|
|
134
|
+
missingBoundary[0] = { ...missingBoundary[0], includes: [] };
|
|
135
|
+
await assert.rejects(proposeDimensions(root, { dimensions: missingBoundary }), (error) => {
|
|
136
|
+
assert.ok(error instanceof EvalProjectAuthoringError);
|
|
137
|
+
assert.equal(error.detail, "dimension proposal failed validation");
|
|
138
|
+
assert.match(String(error.cause), /inclusion and exclusion boundaries/u);
|
|
139
|
+
return true;
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velum-labs/routekit-eval-setup",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/velum-labs/routekit.git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"effect": "4.0.0-rc.108",
|
|
35
|
-
"@velum-labs/routekit-
|
|
36
|
-
"@velum-labs/routekit-
|
|
35
|
+
"@velum-labs/routekit-eval-contracts": "1.0.4",
|
|
36
|
+
"@velum-labs/routekit-runtime": "1.0.4"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"routekit",
|