GenerateContentResponse

public final class GenerateContentResponse


Represents a response from the model.

Summary

Public fields

final @NonNull List<@NonNull Candidate>

a list of possible responses generated from the model

final @NonNull List<@NonNull FunctionCallPart>

Convenience field to get all the function call parts in the request, if they exist

final FunctionResponsePart

Convenience field representing the first function response part in the response, if it exists.

final PromptFeedback

optional feedback for the given prompt.

final String

Convenience field representing all the text parts in the response, if they exists.

final UsageMetadata

Public constructors

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

Public fields

candidates

public final @NonNull List<@NonNull Candidatecandidates

a list of possible responses generated from the model

functionCalls

public final @NonNull List<@NonNull FunctionCallPartfunctionCalls

Convenience field to get all the function call parts in the request, if they exist

functionResponse

public final FunctionResponsePart functionResponse

Convenience field representing the first function response part in the response, if it exists.

promptFeedback

public final PromptFeedback promptFeedback

optional feedback for the given prompt. 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, if they exists.

usageMetadata

public final UsageMetadata usageMetadata

Public constructors

GenerateContentResponse

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