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, if they exist.

List<InlineDataPart>

Convenience field representing all the InlineDataParts in the first candidate, if they exist.

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, if they exists.

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, if they exist.

inlineDataParts

val inlineDataPartsList<InlineDataPart>

Convenience field representing all the InlineDataParts in the first candidate, if they exist.

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

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, if they exists.

usageMetadata

val usageMetadataUsageMetadata?

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