in src/requests/response-helpers.ts [152:168]
export function getFunctionCalls(
response: GenerateContentResponse,
): FunctionCall[] {
const functionCalls: FunctionCall[] = [];
if (response.candidates?.[0].content?.parts) {
for (const part of response.candidates?.[0].content?.parts) {
if (part.functionCall) {
functionCalls.push(part.functionCall);
}
}
}
if (functionCalls.length > 0) {
return functionCalls;
} else {
return undefined;
}
}