tune-sdk 0.2.16 → 0.2.17
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/dist/tune.js +8 -10
- package/package.json +1 -1
package/dist/tune.js
CHANGED
|
@@ -1635,9 +1635,9 @@ async function text2ast(text, ctx, resolve) {
|
|
|
1635
1635
|
});
|
|
1636
1636
|
if ((resolved.type === "text" || resolved.type === "image" || resolved.type === "audio")) resolved.value = await resolved.read();
|
|
1637
1637
|
if ((resolved.type === "tool")) {
|
|
1638
|
+
if (!resolved.schema) throw new TuneError(("schema has to be set" + " for '" + resolved.name + "'"), filename, row, col);
|
|
1638
1639
|
var schema;
|
|
1639
1640
|
schema = Object.assign({}, resolved.schema);
|
|
1640
|
-
if (!schema) throw new TuneError(("schema has to be set" + " for '" + resolved.name + "'"), filename, row, col);
|
|
1641
1641
|
schema.name = resolved.name;
|
|
1642
1642
|
if (!schema.description) throw new TuneError(("no description set" + " for '" + resolved.name + "'"), filename, row, col);
|
|
1643
1643
|
if (!schema.parameters) throw new TuneError(("no parameters set" + " for '" + resolved.name + "'"), filename, row, col);
|
|
@@ -2190,9 +2190,7 @@ function text2run(text, ctx, opts) {
|
|
|
2190
2190
|
msg.tool_calls = msg.tool_calls || [];
|
|
2191
2191
|
tc = delta.tool_calls[0];
|
|
2192
2192
|
tcIdx = tc.index || 0;
|
|
2193
|
-
msg.tool_calls[tcIdx] = msg.tool_calls[tcIdx] ||
|
|
2194
|
-
msg.tool_calls[tcIdx].function.arguments = msg.tool_calls[tcIdx].function.arguments || "";
|
|
2195
|
-
msg.tool_calls[tcIdx].function.arguments += (tc.function.arguments || "");
|
|
2193
|
+
!msg.tool_calls[tcIdx] ? msg.tool_calls[tcIdx] = tc : msg.tool_calls[tcIdx].function.arguments += (tc.function.arguments || "");
|
|
2196
2194
|
}
|
|
2197
2195
|
return msg;
|
|
2198
2196
|
}), {
|
|
@@ -2233,7 +2231,7 @@ function text2run(text, ctx, opts) {
|
|
|
2233
2231
|
}
|
|
2234
2232
|
text2run;
|
|
2235
2233
|
async function file2run(args, params, ctx) {
|
|
2236
|
-
var lctx, text, stop, node, response, res, r, chunk,
|
|
2234
|
+
var lctx, text, stop, node, response, res, r, chunk, itergkjZius, _ref;
|
|
2237
2235
|
var lctx;
|
|
2238
2236
|
lctx = ctx.clone();
|
|
2239
2237
|
if (params) lctx.ms.unshift(envmd(params));
|
|
@@ -2300,7 +2298,7 @@ async function file2run(args, params, ctx) {
|
|
|
2300
2298
|
stream: true
|
|
2301
2299
|
});
|
|
2302
2300
|
chunk = {};
|
|
2303
|
-
|
|
2301
|
+
itergkjZius = new AsyncIter();
|
|
2304
2302
|
(async function($lastRes) {
|
|
2305
2303
|
var _ref;
|
|
2306
2304
|
try {
|
|
@@ -2309,20 +2307,20 @@ async function file2run(args, params, ctx) {
|
|
|
2309
2307
|
res = (chunk.value || "");
|
|
2310
2308
|
if (chunk.done) await save();
|
|
2311
2309
|
$lastRes = transformOutput(res) || $lastRes;
|
|
2312
|
-
|
|
2310
|
+
itergkjZius.result = {
|
|
2313
2311
|
value: $lastRes
|
|
2314
2312
|
}
|
|
2315
2313
|
}
|
|
2316
|
-
_ref =
|
|
2314
|
+
_ref = itergkjZius.result = {
|
|
2317
2315
|
value: $lastRes,
|
|
2318
2316
|
done: true
|
|
2319
2317
|
}
|
|
2320
2318
|
} catch (e) {
|
|
2321
|
-
_ref = (
|
|
2319
|
+
_ref = (itergkjZius.err = e);
|
|
2322
2320
|
}
|
|
2323
2321
|
return _ref;
|
|
2324
2322
|
})();
|
|
2325
|
-
_ref =
|
|
2323
|
+
_ref = itergkjZius;
|
|
2326
2324
|
}
|
|
2327
2325
|
return _ref;
|
|
2328
2326
|
}
|