Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: googleSearchRetrieval(true) causes INVALID_ARGUMENT error with Gemini 2.0 (use google_search instead) #2185

Open
drelum opened this issue Feb 6, 2025 · 2 comments

Comments

@drelum
Copy link

drelum commented Feb 6, 2025

When using the VertexAiGeminiChatOptions class with the googleSearchRetrieval(true) option, the API call fails with the following error:

Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: 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

It seems that the Gemini 2.0 models have changed the way they handle tool calls for search retrieval, requiring google_search instead of google_search_retrieval.

Environment:
Spring AI version: 1.0.0-SNAPSHOT
Java version: Openjdk 23

Steps to reproduce:
Use VertexAiGeminiChatOptions with googleSearchRetrieval(true).
Attempt to make a request to the Gemini API.
The request fails with the INVALID_ARGUMENT error.

Expected behavior
The request should successfully execute the search retrieval using the correct parameter expected by Gemini 2.0.

Minimal Complete Reproducible example:
ChatOptions chatOptions = VertexAiGeminiChatOptions.builder()
.temperature(0.4)
.googleSearchRetrieval(true)
.build();

@mmmark0
Copy link

mmmark0 commented Feb 8, 2025

Same issue here. googleSearchRetrieval(true) no longer works with Gemini 2.0, making it impossible to use Google Search. Any updates on a fix?

@icaroleon
Copy link

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants