Class GenerationConfig.Builder (0.4.0)

publicstaticfinalclass GenerationConfig.BuilderextendsGeneratedMessageV3.Builder<GenerationConfig.Builder>implementsGenerationConfigOrBuilder

Generation config.

Protobuf type google.cloud.vertexai.v1.GenerationConfig

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

addAllStopSequences(Iterable<String> values)

publicGenerationConfig.BuilderaddAllStopSequences(Iterable<String>values)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Iterable<String>

The stopSequences to add.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addStopSequences(String value)

publicGenerationConfig.BuilderaddStopSequences(Stringvalue)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The stopSequences to add.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

addStopSequencesBytes(ByteString value)

publicGenerationConfig.BuilderaddStopSequencesBytes(ByteStringvalue)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes of the stopSequences to add.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

build()

publicGenerationConfigbuild()
Returns
Type Description
GenerationConfig

buildPartial()

publicGenerationConfigbuildPartial()
Returns
Type Description
GenerationConfig

clear()

publicGenerationConfig.Builderclear()
Returns
Type Description
GenerationConfig.Builder
Overrides

clearCandidateCount()

publicGenerationConfig.BuilderclearCandidateCount()

Optional. Number of candidates to generate.

optional int32 candidate_count = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

publicGenerationConfig.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
GenerationConfig.Builder
Overrides

clearMaxOutputTokens()

publicGenerationConfig.BuilderclearMaxOutputTokens()

Optional. The maximum number of output tokens to generate per message.

optional int32 max_output_tokens = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

publicGenerationConfig.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
GenerationConfig.Builder
Overrides

clearStopSequences()

publicGenerationConfig.BuilderclearStopSequences()

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTemperature()

publicGenerationConfig.BuilderclearTemperature()

Optional. Controls the randomness of predictions.

optional float temperature = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTopK()

publicGenerationConfig.BuilderclearTopK()

Optional. If specified, top-k sampling will be used.

optional float top_k = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTopP()

publicGenerationConfig.BuilderclearTopP()

Optional. If specified, nucleus sampling will be used.

optional float top_p = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clone()

publicGenerationConfig.Builderclone()
Returns
Type Description
GenerationConfig.Builder
Overrides

getCandidateCount()

publicintgetCandidateCount()

Optional. Number of candidates to generate.

optional int32 candidate_count = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The candidateCount.

getDefaultInstanceForType()

publicGenerationConfiggetDefaultInstanceForType()
Returns
Type Description
GenerationConfig

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getMaxOutputTokens()

publicintgetMaxOutputTokens()

Optional. The maximum number of output tokens to generate per message.

optional int32 max_output_tokens = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The maxOutputTokens.

getStopSequences(int index)

publicStringgetStopSequences(intindex)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The stopSequences at the given index.

getStopSequencesBytes(int index)

publicByteStringgetStopSequencesBytes(intindex)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the stopSequences at the given index.

getStopSequencesCount()

publicintgetStopSequencesCount()

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The count of stopSequences.

getStopSequencesList()

publicProtocolStringListgetStopSequencesList()

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ProtocolStringList

A list containing the stopSequences.

getTemperature()

publicfloatgetTemperature()

Optional. Controls the randomness of predictions.

optional float temperature = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
float

The temperature.

getTopK()

publicfloatgetTopK()

Optional. If specified, top-k sampling will be used.

optional float top_k = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
float

The topK.

getTopP()

publicfloatgetTopP()

Optional. If specified, nucleus sampling will be used.

optional float top_p = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
float

The topP.

hasCandidateCount()

publicbooleanhasCandidateCount()

Optional. Number of candidates to generate.

optional int32 candidate_count = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the candidateCount field is set.

hasMaxOutputTokens()

publicbooleanhasMaxOutputTokens()

Optional. The maximum number of output tokens to generate per message.

optional int32 max_output_tokens = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the maxOutputTokens field is set.

hasTemperature()

publicbooleanhasTemperature()

Optional. Controls the randomness of predictions.

optional float temperature = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the temperature field is set.

hasTopK()

publicbooleanhasTopK()

Optional. If specified, top-k sampling will be used.

optional float top_k = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the topK field is set.

hasTopP()

publicbooleanhasTopP()

Optional. If specified, nucleus sampling will be used.

optional float top_p = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the topP field is set.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerationConfig other)

publicGenerationConfig.BuildermergeFrom(GenerationConfigother)
Parameter
Name Description
other GenerationConfig
Returns
Type Description
GenerationConfig.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

publicGenerationConfig.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
GenerationConfig.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerationConfig.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerationConfig.Builder
Overrides

setCandidateCount(int value)

publicGenerationConfig.BuildersetCandidateCount(intvalue)

Optional. Number of candidates to generate.

optional int32 candidate_count = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value int

The candidateCount to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setMaxOutputTokens(int value)

publicGenerationConfig.BuildersetMaxOutputTokens(intvalue)

Optional. The maximum number of output tokens to generate per message.

optional int32 max_output_tokens = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value int

The maxOutputTokens to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

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

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

setStopSequences(int index, String value)

publicGenerationConfig.BuildersetStopSequences(intindex,Stringvalue)

Optional. Stop sequences.

repeated string stop_sequences = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
index int

The index to set the value at.

value String

The stopSequences to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setTemperature(float value)

publicGenerationConfig.BuildersetTemperature(floatvalue)

Optional. Controls the randomness of predictions.

optional float temperature = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value float

The temperature to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setTopK(float value)

publicGenerationConfig.BuildersetTopK(floatvalue)

Optional. If specified, top-k sampling will be used.

optional float top_k = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value float

The topK to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setTopP(float value)

publicGenerationConfig.BuildersetTopP(floatvalue)

Optional. If specified, nucleus sampling will be used.

optional float top_p = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value float

The topP to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalGenerationConfig.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
GenerationConfig.Builder
Overrides

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.