@answerlayer/cli 0.1.18 → 0.2.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.
- package/README.md +11 -1
- package/package.json +1 -1
- package/skills/answerlayer/SKILL.md +2 -1
- package/src/cli.js +106 -3
package/README.md
CHANGED
|
@@ -271,6 +271,8 @@ answerlayer inquiry ask --connection <connection-id> --model claude-opus-4-6 "In
|
|
|
271
271
|
|
|
272
272
|
answerlayer evals suites create --name "Revenue checks" --connection <connection-id>
|
|
273
273
|
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 ..." --oracle-sources '[{"kind":"external","title":"Revenue policy","url":"https://example.com/revenue-policy"}]'
|
|
274
|
+
answerlayer evals cases create <suite-id> --title "Unseen revenue check" --question "How much revenue did we make?" --partition holdout --expected-sql "select sum(amount) from orders"
|
|
275
|
+
answerlayer evals cases reveal <case-id> --json # admin-only, explicit, and audited
|
|
274
276
|
answerlayer evals runs create <suite-id> --label "Before prompt change"
|
|
275
277
|
answerlayer evals runs create <suite-id> --case <case-id> --case <case-id> --label "Focused smoke run"
|
|
276
278
|
answerlayer evals runs create <suite-id> --category Revenue --category Finance --case <case-id> --label "Focused category run"
|
|
@@ -280,6 +282,14 @@ answerlayer evals runs create-batch --suite <suite-id> --suite <suite-id> --conc
|
|
|
280
282
|
answerlayer evals runs update <run-id> --label "Prompt experiment B"
|
|
281
283
|
answerlayer evals runs compare <run-id> --baseline <baseline-run-id>
|
|
282
284
|
answerlayer evals runs analyze <run-id> --json
|
|
285
|
+
answerlayer generation start --connection <connection-id> --component-type metrics --eval-suite <suite-id> --eval-case <authoring-case-id> --prompt "Improve these concepts"
|
|
286
|
+
|
|
287
|
+
answerlayer ontologies create --domain-key exoplanet-archive --name "Exoplanet Archive"
|
|
288
|
+
answerlayer ontologies version create <ontology-id> --file ./ontology.tff
|
|
289
|
+
answerlayer ontologies version validate <version-id>
|
|
290
|
+
answerlayer ontologies version review <version-id> # admin-only
|
|
291
|
+
answerlayer ontologies version freeze <version-id> # admin-only
|
|
292
|
+
answerlayer ontologies version export <version-id> --output ./ontology.tff
|
|
283
293
|
|
|
284
294
|
answerlayer dashboards create --title "Executive overview" --visibility org
|
|
285
295
|
answerlayer tiles create --title "Revenue" --source-type saved_query --source <saved-query-id>
|
|
@@ -304,7 +314,7 @@ answerlayer branding update --data-file ./branding.json
|
|
|
304
314
|
## Command groups
|
|
305
315
|
|
|
306
316
|
- Core: `api-keys`, `connections`, `metadata`, `query`, `query-results`
|
|
307
|
-
- Data products: `saved-queries`, `semantic`, `inquiry`, `evals`, `generation`, `tiles`, `dashboards`
|
|
317
|
+
- Data products: `saved-queries`, `semantic`, `inquiry`, `evals`, `ontologies`, `generation`, `tiles`, `dashboards`
|
|
308
318
|
- Supporting resources: `documents`, `branding`, `uploads`, `chains`, `users`, `org`, `roles`, `billing`, `stats`
|
|
309
319
|
|
|
310
320
|
## Development
|
package/package.json
CHANGED
|
@@ -175,7 +175,8 @@ to see exact flags before using one:
|
|
|
175
175
|
- `saved-queries` — list / get / create / execute reusable queries
|
|
176
176
|
- `semantic` — entities, relationships, measures, metrics, dimensions, filters
|
|
177
177
|
(most need `--connection <id>`)
|
|
178
|
-
- `evals` — create evaluation suites and cases, run them, compare runs, and retrieve evidence-backed failure analysis
|
|
178
|
+
- `evals` — create evaluation suites and partitioned cases, explicitly reveal protected oracles, run them, compare runs, and retrieve evidence-backed failure analysis
|
|
179
|
+
- `generation` — generate semantic components, optionally grounded by an eval suite's authoring cases; holdout and adversarial cases are rejected
|
|
179
180
|
- `dashboards`, `tiles` — build and read dashboards
|
|
180
181
|
- `documents` — upload business-context docs and link them to connections
|
|
181
182
|
- `connections` — create / test / inspect schema
|
package/src/cli.js
CHANGED
|
@@ -56,6 +56,7 @@ export async function main(argv, io) {
|
|
|
56
56
|
if (group === "semantic") return handleSemantic(client, command, positionals, parsed, io);
|
|
57
57
|
if (group === "inquiry") return handleInquiry(client, command, positionals, parsed, io);
|
|
58
58
|
if (group === "evals" || group === "evaluations") return handleEvals(client, command, positionals, parsed, io);
|
|
59
|
+
if (group === "ontologies" || group === "ontology") return handleOntologies(client, command, positionals, parsed, io);
|
|
59
60
|
if (group === "generation") return handleGeneration(client, command, positionals, parsed, io);
|
|
60
61
|
if (group === "tiles") return handleTiles(client, command, positionals, parsed, io);
|
|
61
62
|
if (group === "dashboards") return handleDashboards(client, command, positionals, parsed, io);
|
|
@@ -648,6 +649,7 @@ async function handleEvals(client, resource, positionals, parsed, io) {
|
|
|
648
649
|
body: await readData(parsed.flags, io, { ...evalCasePayload(parsed.flags), is_active: activeFlag(parsed.flags) }),
|
|
649
650
|
});
|
|
650
651
|
}
|
|
652
|
+
if (command === "reveal") return requestAndPrint(client, "POST", `${base}/cases/${encodeURIComponent(caseId)}/reveal`, parsed, io);
|
|
651
653
|
if (command === "delete") return requestAndPrint(client, "DELETE", `${base}/cases/${encodeURIComponent(caseId)}`, parsed, io);
|
|
652
654
|
throw usage(`Unknown evals cases command: ${command}`);
|
|
653
655
|
}
|
|
@@ -735,11 +737,81 @@ async function handleEvals(client, resource, positionals, parsed, io) {
|
|
|
735
737
|
throw usage(`Expected evals resource: suites, cases, or runs`);
|
|
736
738
|
}
|
|
737
739
|
|
|
740
|
+
async function handleOntologies(client, command, positionals, parsed, io) {
|
|
741
|
+
const base = "/api/v1/ontologies";
|
|
742
|
+
if (command === "list" || !command) {
|
|
743
|
+
return requestAndPrint(client, "GET", base, parsed, io, {
|
|
744
|
+
table: [
|
|
745
|
+
{ key: "id", label: "ID" },
|
|
746
|
+
{ key: "domain_key", label: "Domain" },
|
|
747
|
+
{ key: "name", label: "Name" },
|
|
748
|
+
{ key: "version_count", label: "Versions" },
|
|
749
|
+
{ key: "latest_version.status", label: "Latest" },
|
|
750
|
+
{ key: "latest_version.validation_status", label: "Validation" },
|
|
751
|
+
],
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
if (command === "create") {
|
|
756
|
+
const payload = await readData(parsed.flags, io, {
|
|
757
|
+
domain_key: firstValue(parsed.flags.domainKey),
|
|
758
|
+
name: firstValue(parsed.flags.name),
|
|
759
|
+
description: firstValue(parsed.flags.description),
|
|
760
|
+
});
|
|
761
|
+
requirePayloadValue(payload, "domain_key", "ontologies create requires --domain-key");
|
|
762
|
+
requirePayloadValue(payload, "name", "ontologies create requires --name");
|
|
763
|
+
return requestAndPrint(client, "POST", base, parsed, io, { body: payload });
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (command === "get") {
|
|
767
|
+
const ontologyId = requirePositional(positionals, 0, "ontology id");
|
|
768
|
+
return requestAndPrint(client, "GET", `${base}/${encodeURIComponent(ontologyId)}`, parsed, io);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
if (command === "validate") {
|
|
772
|
+
const sourceText = await readTff(parsed.flags, io);
|
|
773
|
+
return requestAndPrint(client, "POST", `${base}/validate`, parsed, io, {
|
|
774
|
+
body: { source_text: sourceText },
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
if (command === "version" || command === "versions") {
|
|
779
|
+
const [action, id] = positionals;
|
|
780
|
+
if (action === "create") {
|
|
781
|
+
const ontologyId = requirePositional(positionals, 1, "ontology id");
|
|
782
|
+
const sourceText = await readTff(parsed.flags, io);
|
|
783
|
+
return requestAndPrint(client, "POST", `${base}/${encodeURIComponent(ontologyId)}/versions`, parsed, io, {
|
|
784
|
+
body: {
|
|
785
|
+
source_text: sourceText,
|
|
786
|
+
predecessor_version_id: firstValue(parsed.flags.predecessor),
|
|
787
|
+
},
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
const versionId = id || requirePositional(positionals, 1, "ontology version id");
|
|
791
|
+
if (["validate", "review", "freeze"].includes(action)) {
|
|
792
|
+
return requestAndPrint(client, "POST", `${base}/versions/${encodeURIComponent(versionId)}/${action}`, parsed, io);
|
|
793
|
+
}
|
|
794
|
+
if (action === "export") {
|
|
795
|
+
return requestAndPrint(client, "GET", `${base}/versions/${encodeURIComponent(versionId)}/source`, parsed, io, { rawDefault: true });
|
|
796
|
+
}
|
|
797
|
+
throw usage("Expected ontologies version create|validate|review|freeze|export");
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
throw usage(`Unknown ontologies command: ${command}`);
|
|
801
|
+
}
|
|
802
|
+
|
|
738
803
|
async function handleGeneration(client, command, positionals, parsed, io) {
|
|
739
804
|
const base = "/api/v1/semantic/jobs";
|
|
740
805
|
if (command === "start" || command === "create") {
|
|
741
806
|
return requestAndPrint(client, "POST", base, parsed, io, {
|
|
742
|
-
body: await readData(parsed.flags, io
|
|
807
|
+
body: await readData(parsed.flags, io, {
|
|
808
|
+
connection_id: firstValue(parsed.flags.connection),
|
|
809
|
+
component_type: firstValue(parsed.flags.componentType),
|
|
810
|
+
prompt: firstValue(parsed.flags.prompt),
|
|
811
|
+
model: firstValue(parsed.flags.model),
|
|
812
|
+
eval_suite_id: firstValue(parsed.flags.evalSuite),
|
|
813
|
+
eval_case_ids: optionalCsvOrRepeated(parsed.flags.evalCase),
|
|
814
|
+
}),
|
|
743
815
|
});
|
|
744
816
|
}
|
|
745
817
|
if (command === "list" || !command) {
|
|
@@ -1165,6 +1237,7 @@ function evalCasePayload(flags) {
|
|
|
1165
1237
|
title: firstValue(flags.title),
|
|
1166
1238
|
question: firstValue(flags.question),
|
|
1167
1239
|
category: firstValue(flags.category),
|
|
1240
|
+
partition: firstValue(flags.partition),
|
|
1168
1241
|
expected_answer: firstValue(flags.expectedAnswer),
|
|
1169
1242
|
expected_sql: firstValue(flags.expectedSql) || firstValue(flags.sql),
|
|
1170
1243
|
expected_values: parseJsonFlag(firstValue(flags.expectedValues), "expected-values"),
|
|
@@ -1231,6 +1304,18 @@ async function readSql(flags, positionals, io) {
|
|
|
1231
1304
|
throw usage("SQL is required. Pass --sql, --file, a positional SQL string, or stdin.");
|
|
1232
1305
|
}
|
|
1233
1306
|
|
|
1307
|
+
async function readTff(flags, io) {
|
|
1308
|
+
const inline = firstValue(flags.tff);
|
|
1309
|
+
const file = firstValue(flags.file);
|
|
1310
|
+
if (inline) return inline;
|
|
1311
|
+
if (file) return fs.readFileSync(file, "utf8");
|
|
1312
|
+
if (!io.stdin.isTTY) {
|
|
1313
|
+
const source = await readAll(io.stdin);
|
|
1314
|
+
if (source.trim()) return source;
|
|
1315
|
+
}
|
|
1316
|
+
throw usage("TFF0 source is required. Pass --file, --tff, or stdin.");
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1234
1319
|
async function optionalSql(flags, positionals, io) {
|
|
1235
1320
|
if (firstValue(flags.sql) || firstValue(flags.file) || positionals.length > 0) {
|
|
1236
1321
|
return readSql(flags, positionals, io);
|
|
@@ -1420,6 +1505,9 @@ function normalizeFlagName(rawName) {
|
|
|
1420
1505
|
"--expression": "expression",
|
|
1421
1506
|
"--source-type": "sourceType",
|
|
1422
1507
|
"--source": "source",
|
|
1508
|
+
"--domain-key": "domainKey",
|
|
1509
|
+
"--predecessor": "predecessor",
|
|
1510
|
+
"--tff": "tff",
|
|
1423
1511
|
"--visualization": "visualization",
|
|
1424
1512
|
"--dashboard": "dashboard",
|
|
1425
1513
|
"--tile": "tile",
|
|
@@ -1437,6 +1525,7 @@ function normalizeFlagName(rawName) {
|
|
|
1437
1525
|
"--h": "h",
|
|
1438
1526
|
"--prompt": "prompt",
|
|
1439
1527
|
"--model": "model",
|
|
1528
|
+
"--component-type": "componentType",
|
|
1440
1529
|
"--use-semantic-layer": "useSemanticLayer",
|
|
1441
1530
|
"--no-semantic-layer": "noSemanticLayer",
|
|
1442
1531
|
"--no-demo": "noDemo",
|
|
@@ -1455,7 +1544,12 @@ function normalizeFlagName(rawName) {
|
|
|
1455
1544
|
"--baseline-run": "baseline",
|
|
1456
1545
|
"--case": "case",
|
|
1457
1546
|
"--case-id": "case",
|
|
1547
|
+
"--eval-suite": "evalSuite",
|
|
1548
|
+
"--eval-suite-id": "evalSuite",
|
|
1549
|
+
"--eval-case": "evalCase",
|
|
1550
|
+
"--eval-case-id": "evalCase",
|
|
1458
1551
|
"--category": "category",
|
|
1552
|
+
"--partition": "partition",
|
|
1459
1553
|
"--expected-answer": "expectedAnswer",
|
|
1460
1554
|
"--expected-sql": "expectedSql",
|
|
1461
1555
|
"--expected-values": "expectedValues",
|
|
@@ -1655,9 +1749,10 @@ Data products:
|
|
|
1655
1749
|
answerlayer semantic <entities|relationships|measures|metrics|dimensions|filters> list|get|create|update|delete|delete-all|generate
|
|
1656
1750
|
answerlayer inquiry models|ask|sessions|create-session|session|update-session|delete-session|turn
|
|
1657
1751
|
answerlayer evals suites list|create|get|update|delete
|
|
1658
|
-
answerlayer evals cases create|update|delete
|
|
1752
|
+
answerlayer evals cases create|update|reveal|delete
|
|
1659
1753
|
answerlayer evals runs list|create|create-batch|get|update|cancel|compare|analyze
|
|
1660
|
-
case create/update accept --category <name
|
|
1754
|
+
case create/update accept --category <name>,
|
|
1755
|
+
--partition <authoring|holdout|adversarial>, and
|
|
1661
1756
|
--oracle-sources '<JSON array>'
|
|
1662
1757
|
run create accepts --case <case-id> (repeat or comma-separate) and
|
|
1663
1758
|
--category <name> (repeat; category and case selectors are unioned),
|
|
@@ -1667,7 +1762,15 @@ Data products:
|
|
|
1667
1762
|
--suite values, plus shared --label, --model, --concurrency <1-8>,
|
|
1668
1763
|
and --use-semantic-layer or --no-semantic-layer
|
|
1669
1764
|
update accepts --label <name>
|
|
1765
|
+
answerlayer ontologies list|create|get|validate
|
|
1766
|
+
validate accepts --file <ontology.tff>, --tff <source>, or stdin
|
|
1767
|
+
answerlayer ontologies version create|validate|review|freeze|export
|
|
1768
|
+
version create accepts an ontology id, --file <ontology.tff>, --tff <source>,
|
|
1769
|
+
or stdin, plus optional --predecessor <version-id>
|
|
1670
1770
|
answerlayer generation start|list|get|status|stream|cancel|questions|guidance|delete
|
|
1771
|
+
start accepts --connection, --component-type, --prompt, --model,
|
|
1772
|
+
--eval-suite, and repeatable or comma-separated --eval-case values;
|
|
1773
|
+
only authoring cases are accepted as generation context
|
|
1671
1774
|
answerlayer tiles list|get|create|update|data|delete
|
|
1672
1775
|
answerlayer dashboards list|get|create|update|delete|duplicate|manifest|attach-tile|move-tile|detach-tile|assignments|assign|unassign|tile-data
|
|
1673
1776
|
|