codeExecution and function calling

Can I do both codeExecution and function calling at the same time?

This fails, but works when I do one at a time…

const generativeModel = genAI.getGenerativeModel({
// Use a model that supports function calling, like a Gemini 1.5 model
model: “gemini-1.5-flash”,

    // Specify the function declaration.
    tools: {
        functionDeclarations: [getCompaniesFunctionDeclaration],
        codeExecution: {},
    },
});

Hi @John_Kotowski , Welcome to the forum.

You are right. Either codeExecution, functionDeclarations, or googleSearchRetrieval needs to be passed one at a time, otherwise, you will get an INVALID_ARGUMENT error. The same applies in AI Studio as well, you can enable only one tool at a time.

Note: Multi-tool usage is only enabled through the live API at the moment.

Thanks.