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.

final @NonNull List<@NonNull InlineDataPart>

Convenience field representing all the InlineDataParts in the first candidate.

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.

final String

Convenience field representing all the text parts in the response that are marked as thoughts as a single string, if they exist.

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.

The value is an empty list if the response contains no candidates.

Any part that's marked as a thought will be ignored. Learn more about thinking.

inlineDataParts

public final @NonNull List<@NonNull InlineDataPartinlineDataParts

Convenience field representing all the InlineDataParts in the first candidate.

This also includes any ImagePart, but they will be represented as InlineDataPart instead.

The value is an empty list if the response contains no candidates.

Any part that's marked as a thought will be ignored. Learn more about thinking.

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.

The value is null if the response contains no valid text candidates.

Any part that's marked as a thought will be ignored. Learn more about thinking.

thoughtSummary

public final String thoughtSummary

Convenience field representing all the text parts in the response that are marked as thoughts as a single string, if they exist.

Learn more about thinking.

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
)