# Google Cloud Ai Platform V1 Client - Class GenerationConfig (1.60.0)

1.60.0 (latest) 1.59.0 1.58.0 1.57.0 1.56.0 1.55.0 1.54.0 1.53.0 1.52.0 1.51.0 1.50.0 1.49.0 1.48.0 1.47.0 1.46.0 1.45.0 1.44.0 1.43.0 1.42.0 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.1 1.31.0 1.30.0 1.26.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.0 1.14.0 1.13.1 1.12.0 1.11.0 1.10.0 1.9.0 1.8.0 1.7.0 1.6.0 1.5.0 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0 0.39.0 0.38.0 0.37.1 0.32.0 0.31.0 0.30.0 0.29.0 0.28.0 0.27.0 0.26.2 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.13.0 0.12.0 0.11.1 0.10.0 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 \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `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` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.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](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response. |
| `↳ response_json_schema` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Value` Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). 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` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.GenerationConfig.RoutingConfig` Optional. Routing configuration. |
| `↳ 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` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.SpeechConfig` Optional. The speech generation config. |
| `↳ thinking_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.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` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.ImageConfig` Optional. Config for image generation features. |

### getTemperature

Optional. Controls the randomness of predictions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasTemperature

### clearTemperature

### setTemperature

Optional. Controls the randomness of predictions.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTopP

Optional. If specified, nucleus sampling will be used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasTopP

### clearTopP

### setTopP

Optional. If specified, nucleus sampling will be used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTopK

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasTopK

### clearTopK

### setTopK

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCandidateCount

Optional. Number of candidates to generate.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasCandidateCount

### clearCandidateCount

### setCandidateCount

Optional. Number of candidates to generate.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMaxOutputTokens

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasMaxOutputTokens

### clearMaxOutputTokens

### setMaxOutputTokens

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStopSequences

Optional. Stop sequences.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setStopSequences

Optional. Stop sequences.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getResponseLogprobs

Optional. If true, export the logprobs results in response.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasResponseLogprobs

### clearResponseLogprobs

### setResponseLogprobs

Optional. If true, export the logprobs results in response.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLogprobs

Optional. Logit probabilities.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasLogprobs

### clearLogprobs

### setLogprobs

Optional. Logit probabilities.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPresencePenalty

Optional. Positive penalties.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasPresencePenalty

### clearPresencePenalty

### setPresencePenalty

Optional. Positive penalties.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getFrequencyPenalty

Optional. Frequency penalties.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasFrequencyPenalty

### clearFrequencyPenalty

### setFrequencyPenalty

Optional. Frequency penalties.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSeed

Optional. Seed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasSeed

### clearSeed

### setSeed

Optional. Seed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$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](https://spec.openapis.org/oas/v3.0.3#schema).
If set, a compatible response_mime_type must also be set.
Compatible mimetypes:
`application/json`: Schema for JSON response.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Schema|null` |   |

### 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](https://spec.openapis.org/oas/v3.0.3#schema).
If set, a compatible response_mime_type must also be set.
Compatible mimetypes:
`application/json`: Schema for JSON response.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Schema` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getResponseJsonSchema

Optional. Output schema of the generated response. This is an alternative
to `response_schema` that accepts [JSON Schema](https://json-schema.org/).

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Value|null` |   |

### hasResponseJsonSchema

### clearResponseJsonSchema

### setResponseJsonSchema

Optional. Output schema of the generated response. This is an alternative
to `response_schema` that accepts [JSON Schema](https://json-schema.org/).

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Value` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRoutingConfig

Optional. Routing configuration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.GenerationConfig.RoutingConfig|null` |   |

### hasRoutingConfig

### clearRoutingConfig

### setRoutingConfig

Optional. Routing configuration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.GenerationConfig.RoutingConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpeechConfig

Optional. The speech generation config.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.SpeechConfig|null` |   |

### hasSpeechConfig

### clearSpeechConfig

### setSpeechConfig

Optional. The speech generation config.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.SpeechConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getThinkingConfig

Optional. Config for thinking features.

An error will be returned if this field is set for models that don't
support thinking.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.GenerationConfig.ThinkingConfig|null` |   |

### 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.GenerationConfig.ThinkingConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImageConfig

Optional. Config for image generation features.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.ImageConfig|null` |   |

### hasImageConfig

### clearImageConfig

### setImageConfig

Optional. Config for image generation features.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.ImageConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |