Table of Contents

Class TuningJob

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

A tuning job.

public record TuningJob : IEquatable<TuningJob>
Inheritance
TuningJob
Implements
Inherited Members

Properties

BaseModel

[JsonPropertyName("baseModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BaseModel { get; set; }

Property Value

string

CreateTime

Output only. Time when the TuningJob was created.

[JsonPropertyName("createTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? CreateTime { get; set; }

Property Value

DateTime?

CustomBaseModel

Optional. The user-provided path to custom model weights. Set this field to tune a custom model. The path must be a Cloud Storage directory that contains the model weights in .safetensors format along with associated model metadata files. If this field is set, the base_model field must still be set to indicate which base model the custom model is derived from. This feature is only available for open source models.

[JsonPropertyName("customBaseModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CustomBaseModel { get; set; }

Property Value

string

Description

Optional. The description of the TuningJob.

[JsonPropertyName("description")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Description { get; set; }

Property Value

string

DistillationSamplingSpec

[JsonPropertyName("distillationSamplingSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DistillationSamplingSpec? DistillationSamplingSpec { get; set; }

Property Value

DistillationSamplingSpec

DistillationSpec

Tuning Spec for Distillation.

[JsonPropertyName("distillationSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DistillationSpec? DistillationSpec { get; set; }

Property Value

DistillationSpec

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.

[JsonPropertyName("encryptionSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public EncryptionSpec? EncryptionSpec { get; set; }

Property Value

EncryptionSpec

EndTime

Output only. Time when the TuningJob entered any of the following JobStates: JOB_STATE_SUCCEEDED, JOB_STATE_FAILED, JOB_STATE_CANCELLED, JOB_STATE_EXPIRED.

[JsonPropertyName("endTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? EndTime { get; set; }

Property Value

DateTime?

Error

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

[JsonPropertyName("error")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GoogleRpcStatus? Error { get; set; }

Property Value

GoogleRpcStatus

EvaluateDatasetRuns

Output only. Evaluation runs for the Tuning Job.

[JsonPropertyName("evaluateDatasetRuns")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<EvaluateDatasetRun>? EvaluateDatasetRuns { get; set; }

Property Value

List<EvaluateDatasetRun>

Experiment

Output only. The Experiment associated with this TuningJob.

[JsonPropertyName("experiment")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Experiment { get; set; }

Property Value

string

FullFineTuningSpec

Tuning Spec for Full Fine Tuning.

[JsonPropertyName("fullFineTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public FullFineTuningSpec? FullFineTuningSpec { get; set; }

Property Value

FullFineTuningSpec

Labels

Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and 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.

[JsonPropertyName("labels")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string>? Labels { get; set; }

Property Value

Dictionary<string, string>

Name

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

[JsonPropertyName("name")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Name { get; set; }

Property Value

string

OutputUri

Optional. Cloud Storage path to the directory where tuning job outputs are written to. This field is only available and required for open source models.

[JsonPropertyName("outputUri")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? OutputUri { get; set; }

Property Value

string

PartnerModelTuningSpec

Tuning Spec for open sourced and third party Partner models.

[JsonPropertyName("partnerModelTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PartnerModelTuningSpec? PartnerModelTuningSpec { get; set; }

Property Value

PartnerModelTuningSpec

PipelineJob

Output only. The resource name of the PipelineJob associated with the TuningJob. Format: projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}.

[JsonPropertyName("pipelineJob")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? PipelineJob { get; set; }

Property Value

string

PreTunedModel

The pre-tuned model for continuous tuning.

[JsonPropertyName("preTunedModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PreTunedModel? PreTunedModel { get; set; }

Property Value

PreTunedModel

PreferenceOptimizationSpec

Tuning Spec for Preference Optimization.

[JsonPropertyName("preferenceOptimizationSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PreferenceOptimizationSpec? PreferenceOptimizationSpec { get; set; }

Property Value

PreferenceOptimizationSpec

ReinforcementTuningSpec

[JsonPropertyName("reinforcementTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ReinforcementTuningSpec? ReinforcementTuningSpec { get; set; }

Property Value

ReinforcementTuningSpec

SdkHttpResponse

Used to retain the full HTTP response.

[JsonPropertyName("sdkHttpResponse")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpResponse? SdkHttpResponse { get; set; }

Property Value

HttpResponse

ServiceAccount

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.

[JsonPropertyName("serviceAccount")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ServiceAccount { get; set; }

Property Value

string

StartTime

Output only. Time when the TuningJob for the first time entered the JOB_STATE_RUNNING state.

[JsonPropertyName("startTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? StartTime { get; set; }

Property Value

DateTime?

State

Output only. The detailed state of the job.

[JsonPropertyName("state")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public JobState? State { get; set; }

Property Value

JobState?

SupervisedTuningSpec

Tuning Spec for Supervised Fine Tuning.

[JsonPropertyName("supervisedTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SupervisedTuningSpec? SupervisedTuningSpec { get; set; }

Property Value

SupervisedTuningSpec

TunedModel

Output only. The tuned model resources associated with this TuningJob.

[JsonPropertyName("tunedModel")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TunedModel? TunedModel { get; set; }

Property Value

TunedModel

TunedModelDisplayName

Optional. The display name of the TunedModel. 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.

[JsonPropertyName("tunedModelDisplayName")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TunedModelDisplayName { get; set; }

Property Value

string

TuningDataStats

Output only. The tuning data statistics associated with this TuningJob.

[JsonPropertyName("tuningDataStats")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningDataStats? TuningDataStats { get; set; }

Property Value

TuningDataStats

TuningJobMetadata

Output only. Tuning Job metadata.

[JsonPropertyName("tuningJobMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningJobMetadata? TuningJobMetadata { get; set; }

Property Value

TuningJobMetadata

TuningJobState

Output only. The detail state of the tuning job (while the overall JobState is running).

[JsonPropertyName("tuningJobState")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningJobState? TuningJobState { get; set; }

Property Value

TuningJobState?

UpdateTime

Output only. Time when the TuningJob was most recently updated.

[JsonPropertyName("updateTime")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? UpdateTime { get; set; }

Property Value

DateTime?

VeoLoraTuningSpec

Tuning Spec for Veo LoRA Tuning.

[JsonPropertyName("veoLoraTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public VeoLoraTuningSpec? VeoLoraTuningSpec { get; set; }

Property Value

VeoLoraTuningSpec

VeoTuningSpec

Tuning Spec for Veo Tuning.

[JsonPropertyName("veoTuningSpec")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public VeoTuningSpec? VeoTuningSpec { get; set; }

Property Value

VeoTuningSpec

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a TuningJob object.

public static TuningJob? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

TuningJob

The deserialized TuningJob object, or null if deserialization fails.