Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/com/google/genai/Tunings.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ ObjectNode createTuningJobConfigToMldev(
throw new IllegalArgumentException("outputUri parameter is not supported in Gemini API.");
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}))) {
throw new IllegalArgumentException(
"encryptionSpec parameter is not supported in Gemini API.");
}

return toObject;
}

Expand Down Expand Up @@ -532,6 +537,13 @@ ObjectNode createTuningJobConfigToVertex(
Common.getValueByPath(fromObject, new String[] {"outputUri"}));
}

if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) {
Common.setValueByPath(
parentObject,
new String[] {"encryptionSpec"},
Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}));
}

return toObject;
}

Expand Down
40 changes: 40 additions & 0 deletions src/main/java/com/google/genai/types/CreateTuningJobConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ public abstract class CreateTuningJobConfig extends JsonSerializable {
@JsonProperty("outputUri")
public abstract Optional<String> outputUri();

/**
* The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob.
* If this is set, then all resources created by the TuningJob will be encrypted with provided
* encryption key.
*/
@JsonProperty("encryptionSpec")
public abstract Optional<EncryptionSpec> encryptionSpec();

/** Instantiates a builder for CreateTuningJobConfig. */
@ExcludeFromGeneratedCoverageReport
public static Builder builder() {
Expand Down Expand Up @@ -640,6 +648,38 @@ public Builder clearOutputUri() {
return outputUri(Optional.empty());
}

/**
* Setter for encryptionSpec.
*
* <p>encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key
* options for a TuningJob. If this is set, then all resources created by the TuningJob will be
* encrypted with provided encryption key.
*/
@JsonProperty("encryptionSpec")
public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec);

/**
* Setter for encryptionSpec builder.
*
* <p>encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key
* options for a TuningJob. If this is set, then all resources created by the TuningJob will be
* encrypted with provided encryption key.
*/
@CanIgnoreReturnValue
public Builder encryptionSpec(EncryptionSpec.Builder encryptionSpecBuilder) {
return encryptionSpec(encryptionSpecBuilder.build());
}

@ExcludeFromGeneratedCoverageReport
abstract Builder encryptionSpec(Optional<EncryptionSpec> encryptionSpec);

/** Clears the value of encryptionSpec field. */
@ExcludeFromGeneratedCoverageReport
@CanIgnoreReturnValue
public Builder clearEncryptionSpec() {
return encryptionSpec(Optional.empty());
}

public abstract CreateTuningJobConfig build();
}

Expand Down