I have set up a GCP with Vertex AI and enabled all the Api:s, but I can’t get the model to respond in my Java application. Every call I make to gemini ends with a response error 500.
The weird thing is that it is working from a Python environment.
This is working:
import vertexai
from vertexai.generative_models import GenerativeModel
model = GenerativeModel(model_name="gemini-1.0-pro")
vertexai.init(project="PROJECT_ID", location="LOCATION")
responses = model.generate_content("Hello, can you hear me?", stream=True)
for response in responses:
print(response.text)
This is not working:
VertexAI vertexAi = new VertexAI("PROJECT_ID", "LOCATION");
try {
GenerativeModel model = new GenerativeModel("gemini-1.0-pro", vertexAi);
var response = model.generateContent("Hello, can you hear me?");
System.out.println(response);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
Anyone knows what could be the problem?
