tune-sdk 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.
Files changed (2) hide show
  1. package/bin/cli.js +11 -21
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -20,26 +20,6 @@ process.argv.slice(2).forEach(arg => {
20
20
  }
21
21
  });
22
22
 
23
- // Example usage outputs (replace with your real logic)
24
- /*
25
- if (args.filename) {
26
- console.log('filename:', args.filename);
27
- }
28
- if (args.system) {
29
- console.log('system:', args.system);
30
- }
31
- if (args.user) {
32
- console.log('user:', args.user);
33
- }
34
- if ('save' in args) {
35
- console.log('save flag set');
36
- }
37
- if (args.stop) {
38
- console.log('stop:', args.stop);
39
- }
40
- */
41
-
42
- // Place your main script/logic here
43
23
  const tune = require('../dist/tune.js');
44
24
  const { fsctx } = require('../dist/fsctx.js');
45
25
  const fs = require("fs");
@@ -105,9 +85,19 @@ async function main() {
105
85
  throw(Error(`err: Context file export is not an array of functions or function ${filename}`))
106
86
  }
107
87
  }
88
+ let stopVal = args.stop || "assistant";
89
+ if (stopVal !== "step" && stopVal != "assistant") {
90
+ stopVal = function(msgs) {
91
+ if (!msgs.length) return false
92
+ const lastMsg = msgs[msgs.length - 1]
93
+ if (!lastMsg.content) return false
94
+ return (lastMsg.content.indexOf(args.stop) !== -1)
95
+ }
96
+ }
97
+
98
+ let res = await tune.text2run(chat, ctx, { stop: stopVal })
108
99
 
109
100
  const longFormatRegex = /^(system|user|tool_call|tool_result|assistant|error):/;
110
- let res = await tune.text2run(chat, ctx, args.step || "assistant")
111
101
  res = tune.msg2text(res, longFormatRegex.test(chat))
112
102
  if (args.filename && args.save) {
113
103
  chat += "\n" + res
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tune-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "tune - your everyday LLM toolkit.",
5
5
  "main": "dist/tune.js",
6
6
  "module": "dist/tune.mjs",