GenerateContentResponse

class GenerateContentResponse


A response from the model.

Summary

Public constructors

GenerateContentResponse(
    candidates: List<Candidate>,
    promptFeedback: PromptFeedback?,
    usageMetadata: UsageMetadata?
)

Public properties

List<Candidate>

The list of Candidate responses generated by the model.

List<FunctionCallPart>

Convenience field to list all the FunctionCallParts in the response.

List<InlineDataPart>

Convenience field representing all the InlineDataParts in the first candidate.

PromptFeedback?

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

String?

Convenience field representing all the text parts in the response as a single string.

String?

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

UsageMetadata?

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

Public constructors

GenerateContentResponse

GenerateContentResponse(
    candidates: List<Candidate>,
    promptFeedback: PromptFeedback?,
    usageMetadata: UsageMetadata?
)

Public properties

candidates

val candidatesList<Candidate>

The list of Candidate responses generated by the model.

functionCalls

val functionCallsList<FunctionCallPart>

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

val inlineDataPartsList<InlineDataPart>

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

val promptFeedbackPromptFeedback?

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

text

val textString?

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

val thoughtSummaryString?

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

val usageMetadataUsageMetadata?

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