@answerlayer/cli 0.1.4 → 0.1.6
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 +4 -0
- package/package.json +1 -1
- package/src/cli.js +34 -2
package/README.md
CHANGED
|
@@ -159,10 +159,14 @@ answerlayer semantic metrics generate --connection <connection-id> --prompt "Saa
|
|
|
159
159
|
|
|
160
160
|
answerlayer inquiry ask --connection <connection-id> "What changed in revenue this month?"
|
|
161
161
|
answerlayer inquiry ask --session <session-id> "Break that down by region"
|
|
162
|
+
answerlayer inquiry models
|
|
163
|
+
answerlayer inquiry ask --connection <connection-id> --model claude-opus-4-6 "Investigate unusual revenue changes"
|
|
162
164
|
|
|
163
165
|
answerlayer evals suites create --name "Revenue checks" --connection <connection-id>
|
|
164
166
|
answerlayer evals cases create <suite-id> --title "Monthly revenue" --question "What was revenue last month?" --expected-sql "select sum(amount) from orders where ..."
|
|
165
167
|
answerlayer evals runs create <suite-id> --label "Before prompt change"
|
|
168
|
+
answerlayer evals runs create <suite-id> --case <case-id> --case <case-id> --label "Focused smoke run"
|
|
169
|
+
answerlayer evals runs create <suite-id> --model claude-opus-4-6 --label "Model comparison"
|
|
166
170
|
answerlayer evals runs compare <run-id> --baseline <baseline-run-id>
|
|
167
171
|
|
|
168
172
|
answerlayer dashboards create --title "Executive overview" --visibility org
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -489,6 +489,20 @@ async function handleSemantic(client, command, positionals, parsed, io) {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
async function handleInquiry(client, command, positionals, parsed, io) {
|
|
492
|
+
if (command === "models") {
|
|
493
|
+
return requestAndPrint(client, "GET", "/api/v1/inquiry/models", parsed, io, {
|
|
494
|
+
tableDataKey: "models",
|
|
495
|
+
tablePrefix: (data) => `Default model: ${data.default_model}\n\n`,
|
|
496
|
+
table: [
|
|
497
|
+
{ key: "id", label: "ID" },
|
|
498
|
+
{ key: "label", label: "Model" },
|
|
499
|
+
{ key: "family", label: "Provider" },
|
|
500
|
+
{ key: "transport", label: "Transport" },
|
|
501
|
+
{ key: "description", label: "Description" },
|
|
502
|
+
],
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
492
506
|
if (command === "ask") {
|
|
493
507
|
const question = firstValue(parsed.flags.question) || positionals.join(" ");
|
|
494
508
|
const connectionId = firstValue(parsed.flags.connection);
|
|
@@ -662,7 +676,9 @@ async function handleEvals(client, resource, positionals, parsed, io) {
|
|
|
662
676
|
suite_id: firstValue(parsed.flags.suite) || rest[0],
|
|
663
677
|
label: firstValue(parsed.flags.label),
|
|
664
678
|
model: firstValue(parsed.flags.model),
|
|
679
|
+
use_semantic_layer: semanticLayerMode(parsed.flags),
|
|
665
680
|
baseline_run_id: firstValue(parsed.flags.baseline),
|
|
681
|
+
case_ids: optionalCsvOrRepeated(parsed.flags.case),
|
|
666
682
|
});
|
|
667
683
|
requirePayloadValue(payload, "suite_id", "evals runs create requires a suite id or --suite");
|
|
668
684
|
return requestAndPrint(client, "POST", `${base}/runs`, parsed, io, { body: payload });
|
|
@@ -1134,6 +1150,15 @@ function activeFlag(flags) {
|
|
|
1134
1150
|
return undefined;
|
|
1135
1151
|
}
|
|
1136
1152
|
|
|
1153
|
+
function semanticLayerMode(flags) {
|
|
1154
|
+
if (flags.useSemanticLayer && flags.noSemanticLayer) {
|
|
1155
|
+
throw usage("Use only one of --use-semantic-layer or --no-semantic-layer");
|
|
1156
|
+
}
|
|
1157
|
+
if (flags.useSemanticLayer) return true;
|
|
1158
|
+
if (flags.noSemanticLayer) return false;
|
|
1159
|
+
return undefined;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1137
1162
|
async function semanticPayload(resource, flags, positionals, io) {
|
|
1138
1163
|
const common = {
|
|
1139
1164
|
name: firstValue(flags.name) || positionals.join(" ") || undefined,
|
|
@@ -1259,6 +1284,7 @@ async function requestAndPrint(client, method, pathName, parsed, io, options = {
|
|
|
1259
1284
|
if (!parsed.flags.json && options.table) {
|
|
1260
1285
|
const rows = options.tableDataKey ? result.data[options.tableDataKey] : result.data;
|
|
1261
1286
|
if (Array.isArray(rows)) {
|
|
1287
|
+
if (options.tablePrefix) write(io.stdout, options.tablePrefix(result.data));
|
|
1262
1288
|
write(io.stdout, formatList(rows, options.table));
|
|
1263
1289
|
return;
|
|
1264
1290
|
}
|
|
@@ -1376,6 +1402,8 @@ function normalizeFlagName(rawName) {
|
|
|
1376
1402
|
"--h": "h",
|
|
1377
1403
|
"--prompt": "prompt",
|
|
1378
1404
|
"--model": "model",
|
|
1405
|
+
"--use-semantic-layer": "useSemanticLayer",
|
|
1406
|
+
"--no-semantic-layer": "noSemanticLayer",
|
|
1379
1407
|
"--options": "options",
|
|
1380
1408
|
"--status": "status",
|
|
1381
1409
|
"--summary": "summary",
|
|
@@ -1386,6 +1414,8 @@ function normalizeFlagName(rawName) {
|
|
|
1386
1414
|
"--label": "label",
|
|
1387
1415
|
"--baseline": "baseline",
|
|
1388
1416
|
"--baseline-run": "baseline",
|
|
1417
|
+
"--case": "case",
|
|
1418
|
+
"--case-id": "case",
|
|
1389
1419
|
"--expected-answer": "expectedAnswer",
|
|
1390
1420
|
"--expected-sql": "expectedSql",
|
|
1391
1421
|
"--expected-values": "expectedValues",
|
|
@@ -1412,7 +1442,7 @@ function normalizeFlagName(rawName) {
|
|
|
1412
1442
|
}
|
|
1413
1443
|
|
|
1414
1444
|
function isBooleanFlag(rawName) {
|
|
1415
|
-
return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot"].includes(rawName);
|
|
1445
|
+
return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot", "--use-semantic-layer", "--no-semantic-layer"].includes(rawName);
|
|
1416
1446
|
}
|
|
1417
1447
|
|
|
1418
1448
|
function setFlag(flags, name, value) {
|
|
@@ -1526,10 +1556,12 @@ Core:
|
|
|
1526
1556
|
Data products:
|
|
1527
1557
|
answerlayer saved-queries list|get|create|update|delete|approve|unapprove|execute
|
|
1528
1558
|
answerlayer semantic <entities|relationships|measures|metrics|dimensions|filters> list|get|create|update|delete|delete-all|generate
|
|
1529
|
-
answerlayer inquiry ask|sessions|create-session|session|update-session|delete-session|turn
|
|
1559
|
+
answerlayer inquiry models|ask|sessions|create-session|session|update-session|delete-session|turn
|
|
1530
1560
|
answerlayer evals suites list|create|get|update|delete
|
|
1531
1561
|
answerlayer evals cases create|update|delete
|
|
1532
1562
|
answerlayer evals runs list|create|get|cancel|compare
|
|
1563
|
+
create accepts --case <case-id> (repeat or comma-separate), and
|
|
1564
|
+
--use-semantic-layer or --no-semantic-layer
|
|
1533
1565
|
answerlayer generation start|list|get|status|stream|cancel|questions|guidance|delete
|
|
1534
1566
|
answerlayer tiles list|get|create|update|data|delete
|
|
1535
1567
|
answerlayer dashboards list|get|create|update|delete|duplicate|manifest|attach-tile|move-tile|detach-tile|assignments|assign|unassign|tile-data
|