GenerateContentResponse

public final class GenerateContentResponse


A response from the model.

Summary

Public fields

final @NonNull List<@NonNull Candidate>

The list of Candidate responses generated by the model.

final @NonNull List<@NonNull FunctionCallPart>

Convenience field to list all the FunctionCallParts in the response, if they exist.

final PromptFeedback

Feedback about the prompt send to the model to generate this response.

final String

Convenience field representing all the text parts in the response as a single string, if they exists.

final UsageMetadata

Information about the number of tokens in the prompt and in the response.

Public constructors

GenerateContentResponse(
    @NonNull List<@NonNull Candidate> candidates,
    PromptFeedback promptFeedback,
    UsageMetadata usageMetadata
)

Public fields

candidates

public final @NonNull List<@NonNull Candidatecandidates

The list of Candidate responses generated by the model.

functionCalls

public final @NonNull List<@NonNull FunctionCallPartfunctionCalls

Convenience field to list all the FunctionCallParts in the response, if they exist.

promptFeedback

public final PromptFeedback promptFeedback

Feedback about the prompt send to the model to generate this response. When streaming, it's only populated in the first response.

text

public final String text

Convenience field representing all the text parts in the response as a single string, if they exists.

usageMetadata

public final UsageMetadata usageMetadata

Information about the number of tokens in the prompt and in the response.

Public constructors

GenerateContentResponse

public GenerateContentResponse(
    @NonNull List<@NonNull Candidate> candidates,
    PromptFeedback promptFeedback,
    UsageMetadata usageMetadata
)