Environment details
- Specify the API at the beginning of the title. For example, "[vision]: ...").
General, Core, and Other are also allowed as types
- OS type and version: macOS 14.5
- Java version: 21
- Version(s): 1.19.0
Steps to reproduce
- Pass
gemini-2.0-flash-001 as the value to GenerativeModel#setModelName
- Add a
Tool using GoogleSearchRetrieval
- Submit a
generateContent request
Code example
import com.google.cloud.vertexai.VertexAI;
import com.google.cloud.vertexai.generativeai.GenerativeModel;
import com.google.cloud.vertexai.api.GenerateContentResponse;
import com.google.cloud.vertexai.api.GoogleSearchRetrieval
import com.google.cloud.vertexai.api.Tool
try (VertexAI vertexAi = new VertexAI(PROJECT_ID, LOCATION)) {
Tool tool = Tool.newBuilder.setGoogleSearchRetrieval(GoogleSearchRetrieval.newBuilder()).build();
GenerativeModel model = new GenerativeModel.Builder()
.setModelName("gemini-2.0-flash-001")
.setVertexAi(vertexAi)
.setTools(Arrays.asList(tool));
GenerateContentResponse response = model.generateContent("test");
}
Stack trace
The error response I get is
{
"error": {
"code": 400,
"message": "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",
"errors": [
{
"message": "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",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Any additional information below
It looks like the google-cloud-aiplatform project has been updated to support google_search in addition to google_search_retrieval -- could the google-cloud-vertexai project do the same?
Environment details
General, Core, and Other are also allowed as types
Steps to reproduce
gemini-2.0-flash-001as the value toGenerativeModel#setModelNameToolusingGoogleSearchRetrievalgenerateContentrequestCode example
Stack trace
The error response I get is
{ "error": { "code": 400, "message": "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", "errors": [ { "message": "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", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } }Any additional information below
It looks like the
google-cloud-aiplatformproject has been updated to supportgoogle_searchin addition togoogle_search_retrieval-- could thegoogle-cloud-vertexaiproject do the same?