flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [firebase_vertexai] Support google search retrieval grounding tool

Open MaggieThomann opened this issue 1 year ago • 2 comments

Support google search retrieval grounding tool

Google released grounding with Google Search for the Gemini API. I'd like to be able to simply specify google_search_retrieval as the tool name when creating my GenerativeModel in order to be able to use it. Similar to how it's done in the API docs here:

model = genai.GenerativeModel('models/gemini-1.5-pro-002')
response = model.generate_content(contents="Who won Wimbledon this year?",
                                  tools='google_search_retrieval')
print(response)

Right now, if I try to set it up, I need to do something like this:

final googleSearchGrounding = FunctionDeclaration(
        'google_search_retrieval'
      );

And pass it like this:

model = vertexAI.generativeModel(
        tools: [Tool.functionDeclarations([googleSearchGrounding])],

But that's not working because FunctionDeclaration also expects parameters. I'd like to avoid having to declare a function declaration for it and just be able to pass the name google_search_retrieval directly somehow.

MaggieThomann avatar Dec 06 '24 12:12 MaggieThomann

Hi! I commented this post that I'm sharing here because I guess the problem is related

https://github.com/google-gemini/generative-ai-dart/issues/222#issuecomment-2691065859

Anyway, I successfully performed a Google grounded request to Gemini 2.0 through Flutter with a little hardcoding as I mentioned in the linked post.

Hirokami avatar Feb 28 '25 16:02 Hirokami

I would also love this feature! 👍

MaggieThomann avatar Mar 31 '25 09:03 MaggieThomann