Reference documentation and code samples for the Google Cloud Ai Platform V1 Client class GenerationConfig.
Generation config.
Generated from protobuf message google.cloud.aiplatform.v1.GenerationConfig
Namespace
Google \ Cloud \ AIPlatform \ V1Methods
__construct
Constructor.
data
array
Optional. Data for populating the Message object.
↳ temperature
float
Optional. Controls the randomness of predictions.
↳ top_p
float
Optional. If specified, nucleus sampling will be used.
↳ top_k
float
Optional. If specified, top-k sampling will be used.
↳ candidate_count
int
Optional. Number of candidates to generate.
↳ max_output_tokens
int
Optional. The maximum number of output tokens to generate per message.
↳ stop_sequences
string[]
Optional. Stop sequences.
↳ response_logprobs
bool
Optional. If true, export the logprobs results in response.
↳ logprobs
int
Optional. Logit probabilities.
↳ presence_penalty
float
Optional. Positive penalties.
↳ frequency_penalty
float
Optional. Frequency penalties.
↳ seed
int
Optional. Seed.
↳ response_mime_type
string
Optional. Output response mimetype of the generated candidate text. Supported mimetype: - text/plain
: (default) Text output. - application/json
: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.
↳ response_schema
Schema
Optional. The Schema
object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an OpenAPI 3.0 schema object
. If set, a compatible response_mime_type must also be set. Compatible mimetypes: application/json
: Schema for JSON response.
↳ response_json_schema
Google\Protobuf\Value
Optional. Output schema of the generated response. This is an alternative to response_schema
that accepts JSON Schema
. If set, response_schema
must be omitted, but response_mime_type
is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - $id
- $defs
- $ref
- $anchor
- type
- format
- title
- description
- enum
(for strings and numbers) - items
- prefixItems
- minItems
- maxItems
- minimum
- maximum
- anyOf
- oneOf
(interpreted the same as anyOf
) - properties
- additionalProperties
- required
The non-standard propertyOrdering
property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If $ref
is set on a sub-schema, no other properties, except for than those starting as a $
, may be set.
↳ routing_config
↳ audio_timestamp
bool
Optional. If enabled, audio timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response.
↳ response_modalities
int[]
Optional. The modalities of the response. The model will generate a response that includes all the specified modalities. For example, if this is set to [TEXT, IMAGE]
, the response will include both text and an image.
↳ media_resolution
int
Optional. The token resolution at which input media content is sampled. This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model.
↳ speech_config
↳ thinking_config
GenerationConfig\ThinkingConfig
Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
↳ image_config
getTemperature
Optional. Controls the randomness of predictions.
float
hasTemperature
clearTemperature
setTemperature
Optional. Controls the randomness of predictions.
var
float
$this
getTopP
Optional. If specified, nucleus sampling will be used.
float
hasTopP
clearTopP
setTopP
Optional. If specified, nucleus sampling will be used.
var
float
$this
getTopK
Optional. If specified, top-k sampling will be used.
float
hasTopK
clearTopK
setTopK
Optional. If specified, top-k sampling will be used.
var
float
$this
getCandidateCount
Optional. Number of candidates to generate.
int
hasCandidateCount
clearCandidateCount
setCandidateCount
Optional. Number of candidates to generate.
var
int
$this
getMaxOutputTokens
Optional. The maximum number of output tokens to generate per message.
int
hasMaxOutputTokens
clearMaxOutputTokens
setMaxOutputTokens
Optional. The maximum number of output tokens to generate per message.
var
int
$this
getStopSequences
Optional. Stop sequences.
setStopSequences
Optional. Stop sequences.
var
string[]
$this
getResponseLogprobs
Optional. If true, export the logprobs results in response.
bool
hasResponseLogprobs
clearResponseLogprobs
setResponseLogprobs
Optional. If true, export the logprobs results in response.
var
bool
$this
getLogprobs
Optional. Logit probabilities.
int
hasLogprobs
clearLogprobs
setLogprobs
Optional. Logit probabilities.
var
int
$this
getPresencePenalty
Optional. Positive penalties.
float
hasPresencePenalty
clearPresencePenalty
setPresencePenalty
Optional. Positive penalties.
var
float
$this
getFrequencyPenalty
Optional. Frequency penalties.
float
hasFrequencyPenalty
clearFrequencyPenalty
setFrequencyPenalty
Optional. Frequency penalties.
var
float
$this
getSeed
Optional. Seed.
int
hasSeed
clearSeed
setSeed
Optional. Seed.
var
int
$this
getResponseMimeType
Optional. Output response mimetype of the generated candidate text.
Supported mimetype:
-
text/plain: (default) Text output. -
application/json: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.
string
setResponseMimeType
Optional. Output response mimetype of the generated candidate text.
Supported mimetype:
-
text/plain: (default) Text output. -
application/json: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.
var
string
$this
getResponseSchema
Optional. The Schema
object allows the definition of input and output
data types. These types can be objects, but also primitives and arrays.
Represents a select subset of an OpenAPI 3.0 schema
object
.
If set, a compatible response_mime_type must also be set.
Compatible mimetypes: application/json
: Schema for JSON response.
hasResponseSchema
clearResponseSchema
setResponseSchema
Optional. The Schema
object allows the definition of input and output
data types. These types can be objects, but also primitives and arrays.
Represents a select subset of an OpenAPI 3.0 schema
object
.
If set, a compatible response_mime_type must also be set.
Compatible mimetypes: application/json
: Schema for JSON response.
$this
getResponseJsonSchema
Optional. Output schema of the generated response. This is an alternative
to response_schema
that accepts JSON Schema
.
If set, response_schema
must be omitted, but response_mime_type
is
required.
While the full JSON Schema may be sent, not all features are supported.
Specifically, only the following properties are supported:
-
$id -
$defs -
$ref -
$anchor -
type -
format -
title -
description -
enum(for strings and numbers) -
items -
prefixItems -
minItems -
maxItems -
minimum -
maximum -
anyOf -
oneOf(interpreted the same asanyOf) -
properties -
additionalProperties -
requiredThe non-standardpropertyOrderingproperty may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If$refis set on a sub-schema, no other properties, except for than those starting as a$, may be set.
hasResponseJsonSchema
clearResponseJsonSchema
setResponseJsonSchema
Optional. Output schema of the generated response. This is an alternative
to response_schema
that accepts JSON Schema
.
If set, response_schema
must be omitted, but response_mime_type
is
required.
While the full JSON Schema may be sent, not all features are supported.
Specifically, only the following properties are supported:
-
$id -
$defs -
$ref -
$anchor -
type -
format -
title -
description -
enum(for strings and numbers) -
items -
prefixItems -
minItems -
maxItems -
minimum -
maximum -
anyOf -
oneOf(interpreted the same asanyOf) -
properties -
additionalProperties -
requiredThe non-standardpropertyOrderingproperty may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If$refis set on a sub-schema, no other properties, except for than those starting as a$, may be set.
$this
getRoutingConfig
Optional. Routing configuration.
hasRoutingConfig
clearRoutingConfig
setRoutingConfig
Optional. Routing configuration.
$this
getAudioTimestamp
Optional. If enabled, audio timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response.
bool
hasAudioTimestamp
clearAudioTimestamp
setAudioTimestamp
Optional. If enabled, audio timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response.
var
bool
$this
getResponseModalities
Optional. The modalities of the response. The model will generate a
response that includes all the specified modalities. For example, if this
is set to [TEXT, IMAGE]
, the response will include both text and an
image.
setResponseModalities
Optional. The modalities of the response. The model will generate a
response that includes all the specified modalities. For example, if this
is set to [TEXT, IMAGE]
, the response will include both text and an
image.
var
int[]
$this
getMediaResolution
Optional. The token resolution at which input media content is sampled.
This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model.
int
hasMediaResolution
clearMediaResolution
setMediaResolution
Optional. The token resolution at which input media content is sampled.
This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model.
var
int
$this
getSpeechConfig
Optional. The speech generation config.
hasSpeechConfig
clearSpeechConfig
setSpeechConfig
Optional. The speech generation config.
$this
getThinkingConfig
Optional. Config for thinking features.
An error will be returned if this field is set for models that don't support thinking.
hasThinkingConfig
clearThinkingConfig
setThinkingConfig
Optional. Config for thinking features.
An error will be returned if this field is set for models that don't support thinking.
$this
getImageConfig
Optional. Config for image generation features.
hasImageConfig
clearImageConfig
setImageConfig
Optional. Config for image generation features.
$this

