Class ResponseHandler (0.8.0)

publicclass ResponseHandler

Helper class to post-process GenerateContentResponse.

Inheritance

java.lang.Object > ResponseHandler

Static Methods

getContent(GenerateContentResponse response)

publicstaticContentgetContent(GenerateContentResponseresponse)

Gets the content in a GenerateContentResponse.

Parameter
Name Description
response GenerateContentResponse

a com.google.cloud.vertexai.api.GenerateContentResponse instance

Returns
Type Description
Content

the com.google.cloud.vertexai.api.Content in the response

getFinishReason(GenerateContentResponse response)

publicstaticCandidate.FinishReasongetFinishReason(GenerateContentResponseresponse)

Gets the finish reason in a GenerateContentResponse.

Parameter
Name Description
response GenerateContentResponse

a com.google.cloud.vertexai.api.GenerateContentResponse instance

Returns
Type Description
Candidate.FinishReason

the com.google.cloud.vertexai.api.FinishReason in the response

getFunctionCalls(GenerateContentResponse response)

publicstaticImmutableList<FunctionCall>getFunctionCalls(GenerateContentResponseresponse)

Gets the list of function calls in a GenerateContentResponse.

Parameter
Name Description
response GenerateContentResponse

a com.google.cloud.vertexai.api.GenerateContentResponse instance

Returns
Type Description
com.google.common.collect.ImmutableList<FunctionCall>

a list of com.google.cloud.vertexai.api.FunctionCall in the response

getText(GenerateContentResponse response)

publicstaticStringgetText(GenerateContentResponseresponse)

Gets the text message in a GenerateContentResponse.

Parameter
Name Description
response GenerateContentResponse

a com.google.cloud.vertexai.api.GenerateContentResponse instance

Returns
Type Description
String

a String that aggregates all the text parts in the response

Constructors

ResponseHandler()

publicResponseHandler()

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.