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?
Hi @motorro,
Welcome to Google Cloud Community!
The error “400 Request contains an invalid argument” is usually related to passing a supported and valid model ID. I checked your GitHub repro and I noticed that you’re using a valid model ID which is gemini-1.5-flash-001.
To isolate if the issue is related to your Data store configuration, please try creating an app in the Agent Builder and attach your Data store to it. Make sure to enable Enterprise Edition in your app to use it for Grounding. You may also check this similar post which might help.
I hope the above information is useful.