@answerlayer/cli 0.1.6 → 0.1.8
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 +6 -1
- package/package.json +1 -1
- package/skills/answerlayer/SKILL.md +1 -1
- package/src/cli.js +84 -2
package/README.md
CHANGED
|
@@ -163,11 +163,16 @@ answerlayer inquiry models
|
|
|
163
163
|
answerlayer inquiry ask --connection <connection-id> --model claude-opus-4-6 "Investigate unusual revenue changes"
|
|
164
164
|
|
|
165
165
|
answerlayer evals suites create --name "Revenue checks" --connection <connection-id>
|
|
166
|
-
answerlayer evals cases create <suite-id> --title "Monthly revenue" --question "What was revenue last month?" --expected-sql "select sum(amount) from orders where ..."
|
|
166
|
+
answerlayer evals cases create <suite-id> --title "Monthly revenue" --question "What was revenue last month?" --category Revenue --expected-sql "select sum(amount) from orders where ..."
|
|
167
167
|
answerlayer evals runs create <suite-id> --label "Before prompt change"
|
|
168
168
|
answerlayer evals runs create <suite-id> --case <case-id> --case <case-id> --label "Focused smoke run"
|
|
169
|
+
answerlayer evals runs create <suite-id> --category Revenue --category Finance --case <case-id> --label "Focused category run"
|
|
169
170
|
answerlayer evals runs create <suite-id> --model claude-opus-4-6 --label "Model comparison"
|
|
171
|
+
answerlayer evals runs create <suite-id> --concurrency 4 --label "Parallel smoke run"
|
|
172
|
+
answerlayer evals runs create-batch --suite <suite-id> --suite <suite-id> --concurrency 4 --label "Release candidate"
|
|
173
|
+
answerlayer evals runs update <run-id> --label "Prompt experiment B"
|
|
170
174
|
answerlayer evals runs compare <run-id> --baseline <baseline-run-id>
|
|
175
|
+
answerlayer evals runs analyze <run-id> --json
|
|
171
176
|
|
|
172
177
|
answerlayer dashboards create --title "Executive overview" --visibility org
|
|
173
178
|
answerlayer tiles create --title "Revenue" --source-type saved_query --source <saved-query-id>
|
package/package.json
CHANGED
|
@@ -147,7 +147,7 @@ to see exact flags before using one:
|
|
|
147
147
|
- `saved-queries` — list / get / create / execute reusable queries
|
|
148
148
|
- `semantic` — entities, relationships, measures, metrics, dimensions, filters
|
|
149
149
|
(most need `--connection <id>`)
|
|
150
|
-
- `evals` — create evaluation suites and cases, run them, and
|
|
150
|
+
- `evals` — create evaluation suites and cases, run them, compare runs, and retrieve evidence-backed failure analysis
|
|
151
151
|
- `dashboards`, `tiles` — build and read dashboards
|
|
152
152
|
- `documents` — upload business-context docs and link them to connections
|
|
153
153
|
- `connections` — create / test / inspect schema
|
package/src/cli.js
CHANGED
|
@@ -679,23 +679,57 @@ async function handleEvals(client, resource, positionals, parsed, io) {
|
|
|
679
679
|
use_semantic_layer: semanticLayerMode(parsed.flags),
|
|
680
680
|
baseline_run_id: firstValue(parsed.flags.baseline),
|
|
681
681
|
case_ids: optionalCsvOrRepeated(parsed.flags.case),
|
|
682
|
+
categories: optionalDistinctRepeated(parsed.flags.category),
|
|
683
|
+
case_concurrency: firstValue(parsed.flags.concurrency),
|
|
682
684
|
});
|
|
683
685
|
requirePayloadValue(payload, "suite_id", "evals runs create requires a suite id or --suite");
|
|
686
|
+
normalizeEvalCaseConcurrency(payload);
|
|
684
687
|
return requestAndPrint(client, "POST", `${base}/runs`, parsed, io, { body: payload });
|
|
685
688
|
}
|
|
686
689
|
|
|
690
|
+
if (command === "create-batch") {
|
|
691
|
+
const selectedSuites = csvOrRepeated([
|
|
692
|
+
...rest,
|
|
693
|
+
...allValues(parsed.flags.suite),
|
|
694
|
+
]);
|
|
695
|
+
const payload = await readData(parsed.flags, io, {
|
|
696
|
+
suite_ids: selectedSuites.length > 0 ? selectedSuites : undefined,
|
|
697
|
+
label: firstValue(parsed.flags.label),
|
|
698
|
+
model: firstValue(parsed.flags.model),
|
|
699
|
+
use_semantic_layer: semanticLayerMode(parsed.flags),
|
|
700
|
+
case_concurrency: firstValue(parsed.flags.concurrency),
|
|
701
|
+
});
|
|
702
|
+
requireEvalBatchSuites(payload.suite_ids);
|
|
703
|
+
normalizeEvalCaseConcurrency(payload);
|
|
704
|
+
return requestAndPrint(client, "POST", `${base}/runs/batch`, parsed, io, {
|
|
705
|
+
body: payload,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
687
709
|
const runId = requirePositional(rest, 0, "eval run id");
|
|
688
710
|
if (command === "get") {
|
|
689
711
|
return requestAndPrint(client, "GET", `${base}/runs/${encodeURIComponent(runId)}`, parsed, io, {
|
|
690
712
|
query: { include_semantic_snapshot: parsed.flags.includeSemanticSnapshot || undefined },
|
|
691
713
|
});
|
|
692
714
|
}
|
|
715
|
+
if (command === "update") {
|
|
716
|
+
const payload = await readData(parsed.flags, io, {
|
|
717
|
+
label: firstValue(parsed.flags.label),
|
|
718
|
+
});
|
|
719
|
+
requirePayloadValue(payload, "label", "evals runs update requires --label");
|
|
720
|
+
return requestAndPrint(client, "PATCH", `${base}/runs/${encodeURIComponent(runId)}`, parsed, io, {
|
|
721
|
+
body: payload,
|
|
722
|
+
});
|
|
723
|
+
}
|
|
693
724
|
if (command === "cancel") return requestAndPrint(client, "POST", `${base}/runs/${encodeURIComponent(runId)}/cancel`, parsed, io);
|
|
694
725
|
if (command === "compare") {
|
|
695
726
|
return requestAndPrint(client, "GET", `${base}/runs/${encodeURIComponent(runId)}/compare`, parsed, io, {
|
|
696
727
|
query: { baseline_run_id: firstValue(parsed.flags.baseline) },
|
|
697
728
|
});
|
|
698
729
|
}
|
|
730
|
+
if (command === "analyze" || command === "analysis") {
|
|
731
|
+
return requestAndPrint(client, "GET", `${base}/runs/${encodeURIComponent(runId)}/analysis`, parsed, io);
|
|
732
|
+
}
|
|
699
733
|
throw usage(`Unknown evals runs command: ${command}`);
|
|
700
734
|
}
|
|
701
735
|
|
|
@@ -1131,6 +1165,7 @@ function evalCasePayload(flags) {
|
|
|
1131
1165
|
return {
|
|
1132
1166
|
title: firstValue(flags.title),
|
|
1133
1167
|
question: firstValue(flags.question),
|
|
1168
|
+
category: firstValue(flags.category),
|
|
1134
1169
|
expected_answer: firstValue(flags.expectedAnswer),
|
|
1135
1170
|
expected_sql: firstValue(flags.expectedSql) || firstValue(flags.sql),
|
|
1136
1171
|
expected_values: parseJsonFlag(firstValue(flags.expectedValues), "expected-values"),
|
|
@@ -1416,6 +1451,7 @@ function normalizeFlagName(rawName) {
|
|
|
1416
1451
|
"--baseline-run": "baseline",
|
|
1417
1452
|
"--case": "case",
|
|
1418
1453
|
"--case-id": "case",
|
|
1454
|
+
"--category": "category",
|
|
1419
1455
|
"--expected-answer": "expectedAnswer",
|
|
1420
1456
|
"--expected-sql": "expectedSql",
|
|
1421
1457
|
"--expected-values": "expectedValues",
|
|
@@ -1474,6 +1510,18 @@ function parseNumber(value, name) {
|
|
|
1474
1510
|
return parsed;
|
|
1475
1511
|
}
|
|
1476
1512
|
|
|
1513
|
+
function parseBoundedInteger(value, name, minimum, maximum) {
|
|
1514
|
+
if (value === undefined || value === "") return undefined;
|
|
1515
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
1516
|
+
throw usage(`Expected --${name} to be an integer from ${minimum} to ${maximum}`);
|
|
1517
|
+
}
|
|
1518
|
+
const parsed = Number(value);
|
|
1519
|
+
if (!Number.isInteger(parsed) || parsed < minimum || parsed > maximum) {
|
|
1520
|
+
throw usage(`Expected --${name} to be an integer from ${minimum} to ${maximum}`);
|
|
1521
|
+
}
|
|
1522
|
+
return parsed;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1477
1525
|
function requirePositional(positionals, index, label) {
|
|
1478
1526
|
const value = positionals[index];
|
|
1479
1527
|
if (!value) throw usage(`Missing ${label}`);
|
|
@@ -1488,6 +1536,25 @@ function requirePayloadValue(payload, key, message) {
|
|
|
1488
1536
|
if (!payload[key]) throw usage(message);
|
|
1489
1537
|
}
|
|
1490
1538
|
|
|
1539
|
+
function requireEvalBatchSuites(suiteIds) {
|
|
1540
|
+
if (!Array.isArray(suiteIds) || suiteIds.length < 2 || suiteIds.length > 20) {
|
|
1541
|
+
throw usage("evals runs create-batch requires 2 to 20 suite ids");
|
|
1542
|
+
}
|
|
1543
|
+
if (new Set(suiteIds.map(String)).size !== suiteIds.length) {
|
|
1544
|
+
throw usage("evals runs create-batch requires distinct suite ids");
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
function normalizeEvalCaseConcurrency(payload) {
|
|
1549
|
+
if (payload.case_concurrency === undefined) return;
|
|
1550
|
+
payload.case_concurrency = parseBoundedInteger(
|
|
1551
|
+
payload.case_concurrency,
|
|
1552
|
+
"concurrency",
|
|
1553
|
+
1,
|
|
1554
|
+
8,
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1491
1558
|
function csvOrRepeated(value) {
|
|
1492
1559
|
const values = allValues(value);
|
|
1493
1560
|
return values.flatMap((item) => String(item).split(",").map((part) => part.trim()).filter(Boolean));
|
|
@@ -1497,6 +1564,14 @@ function optionalCsvOrRepeated(value) {
|
|
|
1497
1564
|
return value === undefined ? undefined : csvOrRepeated(value);
|
|
1498
1565
|
}
|
|
1499
1566
|
|
|
1567
|
+
function optionalDistinctRepeated(value) {
|
|
1568
|
+
if (value === undefined) return undefined;
|
|
1569
|
+
const values = allValues(value)
|
|
1570
|
+
.map((item) => String(item).trim())
|
|
1571
|
+
.filter(Boolean);
|
|
1572
|
+
return [...new Set(values)];
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1500
1575
|
function firstValue(value) {
|
|
1501
1576
|
return Array.isArray(value) ? value[0] : value;
|
|
1502
1577
|
}
|
|
@@ -1559,9 +1634,16 @@ Data products:
|
|
|
1559
1634
|
answerlayer inquiry models|ask|sessions|create-session|session|update-session|delete-session|turn
|
|
1560
1635
|
answerlayer evals suites list|create|get|update|delete
|
|
1561
1636
|
answerlayer evals cases create|update|delete
|
|
1562
|
-
answerlayer evals runs list|create|get|cancel|compare
|
|
1563
|
-
create
|
|
1637
|
+
answerlayer evals runs list|create|create-batch|get|update|cancel|compare|analyze
|
|
1638
|
+
case create/update accept --category <name>
|
|
1639
|
+
run create accepts --case <case-id> (repeat or comma-separate) and
|
|
1640
|
+
--category <name> (repeat; category and case selectors are unioned),
|
|
1641
|
+
--concurrency <1-8> (default 3; 1 is serial), and
|
|
1564
1642
|
--use-semantic-layer or --no-semantic-layer
|
|
1643
|
+
create-batch accepts 2 to 20 suite ids as positionals or repeatable
|
|
1644
|
+
--suite values, plus shared --label, --model, --concurrency <1-8>,
|
|
1645
|
+
and --use-semantic-layer or --no-semantic-layer
|
|
1646
|
+
update accepts --label <name>
|
|
1565
1647
|
answerlayer generation start|list|get|status|stream|cancel|questions|guidance|delete
|
|
1566
1648
|
answerlayer tiles list|get|create|update|data|delete
|
|
1567
1649
|
answerlayer dashboards list|get|create|update|delete|duplicate|manifest|attach-tile|move-tile|detach-tile|assignments|assign|unassign|tile-data
|