Class GenerationConfig.Builder (0.2.0)

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

Generation config.

Protobuf type google.cloud.vertexai.v1beta1.GenerationConfig

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
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
Name Description
values Iterable<String>

The stopSequences to add.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public GenerationConfig.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
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
Name Description
value String

The stopSequences to add.

Returns
Type Description
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
Name Description
value ByteString

The bytes of the stopSequences to add.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

build()

public GenerationConfig build()
Returns
Type Description
GenerationConfig

buildPartial()

public GenerationConfig buildPartial()
Returns
Type Description
GenerationConfig

clear()

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

clearCandidateCount()

public GenerationConfig.Builder clearCandidateCount()

Optional. Number of candidates to generate.

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearEcho()

public GenerationConfig.Builder clearEcho()

Optional. Echo.

bool echo = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearFrequencyPenalty()

public GenerationConfig.Builder clearFrequencyPenalty()

Optional. Frequency penalties.

float frequency_penalty = 9 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearLogitBias()

public GenerationConfig.Builder clearLogitBias()
Returns
Type Description
GenerationConfig.Builder

clearLogprobs()

public GenerationConfig.Builder clearLogprobs()

Optional. Logit probabilities.

int32 logprobs = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearMaxOutputTokens()

public GenerationConfig.Builder clearMaxOutputTokens()

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

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearPresencePenalty()

public GenerationConfig.Builder clearPresencePenalty()

Optional. Positive penalties.

float presence_penalty = 8 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearStopSequences()

public GenerationConfig.Builder clearStopSequences()

Optional. Stop sequences.

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTemperature()

public GenerationConfig.Builder clearTemperature()

Optional. Controls the randomness of predictions.

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTopK()

public GenerationConfig.Builder clearTopK()

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

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clearTopP()

public GenerationConfig.Builder clearTopP()

Optional. If specified, nucleus sampling will be used.

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

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

clone()

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

containsLogitBias(String key)

public boolean containsLogitBias(String key)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
boolean

getCandidateCount()

public int getCandidateCount()

Optional. Number of candidates to generate.

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

Returns
Type Description
int

The candidateCount.

getDefaultInstanceForType()

public GenerationConfig getDefaultInstanceForType()
Returns
Type Description
GenerationConfig

getDescriptorForType()

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

getEcho()

public boolean getEcho()

Optional. Echo.

bool echo = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

The echo.

getFrequencyPenalty()

public float getFrequencyPenalty()

Optional. Frequency penalties.

float frequency_penalty = 9 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
float

The frequencyPenalty.

getLogitBias() (deprecated)

public Map<String,Float> getLogitBias()

Use #getLogitBiasMap() instead.

Returns
Type Description
Map<String,Float>

getLogitBiasCount()

public int getLogitBiasCount()

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getLogitBiasMap()

public Map<String,Float> getLogitBiasMap()

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Map<String,Float>

getLogitBiasOrDefault(String key, float defaultValue)

public float getLogitBiasOrDefault(String key, float defaultValue)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
key String
defaultValue float
Returns
Type Description
float

getLogitBiasOrThrow(String key)

public float getLogitBiasOrThrow(String key)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
float

getLogprobs()

public int getLogprobs()

Optional. Logit probabilities.

int32 logprobs = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The logprobs.

getMaxOutputTokens()

public int getMaxOutputTokens()

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

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

Returns
Type Description
int

The maxOutputTokens.

getMutableLogitBias() (deprecated)

public Map<String,Float> getMutableLogitBias()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,Float>

getPresencePenalty()

public float getPresencePenalty()

Optional. Positive penalties.

float presence_penalty = 8 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
float

The presencePenalty.

getStopSequences(int index)

public String getStopSequences(int index)

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)

public ByteString getStopSequencesBytes(int index)

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()

public int getStopSequencesCount()

Optional. Stop sequences.

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

Returns
Type Description
int

The count of stopSequences.

getStopSequencesList()

public ProtocolStringList getStopSequencesList()

Optional. Stop sequences.

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

Returns
Type Description
ProtocolStringList

A list containing the stopSequences.

getTemperature()

public float getTemperature()

Optional. Controls the randomness of predictions.

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

Returns
Type Description
float

The temperature.

getTopK()

public float getTopK()

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

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

Returns
Type Description
float

The topK.

getTopP()

public float getTopP()

Optional. If specified, nucleus sampling will be used.

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

Returns
Type Description
float

The topP.

internalGetFieldAccessorTable()

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

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
Name Description
number int
Returns
Type Description
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
Name Description
number int
Returns
Type Description
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(GenerationConfig other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

putAllLogitBias(Map<String,Float> values)

public GenerationConfig.Builder putAllLogitBias(Map<String,Float> values)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
values Map<String,Float>
Returns
Type Description
GenerationConfig.Builder

putLogitBias(String key, float value)

public GenerationConfig.Builder putLogitBias(String key, float value)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
key String
value float
Returns
Type Description
GenerationConfig.Builder

removeLogitBias(String key)

public GenerationConfig.Builder removeLogitBias(String key)

Optional. Logit bias.

map<string, float> logit_bias = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
GenerationConfig.Builder

setCandidateCount(int value)

public GenerationConfig.Builder setCandidateCount(int value)

Optional. Number of candidates to generate.

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.

setEcho(boolean value)

public GenerationConfig.Builder setEcho(boolean value)

Optional. Echo.

bool echo = 11 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value boolean

The echo to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setFrequencyPenalty(float value)

public GenerationConfig.Builder setFrequencyPenalty(float value)

Optional. Frequency penalties.

float frequency_penalty = 9 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value float

The frequencyPenalty to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setLogprobs(int value)

public GenerationConfig.Builder setLogprobs(int value)

Optional. Logit probabilities.

int32 logprobs = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value int

The logprobs to set.

Returns
Type Description
GenerationConfig.Builder

This builder for chaining.

setMaxOutputTokens(int value)

public GenerationConfig.Builder setMaxOutputTokens(int value)

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

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.

setPresencePenalty(float value)

public GenerationConfig.Builder setPresencePenalty(float value)

Optional. Positive penalties.

float presence_penalty = 8 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value float

The presencePenalty to set.

Returns
Type Description
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
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
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
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)

public GenerationConfig.Builder setTemperature(float value)

Optional. Controls the randomness of predictions.

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)

public GenerationConfig.Builder setTopK(float value)

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

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)

public GenerationConfig.Builder setTopP(float value)

Optional. If specified, nucleus sampling will be used.

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)

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