Comparing version 2.1.20 to 2.1.21
@@ -181,6 +181,8 @@ "use strict"; | ||
const trimStartOfStream = trimStartOfStreamHelper(); | ||
let isFunctionStreamingIn; | ||
return (data) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; | ||
const json = JSON.parse(data); | ||
if ((_c = (_b = (_a = json.choices[0]) == null ? void 0 : _a.delta) == null ? void 0 : _b.function_call) == null ? void 0 : _c.name) { | ||
isFunctionStreamingIn = true; | ||
return `{"function_call": {"name": "${(_e = (_d = json.choices[0]) == null ? void 0 : _d.delta) == null ? void 0 : _e.function_call.name}", "arguments": "`; | ||
@@ -191,7 +193,8 @@ } else if ((_h = (_g = (_f = json.choices[0]) == null ? void 0 : _f.delta) == null ? void 0 : _g.function_call) == null ? void 0 : _h.arguments) { | ||
return `${escapedPartialJson}`; | ||
} else if (((_i = json.choices[0]) == null ? void 0 : _i.finish_reason) === "function_call") { | ||
} else if ((((_i = json.choices[0]) == null ? void 0 : _i.finish_reason) === "function_call" || ((_j = json.choices[0]) == null ? void 0 : _j.finish_reason) === "stop") && isFunctionStreamingIn) { | ||
isFunctionStreamingIn = false; | ||
return '"}}'; | ||
} | ||
const text = trimStartOfStream( | ||
(_n = (_m = (_k = (_j = json.choices[0]) == null ? void 0 : _j.delta) == null ? void 0 : _k.content) != null ? _m : (_l = json.choices[0]) == null ? void 0 : _l.text) != null ? _n : "" | ||
(_o = (_n = (_l = (_k = json.choices[0]) == null ? void 0 : _k.delta) == null ? void 0 : _l.content) != null ? _n : (_m = json.choices[0]) == null ? void 0 : _m.text) != null ? _o : "" | ||
); | ||
@@ -198,0 +201,0 @@ return text; |
@@ -181,6 +181,8 @@ "use strict"; | ||
const trimStartOfStream = trimStartOfStreamHelper(); | ||
let isFunctionStreamingIn; | ||
return (data) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; | ||
const json = JSON.parse(data); | ||
if ((_c = (_b = (_a = json.choices[0]) == null ? void 0 : _a.delta) == null ? void 0 : _b.function_call) == null ? void 0 : _c.name) { | ||
isFunctionStreamingIn = true; | ||
return `{"function_call": {"name": "${(_e = (_d = json.choices[0]) == null ? void 0 : _d.delta) == null ? void 0 : _e.function_call.name}", "arguments": "`; | ||
@@ -191,7 +193,8 @@ } else if ((_h = (_g = (_f = json.choices[0]) == null ? void 0 : _f.delta) == null ? void 0 : _g.function_call) == null ? void 0 : _h.arguments) { | ||
return `${escapedPartialJson}`; | ||
} else if (((_i = json.choices[0]) == null ? void 0 : _i.finish_reason) === "function_call") { | ||
} else if ((((_i = json.choices[0]) == null ? void 0 : _i.finish_reason) === "function_call" || ((_j = json.choices[0]) == null ? void 0 : _j.finish_reason) === "stop") && isFunctionStreamingIn) { | ||
isFunctionStreamingIn = false; | ||
return '"}}'; | ||
} | ||
const text = trimStartOfStream( | ||
(_n = (_m = (_k = (_j = json.choices[0]) == null ? void 0 : _j.delta) == null ? void 0 : _k.content) != null ? _m : (_l = json.choices[0]) == null ? void 0 : _l.text) != null ? _n : "" | ||
(_o = (_n = (_l = (_k = json.choices[0]) == null ? void 0 : _k.delta) == null ? void 0 : _l.content) != null ? _n : (_m = json.choices[0]) == null ? void 0 : _m.text) != null ? _o : "" | ||
); | ||
@@ -198,0 +201,0 @@ return text; |
{ | ||
"name": "ai", | ||
"version": "2.1.20", | ||
"version": "2.1.21", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201582
6078