Skip to content

gemini-2.0 does not recognize google_search_retrieval tool #667

Closed
@Kvit

Description

@Kvit

Description of the bug:

While switching model from gemini-1.5-pro to gemini-2.0-flash-exp google_search_retrieval tool is no longer recognized

Actual vs expected behavior:

Using "gemini-2.0-flash-exp"

model = genai.GenerativeModel(
    model_name="gemini-2.0-flash-exp",
    tools='google_search_retrieval')

response = model.generate_content("Search latest news")
print(response.text)

InvalidArgument: 400 Unable to submit request because Please use google_search field instead of google_search_retrieval field.. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini

Expected:
Here's a summary of the latest news as of February 1, 2025...

Any other information you'd like to share?

Package Version

Name: google-generativeai
Version: 0.8.4
Summary: Google Generative AI High level API client library and tools.
Home-page: https://github.com/google/generative-ai-python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions