@workglow/eval 0.4.8 → 0.5.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.
@@ -35,8 +35,12 @@ export interface SweepOptions {
35
35
  * An unreported counter is stored as `null`, never `0` — the database has to
36
36
  * keep the distinction the in-memory type protects, or a model that never
37
37
  * mentions caching becomes indistinguishable from one that cached nothing.
38
+ *
39
+ * `at` is when the request ran, which is what a time-of-day rate is charged
40
+ * against. A batch that straddles the boundary of one must not have its rows
41
+ * priced by whenever the sweep happened to reach the write.
38
42
  */
39
- export declare function usageColumns(usage: Usage | undefined, pricing: ModelPricing | undefined): {
43
+ export declare function usageColumns(usage: Usage | undefined, pricing: ModelPricing | undefined, at: Date | undefined): {
40
44
  input_tokens: number | null;
41
45
  output_tokens: number | null;
42
46
  cached_tokens: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/evals/runner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAe,MAAM,SAAS,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CA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B,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAWA;AAoBD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CAoFjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"liveTally.d.ts","sourceRoot":"","sources":["../../src/report/liveTally.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AASlD;;;;;GAKG;AACH,qBAAa,SAAS;IAKlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,YACmB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,EACrE,GAAG,EAAE,MAAM,EAGZ;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAMjE;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAevD;CACF"}
1
+ {"version":3,"file":"liveTally.d.ts","sourceRoot":"","sources":["../../src/report/liveTally.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AASlD;;;;;GAKG;AACH,qBAAa,SAAS;IAKlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,YACmB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,EACrE,GAAG,EAAE,MAAM,EAGZ;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAMjE;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAmBvD;CACF"}
@@ -1056,8 +1056,8 @@ function makeSimilarityExecutor(model, options, context) {
1056
1056
  }
1057
1057
 
1058
1058
  // src/evals/runner.ts
1059
- function usageColumns(usage, pricing) {
1060
- const estimate = usage ? estimateCost(usage, pricing) : undefined;
1059
+ function usageColumns(usage, pricing, at) {
1060
+ const estimate = usage ? estimateCost(usage, pricing, { at }) : undefined;
1061
1061
  return {
1062
1062
  input_tokens: usage?.input ?? null,
1063
1063
  output_tokens: usage?.output ?? null,
@@ -1111,6 +1111,7 @@ async function runSweep(stores, rows, options) {
1111
1111
  }
1112
1112
  for (const { record, row, parseError } of parsedRows) {
1113
1113
  const t0 = performance.now();
1114
+ const requestedAt = new Date;
1114
1115
  let outcome;
1115
1116
  let outcomeUsage;
1116
1117
  if (!executor) {
@@ -1139,7 +1140,7 @@ async function runSweep(stores, rows, options) {
1139
1140
  model: modelId,
1140
1141
  row_index: record.row_index,
1141
1142
  latency_ms: Math.round(latency * 100) / 100,
1142
- ...usageColumns(outcomeUsage, modelPricing),
1143
+ ...usageColumns(outcomeUsage, modelPricing, requestedAt),
1143
1144
  ...outcome
1144
1145
  });
1145
1146
  done++;
@@ -1239,7 +1240,7 @@ class LiveTally {
1239
1240
  const lines = [`[${done}/${total}]`];
1240
1241
  for (const [model, tally] of this.byModel) {
1241
1242
  const tps = tally.usage?.output === undefined ? "" : ` ${Math.round(tally.usage.output / elapsedSec)} tok/s`;
1242
- const cost = tally.usage ? formatCost(estimateCost2(tally.usage, this.pricing(model))) : "";
1243
+ const cost = tally.usage ? formatCost(estimateCost2(tally.usage, this.pricing(model), { at: this.startedAt })) : "";
1243
1244
  lines.push(` ${model} ${tally.ok}/${tally.rows} ok ` + `${formatUsage(tally.usage, "detailed")}${tps}${cost ? ` ${cost}` : ""}`);
1244
1245
  }
1245
1246
  return lines.join(`
@@ -1362,7 +1363,7 @@ import { registerHuggingFaceTransformers } from "@workglow/huggingface-transform
1362
1363
  import { registerLlamaCpp } from "@workglow/node-llama-cpp/ai";
1363
1364
  import { registerOpenAiInline } from "@workglow/openai/ai-runtime";
1364
1365
  import { registerBaseTasks, registerBuiltInTransforms } from "@workglow/task-graph";
1365
- import { EnvCredentialStore, setGlobalCredentialStore } from "@workglow/util";
1366
+ import { EnvCredentialStore, setGlobalCredentialStore, Worker } from "@workglow/util";
1366
1367
  import { registerXaiInline } from "@workglow/xai/ai-runtime";
1367
1368
  async function registerEvalProviders(config) {
1368
1369
  registerBaseTasks();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workglow/eval",
3
3
  "type": "module",
4
- "version": "0.4.8",
4
+ "version": "0.5.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/workglow-dev/libs.git",
@@ -33,22 +33,22 @@
33
33
  "src/**/*.md"
34
34
  ],
35
35
  "dependencies": {
36
- "@workglow/ai": "0.4.8",
37
- "@workglow/anthropic": "0.4.8",
38
- "@workglow/cli": "0.4.8",
39
- "@workglow/deepseek": "0.4.8",
40
- "@workglow/google-gemini": "0.4.8",
41
- "@workglow/huggingface-transformers": "0.4.8",
42
- "@workglow/node-llama-cpp": "0.4.8",
43
- "@workglow/openai": "0.4.8",
44
- "@workglow/sqlite": "0.4.8",
45
- "@workglow/storage": "0.4.8",
46
- "@workglow/task-graph": "0.4.8",
47
- "@workglow/util": "0.4.8",
48
- "@workglow/xai": "0.4.8",
36
+ "@workglow/ai": "0.5.0",
37
+ "@workglow/anthropic": "0.5.0",
38
+ "@workglow/cli": "0.5.0",
39
+ "@workglow/deepseek": "0.5.0",
40
+ "@workglow/google-gemini": "0.5.0",
41
+ "@workglow/huggingface-transformers": "0.5.0",
42
+ "@workglow/node-llama-cpp": "0.5.0",
43
+ "@workglow/openai": "0.5.0",
44
+ "@workglow/sqlite": "0.5.0",
45
+ "@workglow/storage": "0.5.0",
46
+ "@workglow/task-graph": "0.5.0",
47
+ "@workglow/util": "0.5.0",
48
+ "@workglow/xai": "0.5.0",
49
49
  "@huggingface/transformers": "^4.2.0",
50
50
  "commander": "^15.0.0",
51
- "hyparquet": "^1.29.2",
51
+ "hyparquet": "^1.30.0",
52
52
  "hyparquet-compressors": "^1.1.1"
53
53
  },
54
54
  "publishConfig": {