Skip to content

Commit 0eae311

Browse files
Fix gemini when tools are null
1 parent 452e0b7 commit 0eae311

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/backend/src/modules/puterai/lib/FunctionCalling.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,17 @@ module.exports = class FunctionCalling {
121121
}
122122

123123
static make_gemini_tools (tools) {
124-
return [
125-
{
126-
function_declarations: tools.map(t => {
127-
const tool = t.function;
128-
delete tool.parameters.additionalProperties;
129-
return tool;
130-
})
131-
}
132-
];
124+
if (Array.isArray(tools)) {
125+
return [
126+
{
127+
function_declarations: tools.map(t => {
128+
const tool = t.function;
129+
delete tool.parameters.additionalProperties;
130+
return tool;
131+
})
132+
}
133+
];
134+
};
135+
133136
}
134137
}

0 commit comments

Comments
 (0)