Class GenerateContentResponse.Builder (1.13.0)

publicstaticfinalclass GenerateContentResponse.BuilderextendsGeneratedMessageV3.Builder<GenerateContentResponse.Builder>implementsGenerateContentResponseOrBuilder

Response message for [PredictionService.GenerateContent].

Protobuf type google.cloud.vertexai.v1.GenerateContentResponse

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addAllCandidates(Iterable<? extends Candidate> values)

publicGenerateContentResponse.BuilderaddAllCandidates(Iterable<?extendsCandidate>values)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
values Iterable<? extends com.google.cloud.vertexai.api.Candidate>
Returns
Type Description
GenerateContentResponse.Builder

addCandidates(Candidate value)

publicGenerateContentResponse.BuilderaddCandidates(Candidatevalue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value Candidate
Returns
Type Description
GenerateContentResponse.Builder

addCandidates(Candidate.Builder builderForValue)

publicGenerateContentResponse.BuilderaddCandidates(Candidate.BuilderbuilderForValue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
builderForValue Candidate.Builder
Returns
Type Description
GenerateContentResponse.Builder

addCandidates(int index, Candidate value)

publicGenerateContentResponse.BuilderaddCandidates(intindex,Candidatevalue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
Name Description
index int
value Candidate
Returns
Type Description
GenerateContentResponse.Builder

addCandidates(int index, Candidate.Builder builderForValue)

publicGenerateContentResponse.BuilderaddCandidates(intindex,Candidate.BuilderbuilderForValue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
Name Description
index int
builderForValue Candidate.Builder
Returns
Type Description
GenerateContentResponse.Builder

addCandidatesBuilder()

publicCandidate.BuilderaddCandidatesBuilder()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Candidate.Builder

addCandidatesBuilder(int index)

publicCandidate.BuilderaddCandidatesBuilder(intindex)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
Candidate.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicGenerateContentResponse.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

build()

publicGenerateContentResponsebuild()
Returns
Type Description
GenerateContentResponse

buildPartial()

publicGenerateContentResponsebuildPartial()
Returns
Type Description
GenerateContentResponse

clear()

publicGenerateContentResponse.Builderclear()
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearCandidates()

publicGenerateContentResponse.BuilderclearCandidates()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.Builder

clearField(Descriptors.FieldDescriptor field)

publicGenerateContentResponse.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

publicGenerateContentResponse.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearPromptFeedback()

publicGenerateContentResponse.BuilderclearPromptFeedback()

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.Builder

clearUsageMetadata()

publicGenerateContentResponse.BuilderclearUsageMetadata()

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Returns
Type Description
GenerateContentResponse.Builder

clone()

publicGenerateContentResponse.Builderclone()
Returns
Type Description
GenerateContentResponse.Builder
Overrides

getCandidates(int index)

publicCandidategetCandidates(intindex)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
Candidate

getCandidatesBuilder(int index)

publicCandidate.BuildergetCandidatesBuilder(intindex)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
Candidate.Builder

getCandidatesBuilderList()

publicList<Candidate.Builder>getCandidatesBuilderList()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<Builder>

getCandidatesCount()

publicintgetCandidatesCount()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

getCandidatesList()

publicList<Candidate>getCandidatesList()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<Candidate>

getCandidatesOrBuilder(int index)

publicCandidateOrBuildergetCandidatesOrBuilder(intindex)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
CandidateOrBuilder

getCandidatesOrBuilderList()

publicList<?extendsCandidateOrBuilder>getCandidatesOrBuilderList()

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.vertexai.api.CandidateOrBuilder>

getDefaultInstanceForType()

publicGenerateContentResponsegetDefaultInstanceForType()
Returns
Type Description
GenerateContentResponse

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPromptFeedback()

publicGenerateContentResponse.PromptFeedbackgetPromptFeedback()

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedback

The promptFeedback.

getPromptFeedbackBuilder()

publicGenerateContentResponse.PromptFeedback.BuildergetPromptFeedbackBuilder()

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedback.Builder

getPromptFeedbackOrBuilder()

publicGenerateContentResponse.PromptFeedbackOrBuildergetPromptFeedbackOrBuilder()

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedbackOrBuilder

getUsageMetadata()

publicGenerateContentResponse.UsageMetadatagetUsageMetadata()

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Returns
Type Description
GenerateContentResponse.UsageMetadata

The usageMetadata.

getUsageMetadataBuilder()

publicGenerateContentResponse.UsageMetadata.BuildergetUsageMetadataBuilder()

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

getUsageMetadataOrBuilder()

publicGenerateContentResponse.UsageMetadataOrBuildergetUsageMetadataOrBuilder()

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Returns
Type Description
GenerateContentResponse.UsageMetadataOrBuilder

hasPromptFeedback()

publicbooleanhasPromptFeedback()

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the promptFeedback field is set.

hasUsageMetadata()

publicbooleanhasUsageMetadata()

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Returns
Type Description
boolean

Whether the usageMetadata field is set.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerateContentResponse other)

publicGenerateContentResponse.BuildermergeFrom(GenerateContentResponseother)
Parameter
Name Description
other GenerateContentResponse
Returns
Type Description
GenerateContentResponse.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicGenerateContentResponse.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicGenerateContentResponse.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
GenerateContentResponse.Builder
Overrides

mergePromptFeedback(GenerateContentResponse.PromptFeedback value)

publicGenerateContentResponse.BuildermergePromptFeedback(GenerateContentResponse.PromptFeedbackvalue)

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value GenerateContentResponse.PromptFeedback
Returns
Type Description
GenerateContentResponse.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerateContentResponse.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.Builder
Overrides

mergeUsageMetadata(GenerateContentResponse.UsageMetadata value)

publicGenerateContentResponse.BuildermergeUsageMetadata(GenerateContentResponse.UsageMetadatavalue)

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Parameter
Name Description
value GenerateContentResponse.UsageMetadata
Returns
Type Description
GenerateContentResponse.Builder

removeCandidates(int index)

publicGenerateContentResponse.BuilderremoveCandidates(intindex)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
GenerateContentResponse.Builder

setCandidates(int index, Candidate value)

publicGenerateContentResponse.BuildersetCandidates(intindex,Candidatevalue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
Name Description
index int
value Candidate
Returns
Type Description
GenerateContentResponse.Builder

setCandidates(int index, Candidate.Builder builderForValue)

publicGenerateContentResponse.BuildersetCandidates(intindex,Candidate.BuilderbuilderForValue)

Output only. Generated candidates.

repeated .google.cloud.vertexai.v1.Candidate candidates = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
Name Description
index int
builderForValue Candidate.Builder
Returns
Type Description
GenerateContentResponse.Builder

setField(Descriptors.FieldDescriptor field, Object value)

publicGenerateContentResponse.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setPromptFeedback(GenerateContentResponse.PromptFeedback value)

publicGenerateContentResponse.BuildersetPromptFeedback(GenerateContentResponse.PromptFeedbackvalue)

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value GenerateContentResponse.PromptFeedback
Returns
Type Description
GenerateContentResponse.Builder

setPromptFeedback(GenerateContentResponse.PromptFeedback.Builder builderForValue)

publicGenerateContentResponse.BuildersetPromptFeedback(GenerateContentResponse.PromptFeedback.BuilderbuilderForValue)

Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

.google.cloud.vertexai.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
builderForValue GenerateContentResponse.PromptFeedback.Builder
Returns
Type Description
GenerateContentResponse.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicGenerateContentResponse.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerateContentResponse.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setUsageMetadata(GenerateContentResponse.UsageMetadata value)

publicGenerateContentResponse.BuildersetUsageMetadata(GenerateContentResponse.UsageMetadatavalue)

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Parameter
Name Description
value GenerateContentResponse.UsageMetadata
Returns
Type Description
GenerateContentResponse.Builder

setUsageMetadata(GenerateContentResponse.UsageMetadata.Builder builderForValue)

publicGenerateContentResponse.BuildersetUsageMetadata(GenerateContentResponse.UsageMetadata.BuilderbuilderForValue)

Usage metadata about the response(s).

.google.cloud.vertexai.v1.GenerateContentResponse.UsageMetadata usage_metadata = 4;

Parameter
Name Description
builderForValue GenerateContentResponse.UsageMetadata.Builder
Returns
Type Description
GenerateContentResponse.Builder

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.