@tuned-tensor/cli 0.19.0 → 0.21.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.
@@ -20,6 +20,10 @@ import {
20
20
  createLocalStore,
21
21
  datasetFormatSchema,
22
22
  datasetPrebuiltSchema,
23
+ decisionHyperparametersSchema,
24
+ decisionLabels,
25
+ decisionPlaceholderIssues,
26
+ decisionQuestionSchema,
23
27
  defaultBaseModelRevision,
24
28
  defaultLocalHome,
25
29
  evalExampleResultSchema,
@@ -40,6 +44,7 @@ import {
40
44
  hardenExistingLocalStore,
41
45
  initLocalRunnerConfigFile,
42
46
  initLocalSpecFile,
47
+ isDecisionSpecFile,
43
48
  isFoundationSpecFile,
44
49
  isTerminalRunState,
45
50
  jsonFieldMetricsSchema,
@@ -49,6 +54,7 @@ import {
49
54
  loadRunRequest,
50
55
  localAdapterSpecFileSchema,
51
56
  localBehaviorSpecFileSchema,
57
+ localDecisionSpecFileSchema,
52
58
  localFoundationSpecFileSchema,
53
59
  localPathsOverlap,
54
60
  localRunnerConfigSchema,
@@ -88,7 +94,7 @@ import {
88
94
  withHuggingFaceCacheEnvironment,
89
95
  withOfflineHuggingFaceCacheEnvironment,
90
96
  writePrivateJsonAtomic
91
- } from "./chunk-4Q54NHKR.js";
97
+ } from "./chunk-PVLX7LJI.js";
92
98
 
93
99
  // src/local-runtime/index.ts
94
100
  import { readFileSync as readFileSync3, realpathSync } from "fs";
@@ -972,7 +978,7 @@ var COMMAND_DEFINITIONS = {
972
978
  description: "Create a local tunedtensor.json behavior spec.",
973
979
  options: [
974
980
  { name: "--name", value: "name", description: "Behavior spec name" },
975
- { name: "--engine", value: "engine", description: "adapter (default) or foundation" },
981
+ { name: "--engine", value: "engine", description: "adapter (default), foundation or decision" },
976
982
  { name: "--model", value: "model", description: "Base model ID" },
977
983
  { name: "--output", value: "path", description: "Output spec path" },
978
984
  { name: "--profile", value: "profile", description: "Compatibility host profile (spark); creates only tunedtensor.json" },
@@ -1226,6 +1232,7 @@ async function configSelectionFromArgv(argv, adjacentTo, input) {
1226
1232
  async function configFromArgv(argv, adjacentTo) {
1227
1233
  return (await configSelectionFromArgv(argv, adjacentTo)).config;
1228
1234
  }
1235
+ var DECISION_SERVE_MESSAGE = "Decision models are not served through vLLM. Load the tuned model directory with `laya.load(<model_dir>)`; see docs/local-runtime/decision.md.";
1229
1236
  async function loadCliBehaviorSpec(inputPath, runId) {
1230
1237
  const input = await loadLocalRunInput(inputPath, {
1231
1238
  ...runId ? { runId } : {}
@@ -1235,6 +1242,11 @@ async function loadCliBehaviorSpec(inputPath, runId) {
1235
1242
  `This spec uses engine "foundation". Use \`tt pipeline run --spec ${input.path}\`; the legacy adapter runner cannot execute foundation specs.`
1236
1243
  );
1237
1244
  }
1245
+ if (input.kind === "decision-spec") {
1246
+ throw new Error(
1247
+ `This spec uses engine "decision". Use \`tt pipeline run --spec ${input.path}\`; the legacy adapter runner cannot execute decision specs.`
1248
+ );
1249
+ }
1238
1250
  if (input.kind !== "spec") {
1239
1251
  throw new Error(`TT expects a tunedtensor.json behavior spec, not a full run request: ${input.path}`);
1240
1252
  }
@@ -1405,6 +1417,7 @@ async function modelSystemPrompt(args) {
1405
1417
  if (isFoundationSpecFile(local.data)) {
1406
1418
  throw new Error("Foundation specs have no Hugging Face base model. Use `tt serve foundation --checkpoint <model-dir> --tokenizer <tokenizer.json>`.");
1407
1419
  }
1420
+ if (isDecisionSpecFile(local.data)) throw new Error(DECISION_SERVE_MESSAGE);
1408
1421
  spec = local.data;
1409
1422
  } else {
1410
1423
  const runRequestPath = join5(args.store.paths.runsDir, args.model.run_id, "request.json");
@@ -1556,6 +1569,7 @@ async function serveBaseModelFromCli(args) {
1556
1569
  if (spec && isFoundationSpecFile(spec)) {
1557
1570
  throw new Error("Foundation specs have no Hugging Face base model. Use `tt serve foundation --checkpoint <model-dir> --tokenizer <tokenizer.json>`.");
1558
1571
  }
1572
+ if (spec && isDecisionSpecFile(spec)) throw new Error(DECISION_SERVE_MESSAGE);
1559
1573
  let baseModel = spec?.base_model;
1560
1574
  if (!baseModel) {
1561
1575
  const store = createLocalStore(args.config.storeRoot);
@@ -1689,6 +1703,7 @@ async function main(argv) {
1689
1703
  const input = await loadLocalRunInput(inputPath);
1690
1704
  if (input.kind === "foundation-spec") {
1691
1705
  foundationSpec = input.spec;
1706
+ } else if (input.kind === "decision-spec") {
1692
1707
  } else if (input.kind === "spec") {
1693
1708
  request = input.request;
1694
1709
  } else {
@@ -1731,8 +1746,8 @@ async function main(argv) {
1731
1746
  throw new Error(`--profile must be spark, got: ${profile}`);
1732
1747
  }
1733
1748
  const engine = readOption(argv, "--engine") ?? "adapter";
1734
- if (engine !== "adapter" && engine !== "foundation") {
1735
- throw new Error(`--engine must be adapter or foundation, got: ${engine}`);
1749
+ if (engine !== "adapter" && engine !== "foundation" && engine !== "decision") {
1750
+ throw new Error(`--engine must be adapter, foundation or decision, got: ${engine}`);
1736
1751
  }
1737
1752
  if (engine === "foundation" && readOption(argv, "--model")) {
1738
1753
  throw new Error("Foundation specs do not take --model; they train a tokenizer and GPT from scratch.");
@@ -1740,9 +1755,9 @@ async function main(argv) {
1740
1755
  if (readOption(argv, "--config")) throw new Error("tt init uses one tunedtensor.json; put overrides in runtime/evaluation instead of --config.");
1741
1756
  const spec = await initLocalSpecFile({
1742
1757
  outputPath,
1743
- name: readOption(argv, "--name") ?? (engine === "foundation" ? "Foundation chat model" : "Local Tuned Tensor Spec"),
1758
+ name: readOption(argv, "--name") ?? (engine === "foundation" ? "Foundation chat model" : engine === "decision" ? "Local decision model" : "Local Tuned Tensor Spec"),
1744
1759
  engine,
1745
- baseModel: engine === "foundation" ? void 0 : readOption(argv, "--model") ?? "Qwen/Qwen3.5-2B",
1760
+ baseModel: engine === "foundation" ? void 0 : readOption(argv, "--model") ?? (engine === "decision" ? void 0 : "Qwen/Qwen3.5-2B"),
1746
1761
  force: hasFlag(argv, "--force")
1747
1762
  });
1748
1763
  const configPath = void 0;
@@ -1770,6 +1785,20 @@ async function main(argv) {
1770
1785
  });
1771
1786
  return;
1772
1787
  }
1788
+ if (loaded.kind === "decision-spec") {
1789
+ const validation = validateBehaviorSpec(loaded);
1790
+ if (!validation.valid) throw new Error(`Invalid decision spec:
1791
+ ${validation.errors.join("\n")}`);
1792
+ printJson({
1793
+ ok: true,
1794
+ input_path: loaded.path,
1795
+ engine: "decision",
1796
+ base_model: loaded.spec.base_model,
1797
+ warnings: validation.warnings,
1798
+ pipeline: "tt pipeline run --spec"
1799
+ });
1800
+ return;
1801
+ }
1773
1802
  if (loaded.kind !== "spec") {
1774
1803
  throw new Error(`TT expects a tunedtensor.json behavior spec, not a full run request: ${loaded.path}`);
1775
1804
  }
@@ -2013,6 +2042,10 @@ export {
2013
2042
  createLocalStore,
2014
2043
  datasetFormatSchema,
2015
2044
  datasetPrebuiltSchema,
2045
+ decisionHyperparametersSchema,
2046
+ decisionLabels,
2047
+ decisionPlaceholderIssues,
2048
+ decisionQuestionSchema,
2016
2049
  defaultLocalHome,
2017
2050
  evalExampleResultSchema,
2018
2051
  evalReportSchema,
@@ -2034,6 +2067,7 @@ export {
2034
2067
  hardenExistingLocalStore,
2035
2068
  initLocalRunnerConfigFile,
2036
2069
  initLocalSpecFile,
2070
+ isDecisionSpecFile,
2037
2071
  isFoundationSpecFile,
2038
2072
  isTerminalRunState,
2039
2073
  jsonFieldMetricsSchema,
@@ -2043,6 +2077,7 @@ export {
2043
2077
  loadRunRequest,
2044
2078
  localAdapterSpecFileSchema,
2045
2079
  localBehaviorSpecFileSchema,
2080
+ localDecisionSpecFileSchema,
2046
2081
  localFoundationSpecFileSchema,
2047
2082
  localPathsOverlap,
2048
2083
  localRunnerConfigSchema,