Class ResponseHandler (0.6.0)

public class ResponseHandler

Helper class to post-process GenerateContentResponse.

Inheritance

java.lang.Object > ResponseHandler

Static Methods

getContent(GenerateContentResponse response)

public static Content getContent(GenerateContentResponse response)

Get 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)

public static Candidate.FinishReason getFinishReason(GenerateContentResponse response)

Get 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

getText(GenerateContentResponse response)

public static String getText(GenerateContentResponse response)

Get 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()

public ResponseHandler()