@answerlayer/cli 0.1.7 → 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 +5 -1
- package/package.json +1 -1
- package/skills/answerlayer/SKILL.md +1 -1
- package/src/cli.js +74 -2
package/README.md
CHANGED
|
@@ -163,12 +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"
|
|
170
173
|
answerlayer evals runs update <run-id> --label "Prompt experiment B"
|
|
171
174
|
answerlayer evals runs compare <run-id> --baseline <baseline-run-id>
|
|
175
|
+
answerlayer evals runs analyze <run-id> --json
|
|
172
176
|
|
|
173
177
|
answerlayer dashboards create --title "Executive overview" --visibility org
|
|
174
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,11 +679,33 @@ 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, {
|
|
@@ -705,6 +727,9 @@ async function handleEvals(client, resource, positionals, parsed, io) {
|
|
|
705
727
|
query: { baseline_run_id: firstValue(parsed.flags.baseline) },
|
|
706
728
|
});
|
|
707
729
|
}
|
|
730
|
+
if (command === "analyze" || command === "analysis") {
|
|
731
|
+
return requestAndPrint(client, "GET", `${base}/runs/${encodeURIComponent(runId)}/analysis`, parsed, io);
|
|
732
|
+
}
|
|
708
733
|
throw usage(`Unknown evals runs command: ${command}`);
|
|
709
734
|
}
|
|
710
735
|
|
|
@@ -1140,6 +1165,7 @@ function evalCasePayload(flags) {
|
|
|
1140
1165
|
return {
|
|
1141
1166
|
title: firstValue(flags.title),
|
|
1142
1167
|
question: firstValue(flags.question),
|
|
1168
|
+
category: firstValue(flags.category),
|
|
1143
1169
|
expected_answer: firstValue(flags.expectedAnswer),
|
|
1144
1170
|
expected_sql: firstValue(flags.expectedSql) || firstValue(flags.sql),
|
|
1145
1171
|
expected_values: parseJsonFlag(firstValue(flags.expectedValues), "expected-values"),
|
|
@@ -1425,6 +1451,7 @@ function normalizeFlagName(rawName) {
|
|
|
1425
1451
|
"--baseline-run": "baseline",
|
|
1426
1452
|
"--case": "case",
|
|
1427
1453
|
"--case-id": "case",
|
|
1454
|
+
"--category": "category",
|
|
1428
1455
|
"--expected-answer": "expectedAnswer",
|
|
1429
1456
|
"--expected-sql": "expectedSql",
|
|
1430
1457
|
"--expected-values": "expectedValues",
|
|
@@ -1483,6 +1510,18 @@ function parseNumber(value, name) {
|
|
|
1483
1510
|
return parsed;
|
|
1484
1511
|
}
|
|
1485
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
|
+
|
|
1486
1525
|
function requirePositional(positionals, index, label) {
|
|
1487
1526
|
const value = positionals[index];
|
|
1488
1527
|
if (!value) throw usage(`Missing ${label}`);
|
|
@@ -1497,6 +1536,25 @@ function requirePayloadValue(payload, key, message) {
|
|
|
1497
1536
|
if (!payload[key]) throw usage(message);
|
|
1498
1537
|
}
|
|
1499
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
|
+
|
|
1500
1558
|
function csvOrRepeated(value) {
|
|
1501
1559
|
const values = allValues(value);
|
|
1502
1560
|
return values.flatMap((item) => String(item).split(",").map((part) => part.trim()).filter(Boolean));
|
|
@@ -1506,6 +1564,14 @@ function optionalCsvOrRepeated(value) {
|
|
|
1506
1564
|
return value === undefined ? undefined : csvOrRepeated(value);
|
|
1507
1565
|
}
|
|
1508
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
|
+
|
|
1509
1575
|
function firstValue(value) {
|
|
1510
1576
|
return Array.isArray(value) ? value[0] : value;
|
|
1511
1577
|
}
|
|
@@ -1568,9 +1634,15 @@ Data products:
|
|
|
1568
1634
|
answerlayer inquiry models|ask|sessions|create-session|session|update-session|delete-session|turn
|
|
1569
1635
|
answerlayer evals suites list|create|get|update|delete
|
|
1570
1636
|
answerlayer evals cases create|update|delete
|
|
1571
|
-
answerlayer evals runs list|create|get|update|cancel|compare
|
|
1572
|
-
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
|
|
1573
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
|
|
1574
1646
|
update accepts --label <name>
|
|
1575
1647
|
answerlayer generation start|list|get|status|stream|cancel|questions|guidance|delete
|
|
1576
1648
|
answerlayer tiles list|get|create|update|data|delete
|