# Google Cloud Ai Platform V1 Client - Class TuningJob (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 TuningJob.

Represents a TuningJob that runs with Google owned models.

Generated from protobuf message `google.cloud.aiplatform.v1.TuningJob`

## Namespace

Google \\ Cloud \\ AIPlatform \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ base_model` | `string` The base model that is being tuned. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). |
| `↳ pre_tuned_model` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.PreTunedModel` The pre-tuned model for continuous tuning. |
| `↳ supervised_tuning_spec` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.SupervisedTuningSpec` Tuning Spec for Supervised Fine Tuning. |
| `↳ name` | `string` Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` |
| `↳ tuned_model_display_name` | `string` Optional. The display name of the [TunedModel](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model). The name can be up to 128 characters long and can consist of any UTF-8 characters. For continuous tuning, tuned_model_display_name will by default use the same display name as the pre-tuned model. If a new display name is provided, the tuning job will create a new model instead of a new version. |
| `↳ description` | `string` Optional. The description of the [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob). |
| `↳ state` | `int` Output only. The detailed state of the job. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was created. |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) for the first time entered the `JOB_STATE_RUNNING` state. |
| `↳ end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the TuningJob entered any of the following [JobStates](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.JobState): `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`, `JOB_STATE_EXPIRED`. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was most recently updated. |
| `↳ error` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` Output only. Only populated when job's state is `JOB_STATE_FAILED` or `JOB_STATE_CANCELLED`. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. The labels with user-defined metadata to organize [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) and generated resources such as [Model](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model) and [Endpoint](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Endpoint). Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See <https://goo.gl/xmQnxf> for more information and examples of labels. |
| `↳ experiment` | `string` Output only. The Experiment associated with this [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob). |
| `↳ tuned_model` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TunedModel` Output only. The tuned model resources associated with this [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob). |
| `↳ tuning_data_stats` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningDataStats` Output only. The tuning data statistics associated with this [TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob). |
| `↳ encryption_spec` | `https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.EncryptionSpec` Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key. |
| `↳ service_account` | `string` The service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See <https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent> Users starting the pipeline must have the `iam.serviceAccounts.actAs` permission on this service account. |
| `↳ evaluate_dataset_runs` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.EvaluateDatasetRun>` Output only. Evaluation runs for the Tuning Job. |

### getBaseModel

The base model that is being tuned. See [Supported
models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasBaseModel

### setBaseModel

The base model that is being tuned. See [Supported
models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models).

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

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

### getPreTunedModel

The pre-tuned model for continuous tuning.

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

### hasPreTunedModel

### setPreTunedModel

The pre-tuned model for continuous tuning.

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

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

### getSupervisedTuningSpec

Tuning Spec for Supervised Fine Tuning.

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

### hasSupervisedTuningSpec

### setSupervisedTuningSpec

Tuning Spec for Supervised Fine Tuning.

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

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

### getName

Output only. Identifier. Resource name of a TuningJob. Format:
`projects/{project}/locations/{location}/tuningJobs/{tuning_job}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Output only. Identifier. Resource name of a TuningJob. Format:
`projects/{project}/locations/{location}/tuningJobs/{tuning_job}`

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

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

### getTunedModelDisplayName

Optional. The display name of the
[TunedModel](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model). The name can be up to 128
characters long and can consist of any UTF-8 characters. For continuous
tuning, tuned_model_display_name will by default use the same display name
as the pre-tuned model. If a new display name is provided, the tuning job
will create a new model instead of a new version.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setTunedModelDisplayName

Optional. The display name of the
[TunedModel](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model). The name can be up to 128
characters long and can consist of any UTF-8 characters. For continuous
tuning, tuned_model_display_name will by default use the same display name
as the pre-tuned model. If a new display name is provided, the tuning job
will create a new model instead of a new version.

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

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

### getDescription

Optional. The description of the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Optional. The description of the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

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

### getState

Output only. The detailed state of the job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [JobState](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.JobState). |

### setState

Output only. The detailed state of the job.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [JobState](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.JobState). |

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

### getCreateTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was created.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was created.

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

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

### getStartTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) for the first time
entered the `JOB_STATE_RUNNING` state.

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

### hasStartTime

### clearStartTime

### setStartTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) for the first time
entered the `JOB_STATE_RUNNING` state.

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

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

### getEndTime

Output only. Time when the TuningJob entered any of the following
[JobStates](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.JobState): `JOB_STATE_SUCCEEDED`,
`JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`, `JOB_STATE_EXPIRED`.

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

### hasEndTime

### clearEndTime

### setEndTime

Output only. Time when the TuningJob entered any of the following
[JobStates](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.JobState): `JOB_STATE_SUCCEEDED`,
`JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`, `JOB_STATE_EXPIRED`.

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

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

### getUpdateTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was most recently
updated.

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

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. Time when the
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) was most recently
updated.

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

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

### getError

Output only. Only populated when job's state is `JOB_STATE_FAILED` or
`JOB_STATE_CANCELLED`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html|null` |   |

### hasError

### clearError

### setError

Output only. Only populated when job's state is `JOB_STATE_FAILED` or
`JOB_STATE_CANCELLED`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` |

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

### getLabels

Optional. The labels with user-defined metadata to organize
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) and generated resources
such as [Model](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model) and
[Endpoint](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Endpoint).

Label keys and values can be no longer than 64 characters
(Unicode codepoints), can only contain lowercase letters, numeric
characters, underscores and dashes. International characters are allowed.
See <https://goo.gl/xmQnxf> for more information and examples of labels.

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

### setLabels

Optional. The labels with user-defined metadata to organize
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob) and generated resources
such as [Model](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Model) and
[Endpoint](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.Endpoint).

Label keys and values can be no longer than 64 characters
(Unicode codepoints), can only contain lowercase letters, numeric
characters, underscores and dashes. International characters are allowed.
See <https://goo.gl/xmQnxf> for more information and examples of labels.

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

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

### getExperiment

Output only. The Experiment associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setExperiment

Output only. The Experiment associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

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

### getTunedModel

Output only. The tuned model resources associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

### hasTunedModel

### clearTunedModel

### setTunedModel

Output only. The tuned model resources associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

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

### getTuningDataStats

Output only. The tuning data statistics associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

### hasTuningDataStats

### clearTuningDataStats

### setTuningDataStats

Output only. The tuning data statistics associated with this
[TuningJob](https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.TuningJob).

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

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

### getEncryptionSpec

Customer-managed encryption key options for a TuningJob. If this is set,
then all resources created by the TuningJob will be encrypted with the
provided encryption key.

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

### hasEncryptionSpec

### clearEncryptionSpec

### setEncryptionSpec

Customer-managed encryption key options for a TuningJob. If this is set,
then all resources created by the TuningJob will be encrypted with the
provided encryption key.

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

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

### getServiceAccount

The service account that the tuningJob workload runs as.

If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the
project will be used. See
<https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent>
Users starting the pipeline must have the `iam.serviceAccounts.actAs`
permission on this service account.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setServiceAccount

The service account that the tuningJob workload runs as.

If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the
project will be used. See
<https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent>
Users starting the pipeline must have the `iam.serviceAccounts.actAs`
permission on this service account.

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

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

### getEvaluateDatasetRuns

Output only. Evaluation runs for the Tuning Job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-ai-platform/latest/V1.EvaluateDatasetRun>` |   |

### setEvaluateDatasetRuns

Output only. Evaluation runs for the Tuning Job.

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

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

### getSourceModel

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### getTuningSpec

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |