utilitas 1998.2.25 → 1998.2.26
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 +9 -7
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -697,9 +697,9 @@ const handleToolsCall = async (msg, options) => {
|
|
|
697
697
|
let content = [], preRes = [], input, packMsg;
|
|
698
698
|
if (msg?.tool_calls?.length) {
|
|
699
699
|
switch (options?.flavor) {
|
|
700
|
-
case CLAUDE: preRes.push({ role:
|
|
701
|
-
case GEMINI: preRes.push({ role:
|
|
702
|
-
case CHATGPT: default: preRes.push({ role:
|
|
700
|
+
case CLAUDE: preRes.push({ role: assistant, content: msg?.tool_calls }); break;
|
|
701
|
+
case GEMINI: preRes.push({ role: MODEL, parts: msg?.tool_calls.map(x => ({ functionCall: x })) }); break;
|
|
702
|
+
case CHATGPT: default: preRes.push({ role: assistant, ...msg }); break;
|
|
703
703
|
}
|
|
704
704
|
for (const fn of msg.tool_calls) {
|
|
705
705
|
switch (options?.flavor) {
|
|
@@ -725,6 +725,7 @@ const handleToolsCall = async (msg, options) => {
|
|
|
725
725
|
packMsg = (t, e) => ({
|
|
726
726
|
role: 'tool', tool_call_id: fn.id, [e ? 'error' : 'content']: t
|
|
727
727
|
});
|
|
728
|
+
break;
|
|
728
729
|
}
|
|
729
730
|
const name = fn?.function?.name || fn?.name;
|
|
730
731
|
const func = tools.find(x => insensitiveCompare(
|
|
@@ -741,8 +742,8 @@ const handleToolsCall = async (msg, options) => {
|
|
|
741
742
|
}
|
|
742
743
|
}
|
|
743
744
|
switch (options?.flavor) {
|
|
744
|
-
case CLAUDE: content = [{ role:
|
|
745
|
-
case GEMINI: content = [{ role:
|
|
745
|
+
case CLAUDE: content = [{ role: user, content }]; break;
|
|
746
|
+
case GEMINI: content = [{ role: user, parts: content }]; break;
|
|
746
747
|
}
|
|
747
748
|
}
|
|
748
749
|
return [...preRes, ...content];
|
|
@@ -1021,14 +1022,15 @@ const promptGemini = async (content, options) => {
|
|
|
1021
1022
|
history: [
|
|
1022
1023
|
...options?.messages && !options?.attachments?.length ? options.messages : [],
|
|
1023
1024
|
...options?.toolsResult ? [
|
|
1024
|
-
{ role:
|
|
1025
|
+
{ role: user, parts: buildGeminiMessage(content, options) },
|
|
1025
1026
|
options?.toolsResult[0]
|
|
1026
1027
|
] : [],
|
|
1027
1028
|
],
|
|
1028
1029
|
...generationConfig(options),
|
|
1029
1030
|
});
|
|
1030
1031
|
const resp = chat[options?.stream ? 'sendMessageStream' : 'sendMessage'](
|
|
1031
|
-
options?.toolsResult ?
|
|
1032
|
+
options?.toolsResult ?
|
|
1033
|
+
options?.toolsResult[1].parts : buildGeminiMessage(content, options)
|
|
1032
1034
|
);
|
|
1033
1035
|
return await handleGeminiResponse(
|
|
1034
1036
|
resp, { ...options || {}, content, model: genModel }
|
package/lib/manifest.mjs
CHANGED