Class GenerationConfig.Builder (3.40.0)

public static final class GenerationConfig.Builder extends GeneratedMessageV3.Builder<GenerationConfig.Builder> implements GenerationConfigOrBuilder

Generation config.

Protobuf type google.cloud.aiplatform.v1beta1.GenerationConfig

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addAllStopSequences(Iterable<String> values)

public GenerationConfig.Builder addAllStopSequences(Iterable<String> values)

Optional. Stop sequences.

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

Parameter
NameDescription
valuesIterable<String>

The stopSequences to add.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public GenerationConfig.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
GenerationConfig.Builder
Overrides

addStopSequences(String value)

public GenerationConfig.Builder addStopSequences(String value)

Optional. Stop sequences.

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

Parameter
NameDescription
valueString

The stopSequences to add.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

addStopSequencesBytes(ByteString value)

public GenerationConfig.Builder addStopSequencesBytes(ByteString value)

Optional. Stop sequences.

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

Parameter
NameDescription
valueByteString

The bytes of the stopSequences to add.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

build()

public GenerationConfig build()
Returns
TypeDescription
GenerationConfig

buildPartial()

public GenerationConfig buildPartial()
Returns
TypeDescription
GenerationConfig

clear()

public GenerationConfig.Builder clear()
Returns
TypeDescription
GenerationConfig.Builder
Overrides

clearCandidateCount()

public GenerationConfig.Builder clearCandidateCount()

Optional. Number of candidates to generate.

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public GenerationConfig.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
GenerationConfig.Builder
Overrides

clearMaxOutputTokens()

public GenerationConfig.Builder clearMaxOutputTokens()

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

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public GenerationConfig.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
GenerationConfig.Builder
Overrides

clearStopSequences()

public GenerationConfig.Builder clearStopSequences()

Optional. Stop sequences.

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clearTemperature()

public GenerationConfig.Builder clearTemperature()

Optional. Controls the randomness of predictions.

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clearTopK()

public GenerationConfig.Builder clearTopK()

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

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clearTopP()

public GenerationConfig.Builder clearTopP()

Optional. If specified, nucleus sampling will be used.

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

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

clone()

public GenerationConfig.Builder clone()
Returns
TypeDescription
GenerationConfig.Builder
Overrides

getCandidateCount()

public int getCandidateCount()

Optional. Number of candidates to generate.

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

Returns
TypeDescription
int

The candidateCount.

getDefaultInstanceForType()

public GenerationConfig getDefaultInstanceForType()
Returns
TypeDescription
GenerationConfig

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getMaxOutputTokens()

public int getMaxOutputTokens()

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

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

Returns
TypeDescription
int

The maxOutputTokens.

getStopSequences(int index)

public String getStopSequences(int index)

Optional. Stop sequences.

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

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
String

The stopSequences at the given index.

getStopSequencesBytes(int index)

public ByteString getStopSequencesBytes(int index)

Optional. Stop sequences.

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

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
ByteString

The bytes of the stopSequences at the given index.

getStopSequencesCount()

public int getStopSequencesCount()

Optional. Stop sequences.

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

Returns
TypeDescription
int

The count of stopSequences.

getStopSequencesList()

public ProtocolStringList getStopSequencesList()

Optional. Stop sequences.

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

Returns
TypeDescription
ProtocolStringList

A list containing the stopSequences.

getTemperature()

public float getTemperature()

Optional. Controls the randomness of predictions.

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

Returns
TypeDescription
float

The temperature.

getTopK()

public float getTopK()

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

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

Returns
TypeDescription
float

The topK.

getTopP()

public float getTopP()

Optional. If specified, nucleus sampling will be used.

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

Returns
TypeDescription
float

The topP.

hasCandidateCount()

public boolean hasCandidateCount()

Optional. Number of candidates to generate.

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

Returns
TypeDescription
boolean

Whether the candidateCount field is set.

hasMaxOutputTokens()

public boolean hasMaxOutputTokens()

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

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

Returns
TypeDescription
boolean

Whether the maxOutputTokens field is set.

hasTemperature()

public boolean hasTemperature()

Optional. Controls the randomness of predictions.

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

Returns
TypeDescription
boolean

Whether the temperature field is set.

hasTopK()

public boolean hasTopK()

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

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

Returns
TypeDescription
boolean

Whether the topK field is set.

hasTopP()

public boolean hasTopP()

Optional. If specified, nucleus sampling will be used.

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

Returns
TypeDescription
boolean

Whether the topP field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(GenerationConfig other)

public GenerationConfig.Builder mergeFrom(GenerationConfig other)
Parameter
NameDescription
otherGenerationConfig
Returns
TypeDescription
GenerationConfig.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public GenerationConfig.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
GenerationConfig.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public GenerationConfig.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
GenerationConfig.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final GenerationConfig.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
GenerationConfig.Builder
Overrides

setCandidateCount(int value)

public GenerationConfig.Builder setCandidateCount(int value)

Optional. Number of candidates to generate.

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

Parameter
NameDescription
valueint

The candidateCount to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public GenerationConfig.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
GenerationConfig.Builder
Overrides

setMaxOutputTokens(int value)

public GenerationConfig.Builder setMaxOutputTokens(int value)

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

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

Parameter
NameDescription
valueint

The maxOutputTokens to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

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

public GenerationConfig.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
GenerationConfig.Builder
Overrides

setStopSequences(int index, String value)

public GenerationConfig.Builder setStopSequences(int index, String value)

Optional. Stop sequences.

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

Parameters
NameDescription
indexint

The index to set the value at.

valueString

The stopSequences to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

setTemperature(float value)

public GenerationConfig.Builder setTemperature(float value)

Optional. Controls the randomness of predictions.

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

Parameter
NameDescription
valuefloat

The temperature to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

setTopK(float value)

public GenerationConfig.Builder setTopK(float value)

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

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

Parameter
NameDescription
valuefloat

The topK to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

setTopP(float value)

public GenerationConfig.Builder setTopP(float value)

Optional. If specified, nucleus sampling will be used.

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

Parameter
NameDescription
valuefloat

The topP to set.

Returns
TypeDescription
GenerationConfig.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final GenerationConfig.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
GenerationConfig.Builder
Overrides