Vertex AI plugin

Has anybody been able to get grounding with google search working with genkit?

I am following this: https://genkit.dev/docs/plugins/vertex-ai/#usage, which states that "[the vertexai] plugin also supports grounding Gemini text responses using Google Search or your own data." and gives this example:
const ai = genkit({
  plugins: [vertexAI({ location: 'us-central1' })],
});

await ai.generate({
  model: vertexAI.model('gemini-2.0-flash'),
  prompt: '...',
  config: {
    googleSearchRetrieval: {
      disableAttribution: true,
    }
...
  }
})


I have:

import { gemini } from '@genkit-ai/vertexai';
...
export const GEMINI_MODEL_FOR_CHAT = gemini('gemini-2.5-flash-preview-05-20', { location: 'us-central1' });

…

...

    const generateOptions: GenerateOptions = {
          model: GEMINI_MODEL_FOR_CHAT,
          messages: messagesForGeneration,
          config: {
            ...SYSTEM_PROMPT_CONFIG_FOR_CHAT,
            googleSearchRetrieval: {
              disableAttribution: false,
            },
          },
          tools: [
          [tools redacted]
          ],
        };

generateOptions is then used in ai.generateStream(generateOptions);

This is a bit different, but I'm using the VertexAi plugin with a supported model in a supported region and I have

googleSearchRetrieval: {
  disableAttribution: false,
},

to the config.

But:
GoogleApiError: Unable to submit request because google_search_retrieval is not supported; please use google_search field instead. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini


I tried changing the googleSearchRetrieval key to googleSearch and then google_search, but both yield "GoogleApiError: Invalid JSON payload received. Unknown name "googleSearch" at 'generation_config': Cannot find field.
" errors. Any idea what I might be doing wrong?
Was this page helpful?