@plune-ai/cli 0.39.13 → 0.39.15
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 +25 -4
- package/dist/cli.cjs +8772 -8494
- package/dist/{execute-CR3Ixbxj.d.cts → execute-DLNnhkEM.d.cts} +13 -3
- package/dist/{execute-CR3Ixbxj.d.ts → execute-DLNnhkEM.d.ts} +13 -3
- package/dist/index.cjs +137 -3
- package/dist/index.d.cts +70 -22
- package/dist/index.d.ts +70 -22
- package/dist/index.js +137 -3
- package/dist/mcp-http.cjs +24 -15
- package/dist/mcp-http.d.cts +3 -2
- package/dist/mcp-http.d.ts +3 -2
- package/dist/mcp-http.js +24 -15
- package/dist/mcp-tools.cjs +14 -9
- package/dist/mcp-tools.d.cts +1 -1
- package/dist/mcp-tools.d.ts +1 -1
- package/dist/mcp-tools.js +14 -9
- package/package.json +1 -1
|
@@ -883,10 +883,13 @@ declare function isPluneToolName(name: string): name is PluneToolName;
|
|
|
883
883
|
/**
|
|
884
884
|
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
885
|
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*
|
|
887
|
+
* `disabled` names the tools switched off for this caller: none of them is offered, and discovery is offered only while
|
|
888
|
+
* a hidden tool is left for it to find. A name that is no tool is ignored.
|
|
886
889
|
*/
|
|
887
|
-
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
-
/** The tools a client is shown before it asks for more;
|
|
889
|
-
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
890
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write', disabled?: readonly string[]): boolean;
|
|
891
|
+
/** The tools a client is shown before it asks for more; only those it is offered (the scope, the tools switched off). */
|
|
892
|
+
declare function defaultVisibleTools(scope?: 'read' | 'write', disabled?: readonly string[]): PluneToolName[];
|
|
890
893
|
|
|
891
894
|
/**
|
|
892
895
|
* Runs a tool of the contract against the platform's HTTP API. Transport-free: the MCP server wraps it, and so can the
|
|
@@ -915,6 +918,13 @@ interface PluneToolExecutorOptions {
|
|
|
915
918
|
sessionId?: string | undefined;
|
|
916
919
|
/** The token's scope when it is known. `read` refuses every write before a request is made. */
|
|
917
920
|
scope?: TokenScope | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* Tools switched off for this caller, by name: none is shown, found by discover_tools or run, and a call to one by
|
|
923
|
+
* its name is refused with `tool_disabled` before any request. A name that is no tool is ignored (a host may hold a
|
|
924
|
+
* name from an older or newer tool set). It hides the tool, not the API route behind it: `plune_api_request` still
|
|
925
|
+
* reaches every route the token may use.
|
|
926
|
+
*/
|
|
927
|
+
disabledTools?: readonly string[] | undefined;
|
|
918
928
|
fetchImpl?: typeof fetch | undefined;
|
|
919
929
|
userAgent?: string | undefined;
|
|
920
930
|
now?: (() => number) | undefined;
|
|
@@ -883,10 +883,13 @@ declare function isPluneToolName(name: string): name is PluneToolName;
|
|
|
883
883
|
/**
|
|
884
884
|
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
885
|
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*
|
|
887
|
+
* `disabled` names the tools switched off for this caller: none of them is offered, and discovery is offered only while
|
|
888
|
+
* a hidden tool is left for it to find. A name that is no tool is ignored.
|
|
886
889
|
*/
|
|
887
|
-
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
-
/** The tools a client is shown before it asks for more;
|
|
889
|
-
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
890
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write', disabled?: readonly string[]): boolean;
|
|
891
|
+
/** The tools a client is shown before it asks for more; only those it is offered (the scope, the tools switched off). */
|
|
892
|
+
declare function defaultVisibleTools(scope?: 'read' | 'write', disabled?: readonly string[]): PluneToolName[];
|
|
890
893
|
|
|
891
894
|
/**
|
|
892
895
|
* Runs a tool of the contract against the platform's HTTP API. Transport-free: the MCP server wraps it, and so can the
|
|
@@ -915,6 +918,13 @@ interface PluneToolExecutorOptions {
|
|
|
915
918
|
sessionId?: string | undefined;
|
|
916
919
|
/** The token's scope when it is known. `read` refuses every write before a request is made. */
|
|
917
920
|
scope?: TokenScope | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* Tools switched off for this caller, by name: none is shown, found by discover_tools or run, and a call to one by
|
|
923
|
+
* its name is refused with `tool_disabled` before any request. A name that is no tool is ignored (a host may hold a
|
|
924
|
+
* name from an older or newer tool set). It hides the tool, not the API route behind it: `plune_api_request` still
|
|
925
|
+
* reaches every route the token may use.
|
|
926
|
+
*/
|
|
927
|
+
disabledTools?: readonly string[] | undefined;
|
|
918
928
|
fetchImpl?: typeof fetch | undefined;
|
|
919
929
|
userAgent?: string | undefined;
|
|
920
930
|
now?: (() => number) | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -1172,10 +1172,25 @@ var jsonSchemaAssertionSchema = import_zod.z.object({
|
|
|
1172
1172
|
schema: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()),
|
|
1173
1173
|
extract: import_zod.z.enum(["auto", "strict"]).optional()
|
|
1174
1174
|
});
|
|
1175
|
+
var jevJudgeSchema = import_zod.z.strictObject({
|
|
1176
|
+
type: import_zod.z.literal("jev"),
|
|
1177
|
+
model: import_zod.z.string().min(1),
|
|
1178
|
+
timeout: providerTimeoutSchema.optional()
|
|
1179
|
+
});
|
|
1180
|
+
var partialProviderSchema = providerConfigSchema.partial();
|
|
1181
|
+
var llmJudgeProviderField = import_zod.z.any().transform((value, ctx) => {
|
|
1182
|
+
const jev = typeof value === "object" && value !== null && value.type === "jev";
|
|
1183
|
+
const r = (jev ? jevJudgeSchema : partialProviderSchema).safeParse(value);
|
|
1184
|
+
if (r.success) return r.data;
|
|
1185
|
+
for (const issue of r.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
|
|
1186
|
+
return import_zod.z.NEVER;
|
|
1187
|
+
});
|
|
1175
1188
|
var llmJudgeAssertionSchema = import_zod.z.object({
|
|
1176
1189
|
type: import_zod.z.literal("llm-judge"),
|
|
1177
1190
|
criteria: import_zod.z.string().min(1),
|
|
1178
|
-
|
|
1191
|
+
// `type: jev` is a judge of another kind (a decision model) with fields of its own; anything else is the eval's
|
|
1192
|
+
// provider with these fields over it.
|
|
1193
|
+
provider: llmJudgeProviderField.optional(),
|
|
1179
1194
|
// The judge's score floor, not the eval's share of passing runs (that one is `evalRepeatsShape`).
|
|
1180
1195
|
pass_threshold: import_zod.z.number().min(0, "pass_threshold (llm-judge: minimum judge score) must be between 0 and 1").max(1, "pass_threshold (llm-judge: minimum judge score) must be between 0 and 1").optional()
|
|
1181
1196
|
});
|
|
@@ -1757,6 +1772,8 @@ var PRICE_TABLE = {
|
|
|
1757
1772
|
"claude-fable-5-1": { input_per_1k_usd: 0.01, output_per_1k_usd: 0.05 },
|
|
1758
1773
|
"claude-opus-5-5": { input_per_1k_usd: 4e-3, output_per_1k_usd: 0.02 },
|
|
1759
1774
|
"claude-sonnet-5-5": { input_per_1k_usd: 2e-3, output_per_1k_usd: 0.01 },
|
|
1775
|
+
// Read on 2026-11-24 from https://openrouter.ai/api/v1/models, which passes Anthropic's list price through.
|
|
1776
|
+
"claude-haiku-5-5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
|
|
1760
1777
|
"claude-haiku-4-5": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 },
|
|
1761
1778
|
// The dated id of the same model; a config may name either.
|
|
1762
1779
|
"claude-haiku-4-5-20251001": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 },
|
|
@@ -2788,6 +2805,18 @@ var llmJudge = {
|
|
|
2788
2805
|
}
|
|
2789
2806
|
const criteria = interpolate(ctx.params.criteria, ctx);
|
|
2790
2807
|
const threshold = ctx.params.pass_threshold ?? DEFAULT_PASS_THRESHOLD;
|
|
2808
|
+
if (ctx.judge.decide !== void 0) {
|
|
2809
|
+
const p = await ctx.judge.decide({
|
|
2810
|
+
criteria,
|
|
2811
|
+
output: ctx.output,
|
|
2812
|
+
...ctx.input !== void 0 ? { input: ctx.input } : {}
|
|
2813
|
+
});
|
|
2814
|
+
return {
|
|
2815
|
+
passed: p >= threshold,
|
|
2816
|
+
score: p,
|
|
2817
|
+
reason: `probability ${p.toFixed(3)} that the answer meets the criteria vs threshold ${threshold}; this judge gives no reason`
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2791
2820
|
const { score, reason } = parseScored(
|
|
2792
2821
|
await askJson(ctx.judge, prompt(criteria, ctx.output, ctx.input))
|
|
2793
2822
|
);
|
|
@@ -4132,9 +4161,23 @@ async function assess(p, output, input, transcript) {
|
|
|
4132
4161
|
let assertionError;
|
|
4133
4162
|
for (const assertion of p.assertions) {
|
|
4134
4163
|
const own2 = assertion.type === "llm-judge" ? assertion.provider : void 0;
|
|
4135
|
-
const
|
|
4164
|
+
const jev = own2?.type === "jev" ? own2 : void 0;
|
|
4165
|
+
const judgeCfg = own2 === void 0 || own2.type === "jev" ? p.providerConfig : { ...p.providerConfig, ...own2 };
|
|
4136
4166
|
let judgedBy;
|
|
4137
4167
|
const judge = () => {
|
|
4168
|
+
if (jev !== void 0) {
|
|
4169
|
+
if (p.jevJudge === void 0) throw new Error("this run cannot build the jev judge of an llm-judge check");
|
|
4170
|
+
const inner2 = p.jevJudge(jev, (usd) => {
|
|
4171
|
+
judgeCost += usd;
|
|
4172
|
+
});
|
|
4173
|
+
return {
|
|
4174
|
+
ask: (q) => inner2.ask(q),
|
|
4175
|
+
decide: (q) => {
|
|
4176
|
+
judgedBy = `jev/${jev.model}`;
|
|
4177
|
+
return inner2.decide(q);
|
|
4178
|
+
}
|
|
4179
|
+
};
|
|
4180
|
+
}
|
|
4138
4181
|
let provider = p.provider;
|
|
4139
4182
|
if (own2 !== void 0) {
|
|
4140
4183
|
if (p.resolveJudge === void 0)
|
|
@@ -4495,6 +4538,7 @@ async function runOrchestration(config, options, deps) {
|
|
|
4495
4538
|
providerConfig,
|
|
4496
4539
|
provider,
|
|
4497
4540
|
resolveJudge,
|
|
4541
|
+
...deps.jevJudge !== void 0 ? { jevJudge: deps.jevJudge } : {},
|
|
4498
4542
|
embedder: deps.embedder,
|
|
4499
4543
|
cache: deps.cache,
|
|
4500
4544
|
now: deps.now,
|
|
@@ -4596,6 +4640,89 @@ function typeName(value) {
|
|
|
4596
4640
|
return value === null ? "null" : Array.isArray(value) ? "array" : typeof value;
|
|
4597
4641
|
}
|
|
4598
4642
|
|
|
4643
|
+
// src/judge/jev.ts
|
|
4644
|
+
init_cjs_shims();
|
|
4645
|
+
var JEV_BASE_URL = "https://api.typesafe.ai";
|
|
4646
|
+
var JEV_KEY_ENV = "TYPESAFE_API_KEY";
|
|
4647
|
+
var JEV_MAX_STATE_CHARS = 16e3;
|
|
4648
|
+
var JEV_USD_PER_1M_INPUT_TOKENS = 0.042;
|
|
4649
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
4650
|
+
var INSTRUCTIONS = "Does the answer meet the criterion?";
|
|
4651
|
+
var YES = "the answer meets the criterion";
|
|
4652
|
+
var NO = "the answer does not meet the criterion";
|
|
4653
|
+
function jevState(q) {
|
|
4654
|
+
const request = q.input === void 0 ? "" : `Request:
|
|
4655
|
+
${q.input}
|
|
4656
|
+
|
|
4657
|
+
`;
|
|
4658
|
+
return `${request}Answer:
|
|
4659
|
+
${q.output}
|
|
4660
|
+
|
|
4661
|
+
Criterion:
|
|
4662
|
+
${q.criteria}`;
|
|
4663
|
+
}
|
|
4664
|
+
function probability(json) {
|
|
4665
|
+
const answer = json?.answers?.q;
|
|
4666
|
+
const p = answer?.type === "noul" ? answer.noul : void 0;
|
|
4667
|
+
if (typeof p !== "number" || !Number.isFinite(p) || p < 0 || p > 1)
|
|
4668
|
+
throw new ProviderError("JEV_ANSWER", "jev returned no probability for the question asked");
|
|
4669
|
+
return p;
|
|
4670
|
+
}
|
|
4671
|
+
function makeJevJudge(cfg, deps) {
|
|
4672
|
+
return {
|
|
4673
|
+
ask: () => Promise.reject(new Error("a jev judge answers a yes-or-no question only: it cannot judge this kind of check")),
|
|
4674
|
+
async decide(q) {
|
|
4675
|
+
const key = deps.env[JEV_KEY_ENV];
|
|
4676
|
+
if (key === void 0 || key === "")
|
|
4677
|
+
throw new AuthError(`${JEV_KEY_ENV} is not set: the jev judge of an llm-judge check needs it`, JEV_KEY_ENV);
|
|
4678
|
+
const state = jevState(q);
|
|
4679
|
+
if (state.length > JEV_MAX_STATE_CHARS)
|
|
4680
|
+
throw new ProviderError(
|
|
4681
|
+
"JEV_INPUT_TOO_LONG",
|
|
4682
|
+
`the request, answer and criterion are ${state.length} characters together; a jev judge takes ${JEV_MAX_STATE_CHARS}. Nothing was sent`
|
|
4683
|
+
);
|
|
4684
|
+
const body = JSON.stringify({
|
|
4685
|
+
state,
|
|
4686
|
+
model: cfg.model,
|
|
4687
|
+
questions: { q: { type: "noul", instructions: INSTRUCTIONS, criteria: { true: YES, false: NO } } }
|
|
4688
|
+
});
|
|
4689
|
+
const send = async () => {
|
|
4690
|
+
try {
|
|
4691
|
+
return await deps.fetchFn(`${JEV_BASE_URL}/v1/systemone`, {
|
|
4692
|
+
method: "POST",
|
|
4693
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
|
|
4694
|
+
body,
|
|
4695
|
+
redirect: "error",
|
|
4696
|
+
signal: AbortSignal.timeout(cfg.timeout ?? DEFAULT_TIMEOUT_MS)
|
|
4697
|
+
});
|
|
4698
|
+
} catch (err) {
|
|
4699
|
+
throw new ProviderError("JEV_UNREACHABLE", `jev did not answer: ${err instanceof Error ? err.message : String(err)}`);
|
|
4700
|
+
}
|
|
4701
|
+
};
|
|
4702
|
+
let res = await send();
|
|
4703
|
+
if (res.status === 429 || res.status >= 500) res = await send();
|
|
4704
|
+
if (res.status === 401 || res.status === 403)
|
|
4705
|
+
throw new AuthError(`jev refused the key in ${JEV_KEY_ENV} (HTTP ${res.status})`, JEV_KEY_ENV);
|
|
4706
|
+
if (!res.ok) throw new ProviderError("JEV_HTTP", `jev answered HTTP ${res.status}`);
|
|
4707
|
+
const json = await res.json();
|
|
4708
|
+
const p = probability(json);
|
|
4709
|
+
const tokens = json.usage?.input_tokens;
|
|
4710
|
+
const billed = typeof tokens === "number" && tokens >= 0 ? tokens : Math.ceil(state.length / 3);
|
|
4711
|
+
deps.onCost(billed / 1e6 * JEV_USD_PER_1M_INPUT_TOKENS);
|
|
4712
|
+
return p;
|
|
4713
|
+
}
|
|
4714
|
+
};
|
|
4715
|
+
}
|
|
4716
|
+
var warned = false;
|
|
4717
|
+
function warnJevExperimental(write = (l) => process.stderr.write(l)) {
|
|
4718
|
+
if (warned) return;
|
|
4719
|
+
warned = true;
|
|
4720
|
+
write(
|
|
4721
|
+
`warning: the jev judge is experimental. It gives a probability and no reason, sends the request, answer and criterion to ${new URL(JEV_BASE_URL).host}, and was measured on answers with a clear right or wrong only. See docs/guide/assertions.md#an-experimental-judge-jev
|
|
4722
|
+
`
|
|
4723
|
+
);
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4599
4726
|
// src/cli/commands/run.ts
|
|
4600
4727
|
var NOOP_CACHE = { get: () => void 0, set: () => {
|
|
4601
4728
|
}, delete: () => {
|
|
@@ -4691,7 +4818,14 @@ function buildRealDeps(config, baseDir, dryRun) {
|
|
|
4691
4818
|
now: Date.now,
|
|
4692
4819
|
loadDataset,
|
|
4693
4820
|
baseDir,
|
|
4694
|
-
connectMcp: makeMcpConnect(config, baseDir, process.env)
|
|
4821
|
+
connectMcp: makeMcpConnect(config, baseDir, process.env),
|
|
4822
|
+
// A dry run stops before any check, so it never builds this judge. Mock mode sends nothing: no jev judge there.
|
|
4823
|
+
...isMockMode(process.env) ? {} : {
|
|
4824
|
+
jevJudge: (cfg, onCost) => {
|
|
4825
|
+
warnJevExperimental();
|
|
4826
|
+
return makeJevJudge(cfg, { env: process.env, fetchFn: fetch, onCost });
|
|
4827
|
+
}
|
|
4828
|
+
}
|
|
4695
4829
|
};
|
|
4696
4830
|
}
|
|
4697
4831
|
function persist(result, baseDir) {
|
package/dist/index.d.cts
CHANGED
|
@@ -317,10 +317,20 @@ interface JsonSchemaAssertion {
|
|
|
317
317
|
schema: object;
|
|
318
318
|
extract?: 'auto' | 'strict';
|
|
319
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* The experimental Jev judge of an `llm-judge` check. A decision model, not a text model: it cannot be an eval's
|
|
322
|
+
* provider, takes none of the eval provider's fields, and its model is always named.
|
|
323
|
+
*/
|
|
324
|
+
interface JevJudgeConfig {
|
|
325
|
+
type: 'jev';
|
|
326
|
+
model: string;
|
|
327
|
+
/** Milliseconds for one request (default 30 000). */
|
|
328
|
+
timeout?: number;
|
|
329
|
+
}
|
|
320
330
|
interface LlmJudgeAssertion {
|
|
321
331
|
type: 'llm-judge';
|
|
322
332
|
criteria: string;
|
|
323
|
-
provider?: Partial<ProviderConfig
|
|
333
|
+
provider?: Partial<ProviderConfig> | JevJudgeConfig;
|
|
324
334
|
/** The minimum judge score (0–1). Not the eval's `pass_threshold`, which is a share of runs. */
|
|
325
335
|
pass_threshold?: number;
|
|
326
336
|
}
|
|
@@ -593,6 +603,22 @@ interface Embedder {
|
|
|
593
603
|
embed(texts: string[]): Promise<Float32Array[]>;
|
|
594
604
|
}
|
|
595
605
|
|
|
606
|
+
/** What a decision judge is asked: does `output`, the answer to `input`, meet `criteria`? */
|
|
607
|
+
interface DecisionQuestion {
|
|
608
|
+
criteria: string;
|
|
609
|
+
output: string;
|
|
610
|
+
input?: string;
|
|
611
|
+
}
|
|
612
|
+
interface Judge {
|
|
613
|
+
/** Ask the judge LLM a prompt and return its raw text response. */
|
|
614
|
+
ask(prompt: string): Promise<string>;
|
|
615
|
+
/**
|
|
616
|
+
* Only a decision model has it (the experimental `jev` judge of an `llm-judge` check): the probability, 0 to 1,
|
|
617
|
+
* that the answer meets the criteria. Such a judge gives no reason, and its `ask` throws.
|
|
618
|
+
*/
|
|
619
|
+
decide?(question: DecisionQuestion): Promise<number>;
|
|
620
|
+
}
|
|
621
|
+
|
|
596
622
|
interface Cache {
|
|
597
623
|
/** Return the cached completion, or undefined on a miss. `maxAgeMs` (optional) expires old entries. */
|
|
598
624
|
get(key: string, opts?: {
|
|
@@ -640,6 +666,33 @@ interface AgentServer {
|
|
|
640
666
|
/** Opens a session with the server named in `mcp.servers`; a failure rejects with a message already masked. */
|
|
641
667
|
type AgentConnect = (server: string, timeoutMs: number) => Promise<AgentServer>;
|
|
642
668
|
|
|
669
|
+
interface RowParams {
|
|
670
|
+
template: string;
|
|
671
|
+
assertions: AssertionConfig[];
|
|
672
|
+
row: DatasetRow;
|
|
673
|
+
providerConfig: ProviderConfig;
|
|
674
|
+
provider: Provider;
|
|
675
|
+
embedder: Embedder;
|
|
676
|
+
cache: Cache;
|
|
677
|
+
now: () => number;
|
|
678
|
+
dryRun: boolean;
|
|
679
|
+
noCache: boolean;
|
|
680
|
+
/** Every row must be answered from the cache; a miss ends the row without a model call. */
|
|
681
|
+
cacheStrict?: boolean;
|
|
682
|
+
/** Entries older than this count as a miss. */
|
|
683
|
+
cacheMaxAgeMs?: number;
|
|
684
|
+
/** Test seam: the policy version in the key (default CACHE_POLICY_VERSION). */
|
|
685
|
+
policyVersion?: number;
|
|
686
|
+
/** Which repeat of the row this is, from 0 (`runs`); from 1 on it has a cache key of its own. */
|
|
687
|
+
attempt?: number;
|
|
688
|
+
/**
|
|
689
|
+
* The provider of a judge config other than the eval's: an `llm-judge` with a `provider` of its own
|
|
690
|
+
* (plune-ai/cli#373). Without it such a check errors the row rather than be judged by the wrong model.
|
|
691
|
+
*/
|
|
692
|
+
resolveJudge?: (cfg: ProviderConfig) => Provider;
|
|
693
|
+
/** Builds the experimental `jev` judge of an `llm-judge` check; `onCost` is charged to the row. Without it such a check errors the row. */
|
|
694
|
+
jevJudge?: (cfg: JevJudgeConfig, onCost: (usd: number) => void) => Judge;
|
|
695
|
+
}
|
|
643
696
|
interface RunDeps {
|
|
644
697
|
resolveProvider(cfg: ProviderConfig): Provider;
|
|
645
698
|
embedder: Embedder;
|
|
@@ -649,6 +702,8 @@ interface RunDeps {
|
|
|
649
702
|
baseDir: string;
|
|
650
703
|
/** Opens a session with an `mcp.servers` entry, one per agentic row. Needed only by an eval with `mcp`. */
|
|
651
704
|
connectMcp?: AgentConnect;
|
|
705
|
+
/** Builds the experimental `jev` judge of an `llm-judge` check. A run without it errors the rows of such a check. */
|
|
706
|
+
jevJudge?: RowParams['jevJudge'];
|
|
652
707
|
}
|
|
653
708
|
|
|
654
709
|
interface RunOptions {
|
|
@@ -757,27 +812,20 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
757
812
|
}, z.core.$strip>, z.ZodObject<{
|
|
758
813
|
type: z.ZodLiteral<"llm-judge">;
|
|
759
814
|
criteria: z.ZodString;
|
|
760
|
-
provider: z.ZodOptional<z.
|
|
761
|
-
type:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
model
|
|
767
|
-
temperature
|
|
768
|
-
max_tokens
|
|
769
|
-
concurrency
|
|
770
|
-
timeout
|
|
771
|
-
max_retries
|
|
772
|
-
reasoning_effort
|
|
773
|
-
|
|
774
|
-
minimal: "minimal";
|
|
775
|
-
low: "low";
|
|
776
|
-
medium: "medium";
|
|
777
|
-
high: "high";
|
|
778
|
-
xhigh: "xhigh";
|
|
779
|
-
}>>>;
|
|
780
|
-
}, z.core.$strip>>;
|
|
815
|
+
provider: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<{
|
|
816
|
+
type: "jev";
|
|
817
|
+
model: string;
|
|
818
|
+
timeout?: number | undefined;
|
|
819
|
+
} | {
|
|
820
|
+
type?: "anthropic" | "openai" | "openrouter" | undefined;
|
|
821
|
+
model?: string | undefined;
|
|
822
|
+
temperature?: number | undefined;
|
|
823
|
+
max_tokens?: number | undefined;
|
|
824
|
+
concurrency?: number | undefined;
|
|
825
|
+
timeout?: number | undefined;
|
|
826
|
+
max_retries?: number | undefined;
|
|
827
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
828
|
+
}, any>>>;
|
|
781
829
|
pass_threshold: z.ZodOptional<z.ZodNumber>;
|
|
782
830
|
}, z.core.$strip>, z.ZodObject<{
|
|
783
831
|
type: z.ZodLiteral<"semantic-similarity">;
|
package/dist/index.d.ts
CHANGED
|
@@ -317,10 +317,20 @@ interface JsonSchemaAssertion {
|
|
|
317
317
|
schema: object;
|
|
318
318
|
extract?: 'auto' | 'strict';
|
|
319
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* The experimental Jev judge of an `llm-judge` check. A decision model, not a text model: it cannot be an eval's
|
|
322
|
+
* provider, takes none of the eval provider's fields, and its model is always named.
|
|
323
|
+
*/
|
|
324
|
+
interface JevJudgeConfig {
|
|
325
|
+
type: 'jev';
|
|
326
|
+
model: string;
|
|
327
|
+
/** Milliseconds for one request (default 30 000). */
|
|
328
|
+
timeout?: number;
|
|
329
|
+
}
|
|
320
330
|
interface LlmJudgeAssertion {
|
|
321
331
|
type: 'llm-judge';
|
|
322
332
|
criteria: string;
|
|
323
|
-
provider?: Partial<ProviderConfig
|
|
333
|
+
provider?: Partial<ProviderConfig> | JevJudgeConfig;
|
|
324
334
|
/** The minimum judge score (0–1). Not the eval's `pass_threshold`, which is a share of runs. */
|
|
325
335
|
pass_threshold?: number;
|
|
326
336
|
}
|
|
@@ -593,6 +603,22 @@ interface Embedder {
|
|
|
593
603
|
embed(texts: string[]): Promise<Float32Array[]>;
|
|
594
604
|
}
|
|
595
605
|
|
|
606
|
+
/** What a decision judge is asked: does `output`, the answer to `input`, meet `criteria`? */
|
|
607
|
+
interface DecisionQuestion {
|
|
608
|
+
criteria: string;
|
|
609
|
+
output: string;
|
|
610
|
+
input?: string;
|
|
611
|
+
}
|
|
612
|
+
interface Judge {
|
|
613
|
+
/** Ask the judge LLM a prompt and return its raw text response. */
|
|
614
|
+
ask(prompt: string): Promise<string>;
|
|
615
|
+
/**
|
|
616
|
+
* Only a decision model has it (the experimental `jev` judge of an `llm-judge` check): the probability, 0 to 1,
|
|
617
|
+
* that the answer meets the criteria. Such a judge gives no reason, and its `ask` throws.
|
|
618
|
+
*/
|
|
619
|
+
decide?(question: DecisionQuestion): Promise<number>;
|
|
620
|
+
}
|
|
621
|
+
|
|
596
622
|
interface Cache {
|
|
597
623
|
/** Return the cached completion, or undefined on a miss. `maxAgeMs` (optional) expires old entries. */
|
|
598
624
|
get(key: string, opts?: {
|
|
@@ -640,6 +666,33 @@ interface AgentServer {
|
|
|
640
666
|
/** Opens a session with the server named in `mcp.servers`; a failure rejects with a message already masked. */
|
|
641
667
|
type AgentConnect = (server: string, timeoutMs: number) => Promise<AgentServer>;
|
|
642
668
|
|
|
669
|
+
interface RowParams {
|
|
670
|
+
template: string;
|
|
671
|
+
assertions: AssertionConfig[];
|
|
672
|
+
row: DatasetRow;
|
|
673
|
+
providerConfig: ProviderConfig;
|
|
674
|
+
provider: Provider;
|
|
675
|
+
embedder: Embedder;
|
|
676
|
+
cache: Cache;
|
|
677
|
+
now: () => number;
|
|
678
|
+
dryRun: boolean;
|
|
679
|
+
noCache: boolean;
|
|
680
|
+
/** Every row must be answered from the cache; a miss ends the row without a model call. */
|
|
681
|
+
cacheStrict?: boolean;
|
|
682
|
+
/** Entries older than this count as a miss. */
|
|
683
|
+
cacheMaxAgeMs?: number;
|
|
684
|
+
/** Test seam: the policy version in the key (default CACHE_POLICY_VERSION). */
|
|
685
|
+
policyVersion?: number;
|
|
686
|
+
/** Which repeat of the row this is, from 0 (`runs`); from 1 on it has a cache key of its own. */
|
|
687
|
+
attempt?: number;
|
|
688
|
+
/**
|
|
689
|
+
* The provider of a judge config other than the eval's: an `llm-judge` with a `provider` of its own
|
|
690
|
+
* (plune-ai/cli#373). Without it such a check errors the row rather than be judged by the wrong model.
|
|
691
|
+
*/
|
|
692
|
+
resolveJudge?: (cfg: ProviderConfig) => Provider;
|
|
693
|
+
/** Builds the experimental `jev` judge of an `llm-judge` check; `onCost` is charged to the row. Without it such a check errors the row. */
|
|
694
|
+
jevJudge?: (cfg: JevJudgeConfig, onCost: (usd: number) => void) => Judge;
|
|
695
|
+
}
|
|
643
696
|
interface RunDeps {
|
|
644
697
|
resolveProvider(cfg: ProviderConfig): Provider;
|
|
645
698
|
embedder: Embedder;
|
|
@@ -649,6 +702,8 @@ interface RunDeps {
|
|
|
649
702
|
baseDir: string;
|
|
650
703
|
/** Opens a session with an `mcp.servers` entry, one per agentic row. Needed only by an eval with `mcp`. */
|
|
651
704
|
connectMcp?: AgentConnect;
|
|
705
|
+
/** Builds the experimental `jev` judge of an `llm-judge` check. A run without it errors the rows of such a check. */
|
|
706
|
+
jevJudge?: RowParams['jevJudge'];
|
|
652
707
|
}
|
|
653
708
|
|
|
654
709
|
interface RunOptions {
|
|
@@ -757,27 +812,20 @@ declare const assertionConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
757
812
|
}, z.core.$strip>, z.ZodObject<{
|
|
758
813
|
type: z.ZodLiteral<"llm-judge">;
|
|
759
814
|
criteria: z.ZodString;
|
|
760
|
-
provider: z.ZodOptional<z.
|
|
761
|
-
type:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
model
|
|
767
|
-
temperature
|
|
768
|
-
max_tokens
|
|
769
|
-
concurrency
|
|
770
|
-
timeout
|
|
771
|
-
max_retries
|
|
772
|
-
reasoning_effort
|
|
773
|
-
|
|
774
|
-
minimal: "minimal";
|
|
775
|
-
low: "low";
|
|
776
|
-
medium: "medium";
|
|
777
|
-
high: "high";
|
|
778
|
-
xhigh: "xhigh";
|
|
779
|
-
}>>>;
|
|
780
|
-
}, z.core.$strip>>;
|
|
815
|
+
provider: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<{
|
|
816
|
+
type: "jev";
|
|
817
|
+
model: string;
|
|
818
|
+
timeout?: number | undefined;
|
|
819
|
+
} | {
|
|
820
|
+
type?: "anthropic" | "openai" | "openrouter" | undefined;
|
|
821
|
+
model?: string | undefined;
|
|
822
|
+
temperature?: number | undefined;
|
|
823
|
+
max_tokens?: number | undefined;
|
|
824
|
+
concurrency?: number | undefined;
|
|
825
|
+
timeout?: number | undefined;
|
|
826
|
+
max_retries?: number | undefined;
|
|
827
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
828
|
+
}, any>>>;
|
|
781
829
|
pass_threshold: z.ZodOptional<z.ZodNumber>;
|
|
782
830
|
}, z.core.$strip>, z.ZodObject<{
|
|
783
831
|
type: z.ZodLiteral<"semantic-similarity">;
|