Skip to content

Commit

Permalink
Joint String output variable declaration and use in Vertex AI TextInp…
Browse files Browse the repository at this point in the history
…ut.java Snippet (#9331)
  • Loading branch information
vorburger committed May 23, 2024
1 parent 2b43cb4 commit aa6d755
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ public static String textInput(
// Initialize client that will be used to send requests. This client only needs
// to be created once, and can be reused for multiple requests.
try (VertexAI vertexAI = new VertexAI(projectId, location)) {
String output;
GenerativeModel model = new GenerativeModel(modelName, vertexAI);

GenerateContentResponse response = model.generateContent(textPrompt);
output = ResponseHandler.getText(response);
String output = ResponseHandler.getText(response);
return output;
}
}
Expand Down

0 comments on commit aa6d755

Please sign in to comment.