@contentgrowth/llm-service 1.3.2 → 1.3.3
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/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -961,13 +961,21 @@ ${msg.content}`;
|
|
|
961
961
|
const tool = toolImplementations[toolName];
|
|
962
962
|
const tool_call_id = `gemini-tool-call-${index}`;
|
|
963
963
|
toolCall.id = tool_call_id;
|
|
964
|
-
|
|
964
|
+
let toolArgs = toolCall.function.args;
|
|
965
|
+
if (toolArgs === void 0 && toolCall.function.arguments) {
|
|
966
|
+
try {
|
|
967
|
+
toolArgs = typeof toolCall.function.arguments === "string" ? JSON.parse(toolCall.function.arguments) : toolCall.function.arguments;
|
|
968
|
+
} catch (e) {
|
|
969
|
+
toolArgs = {};
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
console.log(`[Tool Call] > ${toolName}:`, JSON.stringify(toolArgs));
|
|
965
973
|
if (!tool) {
|
|
966
974
|
console.error(`[Tool Error] Tool '${toolName}' not found`);
|
|
967
975
|
return { tool_call_id, output: JSON.stringify({ error: `Tool '${toolName}' not found.` }) };
|
|
968
976
|
}
|
|
969
977
|
try {
|
|
970
|
-
const output = await tool(
|
|
978
|
+
const output = await tool(toolArgs, { env, tenantId });
|
|
971
979
|
const preview = typeof output === "string" ? output.length > 200 ? output.substring(0, 200) + "..." : output : JSON.stringify(output).substring(0, 200) + "...";
|
|
972
980
|
console.log(`[Tool Result] < ${toolName}: ${preview}`);
|
|
973
981
|
return { tool_call_id, output };
|