Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google grounding and function calling: error 400

Hello!

I'm trying grounding to google search but it seems like grounding doesn't work with function calling. If I have either of them defined in tools - model works. If I add both - I get 400 for any request:

 

ClientError: [VertexAI.ClientError]: got status: 400 Bad Request. {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}

 

The source code:

 

const generativeModel = vertex_ai.preview.getGenerativeModel({
    model: model,
    generationConfig: {
        maxOutputTokens: 8192,
        topP: 0.95,
        temperature: 0.0
    },
    tools: [
        {
            googleSearchRetrieval: {

            }
        },
        {
            functionDeclarations: [
                {
                    name: "someFun",
                    description: "Sample function",
                    parameters: {
                        type: FunctionDeclarationSchemaType.OBJECT,
                        properties: {
                            value: {
                                type: FunctionDeclarationSchemaType.STRING,
                                description: "Sample parameter"
                            }
                        },
                        required: ["value"]
                    }
                }
            ]
        }
    ],
});

 

 Here is the sample project if you want to try:

https://github.com/motorro/GeminiGroundingTools

Is it expected?

0 1 2,359