agentv 4.2.0 → 4.3.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.
@@ -24,7 +24,7 @@ import {
24
24
  validateFileReferences,
25
25
  validateTargetsFile,
26
26
  writeArtifactsFromResults
27
- } from "./chunk-HAZJO7OY.js";
27
+ } from "./chunk-ZDJN5FSI.js";
28
28
  import {
29
29
  DEFAULT_CATEGORY,
30
30
  createBuiltinRegistry,
@@ -4217,7 +4217,7 @@ var evalRunCommand = command({
4217
4217
  },
4218
4218
  handler: async (args) => {
4219
4219
  if (args.evalPaths.length === 0 && process.stdin.isTTY) {
4220
- const { launchInteractiveWizard } = await import("./interactive-NVNOLL2H.js");
4220
+ const { launchInteractiveWizard } = await import("./interactive-BKK53ETJ.js");
4221
4221
  await launchInteractiveWizard();
4222
4222
  return;
4223
4223
  }
@@ -4441,27 +4441,15 @@ var evalBenchCommand = command({
4441
4441
  type: string,
4442
4442
  displayName: "export-dir",
4443
4443
  description: "Export directory from pipeline input/grade"
4444
- }),
4445
- llmScores: option({
4446
- type: optional(string),
4447
- long: "llm-scores",
4448
- description: "Path to LLM scores JSON file (reads from stdin if omitted)"
4449
4444
  })
4450
4445
  },
4451
- handler: async ({ exportDir, llmScores: llmScoresPath }) => {
4446
+ handler: async ({ exportDir }) => {
4452
4447
  const manifest = JSON.parse(await readFile(join(exportDir, "manifest.json"), "utf8"));
4453
4448
  const testIds = manifest.test_ids;
4454
4449
  const targetName = manifest.target?.name ?? "unknown";
4455
4450
  const evalSet = manifest.dataset ?? "";
4456
4451
  const experiment = manifest.experiment;
4457
4452
  const safeEvalSet = evalSet ? evalSet.replace(/[\/\\:*?"<>|]/g, "_") : "";
4458
- let stdinData;
4459
- if (llmScoresPath) {
4460
- stdinData = await readFile(llmScoresPath, "utf8");
4461
- } else {
4462
- stdinData = await readStdin();
4463
- }
4464
- const llmScores = stdinData ? JSON.parse(stdinData) : {};
4465
4453
  const indexLines = [];
4466
4454
  const allPassRates = [];
4467
4455
  for (const testId of testIds) {
@@ -4488,14 +4476,18 @@ var evalBenchCommand = command({
4488
4476
  }
4489
4477
  } catch {
4490
4478
  }
4491
- const testLlmScores = llmScores[testId] ?? {};
4492
4479
  const llmGradersDir = join(testDir, "llm_graders");
4493
4480
  try {
4494
4481
  const graderFiles = (await readdir(llmGradersDir)).filter((f) => f.endsWith(".json"));
4495
4482
  for (const file of graderFiles) {
4496
4483
  const graderMeta = JSON.parse(await readFile(join(llmGradersDir, file), "utf8"));
4497
4484
  const graderName = graderMeta.name;
4498
- const llmResult = testLlmScores[graderName];
4485
+ const diskResultPath = join(testDir, "llm_grader_results", `${graderName}.json`);
4486
+ let llmResult;
4487
+ try {
4488
+ llmResult = JSON.parse(await readFile(diskResultPath, "utf8"));
4489
+ } catch {
4490
+ }
4499
4491
  if (llmResult) {
4500
4492
  evaluators.push({
4501
4493
  name: graderName,
@@ -4515,7 +4507,7 @@ var evalBenchCommand = command({
4515
4507
  const weightedScore = totalWeight > 0 ? evaluators.reduce((sum, e) => sum + e.score * e.weight, 0) / totalWeight : 0;
4516
4508
  const passed = allAssertions.filter((a) => a.passed).length;
4517
4509
  const failed = allAssertions.filter((a) => !a.passed).length;
4518
- const passRate = allAssertions.length > 0 ? Math.round(passed / allAssertions.length * 1e3) / 1e3 : 0;
4510
+ const passRate = allAssertions.length > 0 ? Math.round(passed / allAssertions.length * 1e3) / 1e3 : weightedScore >= 0.5 ? 1 : 0;
4519
4511
  allPassRates.push(passRate);
4520
4512
  const grading = {
4521
4513
  assertions: allAssertions,
@@ -4608,13 +4600,6 @@ var evalBenchCommand = command({
4608
4600
  console.log(`Benchmark: ${testIds.length} test(s), pass_rate=${passRateStats.mean}`);
4609
4601
  }
4610
4602
  });
4611
- async function readStdin() {
4612
- const chunks = [];
4613
- for await (const chunk of process.stdin) {
4614
- chunks.push(chunk);
4615
- }
4616
- return Buffer.concat(chunks).toString("utf8").trim();
4617
- }
4618
4603
  function computeStats(values) {
4619
4604
  if (values.length === 0) return { mean: 0, stddev: 0 };
4620
4605
  const mean2 = values.reduce((sum, v) => sum + v, 0) / values.length;
@@ -4681,7 +4666,10 @@ async function runCodeGraders(tasks, concurrency) {
4681
4666
  );
4682
4667
  const parsed = JSON.parse(stdout);
4683
4668
  const score = typeof parsed.score === "number" ? parsed.score : 0;
4684
- const assertions = Array.isArray(parsed.assertions) ? parsed.assertions : [];
4669
+ const assertions = Array.isArray(parsed.assertions) && parsed.assertions.length > 0 ? parsed.assertions : [
4670
+ ...(parsed.hits ?? []).map((h) => ({ text: h, passed: true })),
4671
+ ...(parsed.misses ?? []).map((m) => ({ text: m, passed: false }))
4672
+ ];
4685
4673
  const result = {
4686
4674
  name: graderName,
4687
4675
  type: "code-grader",
@@ -8330,4 +8318,4 @@ export {
8330
8318
  preprocessArgv,
8331
8319
  runCli
8332
8320
  };
8333
- //# sourceMappingURL=chunk-UXSQQHCI.js.map
8321
+ //# sourceMappingURL=chunk-ASU5L5ZW.js.map