pareta 2.1.0 → 3.0.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 +1 -1
- package/dist/index.cjs +43 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -38
- package/dist/index.d.ts +41 -38
- package/dist/index.mjs +43 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ contender honestly:
|
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
43
|
const set = await pa.evals.sets.create({
|
|
44
|
-
items: [...],
|
|
44
|
+
items: [...], prompt: "extract vendor, total and date from each invoice",
|
|
45
45
|
});
|
|
46
46
|
const run = await pa.evals.runs.create({
|
|
47
47
|
evalSet: set.id, models: ["auto"], frontier: ["claude-opus-4-7"], wait: true,
|
package/dist/index.cjs
CHANGED
|
@@ -174,7 +174,7 @@ function parseSSE(reader, opts) {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// src/version.ts
|
|
177
|
-
var VERSION = "
|
|
177
|
+
var VERSION = "3.0.0";
|
|
178
178
|
|
|
179
179
|
// src/money.ts
|
|
180
180
|
var MICRO_PER_CENT = 10000n;
|
|
@@ -372,9 +372,9 @@ var EvalSet = class extends BaseModel {
|
|
|
372
372
|
return this.raw.scoring_strategy ?? null;
|
|
373
373
|
}
|
|
374
374
|
/** The one-sentence success criterion this set was created with (CB1:
|
|
375
|
-
* DATA +
|
|
376
|
-
get
|
|
377
|
-
return this.raw.
|
|
375
|
+
* DATA + PROMPT). Required at create. */
|
|
376
|
+
get prompt() {
|
|
377
|
+
return this.raw.prompt ?? null;
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
380
|
function evalSetFromCreate(raw) {
|
|
@@ -413,23 +413,24 @@ var ProposalResult = class extends BaseModel {
|
|
|
413
413
|
get closestTask() {
|
|
414
414
|
return this.raw.closest_task ?? null;
|
|
415
415
|
}
|
|
416
|
-
get
|
|
417
|
-
return this.raw.
|
|
416
|
+
get prompt() {
|
|
417
|
+
return this.raw.prompt ?? null;
|
|
418
418
|
}
|
|
419
419
|
get message() {
|
|
420
420
|
return this.raw.message ?? null;
|
|
421
421
|
}
|
|
422
|
-
/** True when
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* `task: "custom-eval"`, never
|
|
422
|
+
/** True when exactly ONE homogeneous SPECIFIC task matched at high/medium
|
|
423
|
+
* confidence with no conflict/split — the case a task-less `create`
|
|
424
|
+
* proceeds with, no human confirming. `custom-eval` (a judge panel grading
|
|
425
|
+
* each answer against your prompt) is EXCLUDED: it is offered only when
|
|
426
|
+
* nothing specific fits, and using it is the user's CHOICE — opt in with
|
|
427
|
+
* `task: "custom-eval"`, never silently. */
|
|
428
428
|
get isClean() {
|
|
429
429
|
const props = this.proposals;
|
|
430
430
|
return this.homogeneous && this.conflict == null && this.split == null && props.length === 1 && (props[0].confidence === "high" || props[0].confidence === "medium") && Boolean(props[0].taskId) && props[0].taskId !== "custom-eval";
|
|
431
431
|
}
|
|
432
|
-
/**
|
|
432
|
+
/** How a task-less `create` would score this set, or null if the result
|
|
433
|
+
* isn't clean (pass `task` yourself). */
|
|
433
434
|
get boundTask() {
|
|
434
435
|
return this.isClean ? this.proposals[0].taskId : null;
|
|
435
436
|
}
|
|
@@ -778,37 +779,37 @@ async function toBlob(file, mimeOverride) {
|
|
|
778
779
|
const mime = mimeOverride || "application/octet-stream";
|
|
779
780
|
return { blob: new Blob([bytes], { type: mime }), filename: "upload", size: bytes.byteLength, mime };
|
|
780
781
|
}
|
|
781
|
-
function
|
|
782
|
-
const s = (
|
|
782
|
+
function requirePrompt(prompt) {
|
|
783
|
+
const s = (prompt ?? "").trim();
|
|
783
784
|
if (!s) {
|
|
784
785
|
throw new ParetaError(
|
|
785
|
-
'
|
|
786
|
+
'prompt is required: one sentence describing what the model should do with each item (e.g. "extract vendor, total and date from each invoice"). Pass prompt to evals.create / proposeContract.'
|
|
786
787
|
);
|
|
787
788
|
}
|
|
788
789
|
return s.slice(0, 500);
|
|
789
790
|
}
|
|
790
|
-
function itemsJsonl(task, items,
|
|
791
|
+
function itemsJsonl(task, items, prompt, name) {
|
|
791
792
|
if (!items || items.length === 0) throw new ParetaError("items is required and must be non-empty");
|
|
792
793
|
const jsonl = items.map((it) => JSON.stringify(it)).join("\n");
|
|
793
794
|
return {
|
|
794
795
|
files: { items: { filename: `items.${task}.jsonl`, content: jsonl, contentType: "application/jsonl" } },
|
|
795
|
-
data: { task_id: task,
|
|
796
|
+
data: { task_id: task, prompt, name: name || `sdk eval set (${items.length} items)` }
|
|
796
797
|
};
|
|
797
798
|
}
|
|
798
|
-
function proposeMultipart(items,
|
|
799
|
+
function proposeMultipart(items, prompt) {
|
|
799
800
|
if (!items || items.length === 0) throw new ParetaError("items is required and must be non-empty");
|
|
800
801
|
const jsonl = items.map((it) => JSON.stringify(it)).join("\n");
|
|
801
802
|
return {
|
|
802
803
|
files: { items: { filename: "items.jsonl", content: jsonl, contentType: "application/jsonl" } },
|
|
803
|
-
data: {
|
|
804
|
+
data: { prompt }
|
|
804
805
|
};
|
|
805
806
|
}
|
|
806
807
|
function bindError(result) {
|
|
807
|
-
const
|
|
808
|
+
const prompt = result.prompt ?? "";
|
|
808
809
|
if (result.conflict) {
|
|
809
810
|
const c = result.conflict;
|
|
810
811
|
return new ParetaError(
|
|
811
|
-
`
|
|
812
|
+
`prompt '${prompt}' describes a different job than the data's shape supports (reads as '${c.intended_task}': ${c.reasoning}). Pass a task to pin the task, or revise the prompt.`
|
|
812
813
|
);
|
|
813
814
|
}
|
|
814
815
|
if (result.split) {
|
|
@@ -821,14 +822,14 @@ function bindError(result) {
|
|
|
821
822
|
if (props.length === 1 && props[0].taskId === "custom-eval") {
|
|
822
823
|
const warn = props[0].warning ? ` (${props[0].warning})` : "";
|
|
823
824
|
return new ParetaError(
|
|
824
|
-
`no
|
|
825
|
+
`no ready-made scorer fits this data for prompt '${prompt}'. A judge panel can grade each answer against what you asked for (win rate vs gpt-5.5) \u2014 pass task: "custom-eval" to use it.${warn} Or revise the data/prompt so a specific task fits.`
|
|
825
826
|
);
|
|
826
827
|
}
|
|
827
828
|
const options = props.map((p) => p.taskId).filter(Boolean);
|
|
828
829
|
if (options.length === 0 && result.closestTask) options.push(result.closestTask);
|
|
829
830
|
const hint = options.length ? ` Candidates: ${options.join(", ")}.` : "";
|
|
830
831
|
return new ParetaError(
|
|
831
|
-
`
|
|
832
|
+
`couldn't work out how to score this for prompt '${prompt}'.${hint} Pass a task to choose yourself, or inspect evals.proposeContract({ items, prompt }).`
|
|
832
833
|
);
|
|
833
834
|
}
|
|
834
835
|
function mergeCandidates(models, frontierIds) {
|
|
@@ -852,27 +853,27 @@ var EvalSets = class {
|
|
|
852
853
|
}
|
|
853
854
|
client;
|
|
854
855
|
/**
|
|
855
|
-
* Persist an eval set from your rows. `
|
|
856
|
-
* on what the model should do with each item. `task` is OPTIONAL — omit it
|
|
857
|
-
*
|
|
858
|
-
* (
|
|
859
|
-
* `task` to pin one explicitly.
|
|
856
|
+
* Persist an eval set from your rows. `prompt` is REQUIRED (v3): one sentence
|
|
857
|
+
* on what the model should do with each item. `task` is OPTIONAL — omit it
|
|
858
|
+
* and Pareta works out how to score the results from your prompt + the
|
|
859
|
+
* data's shape (a clean single match is used; anything ambiguous throws with
|
|
860
|
+
* the proposals). Pass `task` to pin one explicitly.
|
|
860
861
|
*/
|
|
861
862
|
async create(params) {
|
|
862
|
-
const
|
|
863
|
+
const prompt = requirePrompt(params.prompt);
|
|
863
864
|
let task = params.task;
|
|
864
865
|
if (task == null) {
|
|
865
|
-
const proposal = await this.proposeContract(params.items,
|
|
866
|
+
const proposal = await this.proposeContract(params.items, prompt);
|
|
866
867
|
task = proposal.boundTask ?? void 0;
|
|
867
868
|
if (task == null) throw bindError(proposal);
|
|
868
869
|
}
|
|
869
|
-
const { files, data } = itemsJsonl(task, params.items,
|
|
870
|
+
const { files, data } = itemsJsonl(task, params.items, prompt, params.name);
|
|
870
871
|
return this.client.request("POST", BASE2, { files, data, cast: evalSetFromCreate });
|
|
871
872
|
}
|
|
872
|
-
/** Internal: the
|
|
873
|
+
/** Internal: the propose call `create` uses when no task is pinned. Public on
|
|
873
874
|
* `Evals` as `proposeContract`; kept here so `sets.create` can reach it. */
|
|
874
|
-
proposeContract(items,
|
|
875
|
-
const { files, data } = proposeMultipart(items,
|
|
875
|
+
proposeContract(items, prompt) {
|
|
876
|
+
const { files, data } = proposeMultipart(items, requirePrompt(prompt));
|
|
876
877
|
return this.client.request("POST", PROPOSE, { files, data, cast: proposalResult });
|
|
877
878
|
}
|
|
878
879
|
list() {
|
|
@@ -943,11 +944,11 @@ var EvalRuns = class {
|
|
|
943
944
|
let evalSet = params.evalSet;
|
|
944
945
|
if (evalSet == null) {
|
|
945
946
|
if (!params.items) {
|
|
946
|
-
throw new ParetaError("pass evalSet: <id>, or items (+
|
|
947
|
+
throw new ParetaError("pass evalSet: <id>, or items (+ prompt) to create one");
|
|
947
948
|
}
|
|
948
949
|
evalSet = (await this.sets.create({
|
|
949
950
|
items: params.items,
|
|
950
|
-
|
|
951
|
+
prompt: params.prompt,
|
|
951
952
|
task: params.task,
|
|
952
953
|
name: params.name
|
|
953
954
|
})).id ?? void 0;
|
|
@@ -991,13 +992,14 @@ var Evals = class {
|
|
|
991
992
|
}
|
|
992
993
|
client;
|
|
993
994
|
/**
|
|
994
|
-
*
|
|
995
|
+
* How would your data be scored under your stated `prompt`? Stateless
|
|
995
996
|
* discovery — nothing is persisted. Returns a ProposalResult (ranked
|
|
996
|
-
* proposals, the
|
|
997
|
-
* calls this under the hood; use it directly to
|
|
997
|
+
* proposals, the task a task-less create would use, conflict/split
|
|
998
|
+
* reporting). `sets.create` calls this under the hood; use it directly to
|
|
999
|
+
* preview the scoring first.
|
|
998
1000
|
*/
|
|
999
1001
|
proposeContract(params) {
|
|
1000
|
-
return this.sets.proposeContract(params.items, params.
|
|
1002
|
+
return this.sets.proposeContract(params.items, params.prompt);
|
|
1001
1003
|
}
|
|
1002
1004
|
/**
|
|
1003
1005
|
* The frontier (vendor) roster you can evaluate against. With `task`, each is
|