utilitas 1998.2.28 → 1998.2.30
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/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +4 -4
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -60,8 +60,8 @@ const [tool, provider, messages, text] = [
|
|
|
60
60
|
messages => ({ messages }), text => ({ text }),
|
|
61
61
|
];
|
|
62
62
|
|
|
63
|
-
const [name, user, system, assistant, MODEL, JSON_OBJECT]
|
|
64
|
-
= ['Alan', 'user', 'system', 'assistant', 'model', 'json_object'];
|
|
63
|
+
const [name, user, system, assistant, MODEL, JSON_OBJECT, TOOL]
|
|
64
|
+
= ['Alan', 'user', 'system', 'assistant', 'model', 'json_object', 'tool'];
|
|
65
65
|
const [CODE_INTERPRETER, RETRIEVAL, FUNCTION]
|
|
66
66
|
= ['code_interpreter', 'retrieval', 'function'].map(tool);
|
|
67
67
|
const [NOT_INIT, INVALID_FILE]
|
|
@@ -722,7 +722,7 @@ const handleToolsCall = async (msg, options) => {
|
|
|
722
722
|
case CHATGPT: default:
|
|
723
723
|
input = parseJson(fn?.function?.arguments);
|
|
724
724
|
packMsg = (t, e) => ({
|
|
725
|
-
role:
|
|
725
|
+
role: TOOL, tool_call_id: fn.id, [e ? 'error' : 'content']: t
|
|
726
726
|
});
|
|
727
727
|
break;
|
|
728
728
|
}
|
|
@@ -735,7 +735,7 @@ const handleToolsCall = async (msg, options) => {
|
|
|
735
735
|
continue;
|
|
736
736
|
}
|
|
737
737
|
try {
|
|
738
|
-
content.push(packMsg(await func(input)));
|
|
738
|
+
content.push(packMsg((await func(input)) ?? 'OK'));
|
|
739
739
|
} catch (err) {
|
|
740
740
|
content.push(packMsg(`Function call failed: ${err.message}`, true));
|
|
741
741
|
}
|
package/lib/manifest.mjs
CHANGED