Class GenerateContentResponse.Builder (3.56.0)

public static final class GenerateContentResponse.Builder extends GeneratedMessageV3.Builder<GenerateContentResponse.Builder> implements GenerateContentResponseOrBuilder

Response message for [PredictionService.GenerateContent].

Protobuf type google.cloud.aiplatform.v1.GenerateContentResponse

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllCandidates(Iterable<? extends Candidate> values)

public GenerateContentResponse.Builder addAllCandidates(Iterable<? extends Candidate> values)

Output only. Generated candidates.

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

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

addCandidates(Candidate value)

public GenerateContentResponse.Builder addCandidates(Candidate value)

Output only. Generated candidates.

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

Parameter
Name Description
value Candidate
Returns
Type Description
GenerateContentResponse.Builder

addCandidates(Candidate.Builder builderForValue)

public GenerateContentResponse.Builder addCandidates(Candidate.Builder builderForValue)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder addCandidates(int index, Candidate value)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder addCandidates(int index, Candidate.Builder builderForValue)

Output only. Generated candidates.

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

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

addCandidatesBuilder()

public Candidate.Builder addCandidatesBuilder()

Output only. Generated candidates.

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

Returns
Type Description
Candidate.Builder

addCandidatesBuilder(int index)

public Candidate.Builder addCandidatesBuilder(int index)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

build()

public GenerateContentResponse build()
Returns
Type Description
GenerateContentResponse

buildPartial()

public GenerateContentResponse buildPartial()
Returns
Type Description
GenerateContentResponse

clear()

public GenerateContentResponse.Builder clear()
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearCandidates()

public GenerateContentResponse.Builder clearCandidates()

Output only. Generated candidates.

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

Returns
Type Description
GenerateContentResponse.Builder

clearField(Descriptors.FieldDescriptor field)

public GenerateContentResponse.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearModelVersion()

public GenerateContentResponse.Builder clearModelVersion()

Output only. The model version used to generate the response.

string model_version = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public GenerateContentResponse.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
GenerateContentResponse.Builder
Overrides

clearPromptFeedback()

public GenerateContentResponse.Builder clearPromptFeedback()

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.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.Builder

clearUsageMetadata()

public GenerateContentResponse.Builder clearUsageMetadata()

Usage metadata about the response(s).

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

Returns
Type Description
GenerateContentResponse.Builder

clone()

public GenerateContentResponse.Builder clone()
Returns
Type Description
GenerateContentResponse.Builder
Overrides

getCandidates(int index)

public Candidate getCandidates(int index)

Output only. Generated candidates.

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

Parameter
Name Description
index int
Returns
Type Description
Candidate

getCandidatesBuilder(int index)

public Candidate.Builder getCandidatesBuilder(int index)

Output only. Generated candidates.

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

Parameter
Name Description
index int
Returns
Type Description
Candidate.Builder

getCandidatesBuilderList()

public List<Candidate.Builder> getCandidatesBuilderList()

Output only. Generated candidates.

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

Returns
Type Description
List<Builder>

getCandidatesCount()

public int getCandidatesCount()

Output only. Generated candidates.

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

Returns
Type Description
int

getCandidatesList()

public List<Candidate> getCandidatesList()

Output only. Generated candidates.

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

Returns
Type Description
List<Candidate>

getCandidatesOrBuilder(int index)

public CandidateOrBuilder getCandidatesOrBuilder(int index)

Output only. Generated candidates.

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

Parameter
Name Description
index int
Returns
Type Description
CandidateOrBuilder

getCandidatesOrBuilderList()

public List<? extends CandidateOrBuilder> getCandidatesOrBuilderList()

Output only. Generated candidates.

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

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1.CandidateOrBuilder>

getDefaultInstanceForType()

public GenerateContentResponse getDefaultInstanceForType()
Returns
Type Description
GenerateContentResponse

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getModelVersion()

public String getModelVersion()

Output only. The model version used to generate the response.

string model_version = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The modelVersion.

getModelVersionBytes()

public ByteString getModelVersionBytes()

Output only. The model version used to generate the response.

string model_version = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for modelVersion.

getPromptFeedback()

public GenerateContentResponse.PromptFeedback getPromptFeedback()

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.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedback

The promptFeedback.

getPromptFeedbackBuilder()

public GenerateContentResponse.PromptFeedback.Builder getPromptFeedbackBuilder()

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.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedback.Builder

getPromptFeedbackOrBuilder()

public GenerateContentResponse.PromptFeedbackOrBuilder getPromptFeedbackOrBuilder()

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.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GenerateContentResponse.PromptFeedbackOrBuilder

getUsageMetadata()

public GenerateContentResponse.UsageMetadata getUsageMetadata()

Usage metadata about the response(s).

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

Returns
Type Description
GenerateContentResponse.UsageMetadata

The usageMetadata.

getUsageMetadataBuilder()

public GenerateContentResponse.UsageMetadata.Builder getUsageMetadataBuilder()

Usage metadata about the response(s).

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

Returns
Type Description
GenerateContentResponse.UsageMetadata.Builder

getUsageMetadataOrBuilder()

public GenerateContentResponse.UsageMetadataOrBuilder getUsageMetadataOrBuilder()

Usage metadata about the response(s).

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

Returns
Type Description
GenerateContentResponse.UsageMetadataOrBuilder

hasPromptFeedback()

public boolean hasPromptFeedback()

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.aiplatform.v1.GenerateContentResponse.PromptFeedback prompt_feedback = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the promptFeedback field is set.

hasUsageMetadata()

public boolean hasUsageMetadata()

Usage metadata about the response(s).

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

Returns
Type Description
boolean

Whether the usageMetadata field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerateContentResponse other)

public GenerateContentResponse.Builder mergeFrom(GenerateContentResponse other)
Parameter
Name Description
other GenerateContentResponse
Returns
Type Description
GenerateContentResponse.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public GenerateContentResponse.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
GenerateContentResponse.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public GenerateContentResponse.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
GenerateContentResponse.Builder
Overrides

mergePromptFeedback(GenerateContentResponse.PromptFeedback value)

public GenerateContentResponse.Builder mergePromptFeedback(GenerateContentResponse.PromptFeedback value)

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.aiplatform.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)

public final GenerateContentResponse.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.Builder
Overrides

mergeUsageMetadata(GenerateContentResponse.UsageMetadata value)

public GenerateContentResponse.Builder mergeUsageMetadata(GenerateContentResponse.UsageMetadata value)

Usage metadata about the response(s).

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

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

removeCandidates(int index)

public GenerateContentResponse.Builder removeCandidates(int index)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder setCandidates(int index, Candidate value)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder setCandidates(int index, Candidate.Builder builderForValue)

Output only. Generated candidates.

repeated .google.cloud.aiplatform.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)

public GenerateContentResponse.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setModelVersion(String value)

public GenerateContentResponse.Builder setModelVersion(String value)

Output only. The model version used to generate the response.

string model_version = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value String

The modelVersion to set.

Returns
Type Description
GenerateContentResponse.Builder

This builder for chaining.

setModelVersionBytes(ByteString value)

public GenerateContentResponse.Builder setModelVersionBytes(ByteString value)

Output only. The model version used to generate the response.

string model_version = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value ByteString

The bytes for modelVersion to set.

Returns
Type Description
GenerateContentResponse.Builder

This builder for chaining.

setPromptFeedback(GenerateContentResponse.PromptFeedback value)

public GenerateContentResponse.Builder setPromptFeedback(GenerateContentResponse.PromptFeedback value)

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.aiplatform.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)

public GenerateContentResponse.Builder setPromptFeedback(GenerateContentResponse.PromptFeedback.Builder builderForValue)

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.aiplatform.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)

public GenerateContentResponse.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final GenerateContentResponse.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerateContentResponse.Builder
Overrides

setUsageMetadata(GenerateContentResponse.UsageMetadata value)

public GenerateContentResponse.Builder setUsageMetadata(GenerateContentResponse.UsageMetadata value)

Usage metadata about the response(s).

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

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

setUsageMetadata(GenerateContentResponse.UsageMetadata.Builder builderForValue)

public GenerateContentResponse.Builder setUsageMetadata(GenerateContentResponse.UsageMetadata.Builder builderForValue)

Usage metadata about the response(s).

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

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