diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index 8bcff49f15a..14c0c9dae81 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -1027,7 +1027,6 @@ ObjectNode embedContentBatchToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode embedContentConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { Common.setValueByPath( parentObject, diff --git a/src/main/java/com/google/genai/Caches.java b/src/main/java/com/google/genai/Caches.java index e760b8cb688..b14cc2d9c9f 100644 --- a/src/main/java/com/google/genai/Caches.java +++ b/src/main/java/com/google/genai/Caches.java @@ -135,6 +135,32 @@ ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"outcome"}, + Common.getValueByPath(fromObject, new String[] {"outcome"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"output"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"output"}, + Common.getValueByPath(fromObject, new String[] {"output"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -444,6 +470,32 @@ ObjectNode deleteCachedContentResponseFromVertex(JsonNode fromObject, ObjectNode return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode executableCodeToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"code"}, + Common.getValueByPath(fromObject, new String[] {"code"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"language"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"language"}, + Common.getValueByPath(fromObject, new String[] {"language"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -870,14 +922,20 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"codeExecutionResult"}, - Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + codeExecutionResultToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { Common.setValueByPath( toObject, new String[] {"executableCode"}, - Common.getValueByPath(fromObject, new String[] {"executableCode"})); + executableCodeToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"executableCode"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 2e478a20cf3..f9c891a07f6 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -119,6 +119,32 @@ ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"outcome"}, + Common.getValueByPath(fromObject, new String[] {"outcome"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"output"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"output"}, + Common.getValueByPath(fromObject, new String[] {"output"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -167,6 +193,32 @@ ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode executableCodeToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"code"}, + Common.getValueByPath(fromObject, new String[] {"code"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"language"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"language"}, + Common.getValueByPath(fromObject, new String[] {"language"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1761,14 +1813,20 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"codeExecutionResult"}, - Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + codeExecutionResultToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { Common.setValueByPath( toObject, new String[] {"executableCode"}, - Common.getValueByPath(fromObject, new String[] {"executableCode"})); + executableCodeToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"executableCode"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 324156777ca..75299143d9e 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -314,6 +314,33 @@ ObjectNode citationMetadataFromMldev( return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode codeExecutionResultToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"outcome"}, + Common.getValueByPath(fromObject, new String[] {"outcome"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"output"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"output"}, + Common.getValueByPath(fromObject, new String[] {"output"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode computeTokensParametersToVertex( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { @@ -929,7 +956,6 @@ ObjectNode editImageResponseFromVertex( ObjectNode embedContentConfigToMldev( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { Common.setValueByPath( parentObject, @@ -1320,6 +1346,33 @@ ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject, Json return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode executableCodeToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"code"}, + Common.getValueByPath(fromObject, new String[] {"code"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"language"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"language"}, + Common.getValueByPath(fromObject, new String[] {"language"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"id"}))) { + throw new IllegalArgumentException( + "id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise" + + " Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -4269,14 +4322,22 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.setValueByPath( toObject, new String[] {"codeExecutionResult"}, - Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + codeExecutionResultToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})), + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { Common.setValueByPath( toObject, new String[] {"executableCode"}, - Common.getValueByPath(fromObject, new String[] {"executableCode"})); + executableCodeToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"executableCode"})), + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index fb79ae7ec49..4ef98a08e4b 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -1594,18 +1594,18 @@ ObjectNode tuningJobFromVertex( Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"})); } - if (Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"}) != null) { Common.setValueByPath( toObject, - new String[] {"distillationSamplingSpec"}, - Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"})); + new String[] {"tuningJobMetadata"}, + Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"veoLoraTuningSpec"}) != null) { Common.setValueByPath( toObject, - new String[] {"tuningJobMetadata"}, - Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"})); + new String[] {"veoLoraTuningSpec"}, + Common.getValueByPath(fromObject, new String[] {"veoLoraTuningSpec"})); } return toObject; diff --git a/src/main/java/com/google/genai/types/CodeExecutionResult.java b/src/main/java/com/google/genai/types/CodeExecutionResult.java index 93c86706b1b..154aaf14b5a 100644 --- a/src/main/java/com/google/genai/types/CodeExecutionResult.java +++ b/src/main/java/com/google/genai/types/CodeExecutionResult.java @@ -26,11 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** - * Result of executing the `ExecutableCode`. - * - *

Generated only when the `CodeExecution` tool is used. - */ +/** Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used. */ @AutoValue @JsonDeserialize(builder = CodeExecutionResult.Builder.class) public abstract class CodeExecutionResult extends JsonSerializable { @@ -46,8 +42,8 @@ public abstract class CodeExecutionResult extends JsonSerializable { public abstract Optional output(); /** - * The identifier of the `ExecutableCode` part this result is for. Only populated if the - * corresponding `ExecutableCode` has an id. + * Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the + * corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI. */ @JsonProperty("id") public abstract Optional id(); @@ -130,8 +126,9 @@ public Builder clearOutput() { /** * Setter for id. * - *

id: The identifier of the `ExecutableCode` part this result is for. Only populated if the - * corresponding `ExecutableCode` has an id. + *

id: Optional. The identifier of the `ExecutableCode` part this result is for. Only + * populated if the corresponding `ExecutableCode` has an id. This field is not supported in + * Vertex AI. */ @JsonProperty("id") public abstract Builder id(String id); diff --git a/src/main/java/com/google/genai/types/DistillationHyperParameters.java b/src/main/java/com/google/genai/types/DistillationHyperParameters.java index 8275f6ad40b..c185dff2208 100644 --- a/src/main/java/com/google/genai/types/DistillationHyperParameters.java +++ b/src/main/java/com/google/genai/types/DistillationHyperParameters.java @@ -27,7 +27,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Hyperparameters for distillation. */ +/** Hyperparameters for Distillation. This data type is not supported in Gemini API. */ @AutoValue @InternalApi @JsonDeserialize(builder = DistillationHyperParameters.Builder.class) @@ -47,16 +47,16 @@ public abstract class DistillationHyperParameters extends JsonSerializable { @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); - /** - * The batch size hyperparameter for tuning. This is only supported for OSS models in Gemini - * Enterprise Agent Platform. - */ + /** Optional. Batch size for tuning. This feature is only available for open source models. */ @JsonProperty("batchSize") - public abstract Optional batchSize(); + public abstract Optional batchSize(); - /** The learning rate for tuning. OSS models only. */ + /** + * Optional. Specifies the learning rate for tuning. Mutually exclusive with + * `learning_rate_multiplier`. This feature is only available for open source models. + */ @JsonProperty("learningRate") - public abstract Optional learningRate(); + public abstract Optional learningRate(); /** Instantiates a builder for DistillationHyperParameters. */ @ExcludeFromGeneratedCoverageReport @@ -154,14 +154,14 @@ public Builder clearLearningRateMultiplier() { /** * Setter for batchSize. * - *

batchSize: The batch size hyperparameter for tuning. This is only supported for OSS models - * in Gemini Enterprise Agent Platform. + *

batchSize: Optional. Batch size for tuning. This feature is only available for open source + * models. */ @JsonProperty("batchSize") - public abstract Builder batchSize(Integer batchSize); + public abstract Builder batchSize(Long batchSize); @ExcludeFromGeneratedCoverageReport - abstract Builder batchSize(Optional batchSize); + abstract Builder batchSize(Optional batchSize); /** Clears the value of batchSize field. */ @ExcludeFromGeneratedCoverageReport @@ -173,13 +173,14 @@ public Builder clearBatchSize() { /** * Setter for learningRate. * - *

learningRate: The learning rate for tuning. OSS models only. + *

learningRate: Optional. Specifies the learning rate for tuning. Mutually exclusive with + * `learning_rate_multiplier`. This feature is only available for open source models. */ @JsonProperty("learningRate") - public abstract Builder learningRate(Float learningRate); + public abstract Builder learningRate(Double learningRate); @ExcludeFromGeneratedCoverageReport - abstract Builder learningRate(Optional learningRate); + abstract Builder learningRate(Optional learningRate); /** Clears the value of learningRate field. */ @ExcludeFromGeneratedCoverageReport diff --git a/src/main/java/com/google/genai/types/DistillationSamplingSpec.java b/src/main/java/com/google/genai/types/DistillationSamplingSpec.java deleted file mode 100644 index 94ec3ceaa84..00000000000 --- a/src/main/java/com/google/genai/types/DistillationSamplingSpec.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Auto-generated code. Do not edit. - -package com.google.genai.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.google.auto.value.AutoValue; -import com.google.errorprone.annotations.CanIgnoreReturnValue; -import com.google.genai.JsonSerializable; -import java.util.Optional; - -/** - * Spec for creating a distilled dataset in Vertex Dataset. This data type is not supported in - * Gemini API. - */ -@AutoValue -@JsonDeserialize(builder = DistillationSamplingSpec.Builder.class) -public abstract class DistillationSamplingSpec extends JsonSerializable { - /** - * Optional. The base teacher model that is being distilled. See [Supported - * models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). - */ - @JsonProperty("baseTeacherModel") - public abstract Optional baseTeacherModel(); - - /** - * Optional. The resource name of the Tuned teacher model. Format: - * `projects/{project}/locations/{location}/models/{model}`. - */ - @JsonProperty("tunedTeacherModelSource") - public abstract Optional tunedTeacherModelSource(); - - /** - * Optional. Cloud Storage path to file containing validation dataset for distillation. The - * dataset must be formatted as a JSONL file. - */ - @JsonProperty("validationDatasetUri") - public abstract Optional validationDatasetUri(); - - /** Instantiates a builder for DistillationSamplingSpec. */ - @ExcludeFromGeneratedCoverageReport - public static Builder builder() { - return new AutoValue_DistillationSamplingSpec.Builder(); - } - - /** Creates a builder with the same values as this instance. */ - public abstract Builder toBuilder(); - - /** Builder for DistillationSamplingSpec. */ - @AutoValue.Builder - public abstract static class Builder { - /** For internal usage. Please use `DistillationSamplingSpec.builder()` for instantiation. */ - @JsonCreator - private static Builder create() { - return new AutoValue_DistillationSamplingSpec.Builder(); - } - - /** - * Setter for baseTeacherModel. - * - *

baseTeacherModel: Optional. The base teacher model that is being distilled. See [Supported - * models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). - */ - @JsonProperty("baseTeacherModel") - public abstract Builder baseTeacherModel(String baseTeacherModel); - - @ExcludeFromGeneratedCoverageReport - abstract Builder baseTeacherModel(Optional baseTeacherModel); - - /** Clears the value of baseTeacherModel field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearBaseTeacherModel() { - return baseTeacherModel(Optional.empty()); - } - - /** - * Setter for tunedTeacherModelSource. - * - *

tunedTeacherModelSource: Optional. The resource name of the Tuned teacher model. Format: - * `projects/{project}/locations/{location}/models/{model}`. - */ - @JsonProperty("tunedTeacherModelSource") - public abstract Builder tunedTeacherModelSource(String tunedTeacherModelSource); - - @ExcludeFromGeneratedCoverageReport - abstract Builder tunedTeacherModelSource(Optional tunedTeacherModelSource); - - /** Clears the value of tunedTeacherModelSource field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearTunedTeacherModelSource() { - return tunedTeacherModelSource(Optional.empty()); - } - - /** - * Setter for validationDatasetUri. - * - *

validationDatasetUri: Optional. Cloud Storage path to file containing validation dataset - * for distillation. The dataset must be formatted as a JSONL file. - */ - @JsonProperty("validationDatasetUri") - public abstract Builder validationDatasetUri(String validationDatasetUri); - - @ExcludeFromGeneratedCoverageReport - abstract Builder validationDatasetUri(Optional validationDatasetUri); - - /** Clears the value of validationDatasetUri field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearValidationDatasetUri() { - return validationDatasetUri(Optional.empty()); - } - - public abstract DistillationSamplingSpec build(); - } - - /** Deserializes a JSON string to a DistillationSamplingSpec object. */ - @ExcludeFromGeneratedCoverageReport - public static DistillationSamplingSpec fromJson(String jsonString) { - return JsonSerializable.fromJsonString(jsonString, DistillationSamplingSpec.class); - } -} diff --git a/src/main/java/com/google/genai/types/DistillationSpec.java b/src/main/java/com/google/genai/types/DistillationSpec.java index d4780ab5170..9f55b8f88aa 100644 --- a/src/main/java/com/google/genai/types/DistillationSpec.java +++ b/src/main/java/com/google/genai/types/DistillationSpec.java @@ -30,7 +30,10 @@ @AutoValue @JsonDeserialize(builder = DistillationSpec.Builder.class) public abstract class DistillationSpec extends JsonSerializable { - /** The GCS URI of the prompt dataset to use during distillation. */ + /** + * Optional. Cloud Storage path to file containing prompt dataset for distillation. The dataset + * must be formatted as a JSONL file. + */ @JsonProperty("promptDatasetUri") public abstract Optional promptDatasetUri(); @@ -81,7 +84,10 @@ public abstract class DistillationSpec extends JsonSerializable { @JsonProperty("validationDatasetUri") public abstract Optional validationDatasetUri(); - /** Tuning mode for tuning. */ + /** + * Optional. Specifies the tuning mode for distillation (sft part). This feature is only available + * for open source models. + */ @JsonProperty("tuningMode") public abstract Optional tuningMode(); @@ -106,7 +112,8 @@ private static Builder create() { /** * Setter for promptDatasetUri. * - *

promptDatasetUri: The GCS URI of the prompt dataset to use during distillation. + *

promptDatasetUri: Optional. Cloud Storage path to file containing prompt dataset for + * distillation. The dataset must be formatted as a JSONL file. */ @JsonProperty("promptDatasetUri") public abstract Builder promptDatasetUri(String promptDatasetUri); @@ -267,7 +274,8 @@ public Builder clearValidationDatasetUri() { /** * Setter for tuningMode. * - *

tuningMode: Tuning mode for tuning. + *

tuningMode: Optional. Specifies the tuning mode for distillation (sft part). This feature + * is only available for open source models. */ @JsonProperty("tuningMode") public abstract Builder tuningMode(TuningMode tuningMode); @@ -285,7 +293,8 @@ public Builder clearTuningMode() { /** * Setter for tuningMode given a known enum. * - *

tuningMode: Tuning mode for tuning. + *

tuningMode: Optional. Specifies the tuning mode for distillation (sft part). This feature + * is only available for open source models. */ @CanIgnoreReturnValue public Builder tuningMode(TuningMode.Known knownType) { @@ -295,7 +304,8 @@ public Builder tuningMode(TuningMode.Known knownType) { /** * Setter for tuningMode given a string. * - *

tuningMode: Tuning mode for tuning. + *

tuningMode: Optional. Specifies the tuning mode for distillation (sft part). This feature + * is only available for open source models. */ @CanIgnoreReturnValue public Builder tuningMode(String tuningMode) { diff --git a/src/main/java/com/google/genai/types/EmbedContentConfig.java b/src/main/java/com/google/genai/types/EmbedContentConfig.java index 1f50e4729dc..2a600f22aec 100644 --- a/src/main/java/com/google/genai/types/EmbedContentConfig.java +++ b/src/main/java/com/google/genai/types/EmbedContentConfig.java @@ -30,10 +30,6 @@ @AutoValue @JsonDeserialize(builder = EmbedContentConfig.Builder.class) public abstract class EmbedContentConfig extends JsonSerializable { - /** Used to override HTTP request options. */ - @JsonProperty("httpOptions") - public abstract Optional httpOptions(); - /** Type of task for which the embedding will be used. */ @JsonProperty("taskType") public abstract Optional taskType(); @@ -76,6 +72,10 @@ public abstract class EmbedContentConfig extends JsonSerializable { @JsonProperty("audioTrackExtraction") public abstract Optional audioTrackExtraction(); + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + /** Instantiates a builder for EmbedContentConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -94,34 +94,6 @@ private static Builder create() { return new AutoValue_EmbedContentConfig.Builder(); } - /** - * Setter for httpOptions. - * - *

httpOptions: Used to override HTTP request options. - */ - @JsonProperty("httpOptions") - public abstract Builder httpOptions(HttpOptions httpOptions); - - /** - * Setter for httpOptions builder. - * - *

httpOptions: Used to override HTTP request options. - */ - @CanIgnoreReturnValue - public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { - return httpOptions(httpOptionsBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder httpOptions(Optional httpOptions); - - /** Clears the value of httpOptions field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearHttpOptions() { - return httpOptions(Optional.empty()); - } - /** * Setter for taskType. * @@ -254,6 +226,34 @@ public Builder clearAudioTrackExtraction() { return audioTrackExtraction(Optional.empty()); } + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + /** + * Setter for httpOptions builder. + * + *

httpOptions: Used to override HTTP request options. + */ + @CanIgnoreReturnValue + public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { + return httpOptions(httpOptionsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + public abstract EmbedContentConfig build(); } diff --git a/src/main/java/com/google/genai/types/EvaluationParserConfig.java b/src/main/java/com/google/genai/types/EvaluationParserConfig.java new file mode 100644 index 00000000000..15ef3c31b85 --- /dev/null +++ b/src/main/java/com/google/genai/types/EvaluationParserConfig.java @@ -0,0 +1,98 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Config for parsing LLM responses. It can be used to parse the LLM response to be evaluated, or + * the LLM response from LLM-based metrics/Autoraters. This data type is not supported in Gemini + * API. + */ +@AutoValue +@JsonDeserialize(builder = EvaluationParserConfig.Builder.class) +public abstract class EvaluationParserConfig extends JsonSerializable { + /** Optional. Use custom code to parse the LLM response. */ + @JsonProperty("customCodeParserConfig") + public abstract Optional customCodeParserConfig(); + + /** Instantiates a builder for EvaluationParserConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationParserConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationParserConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationParserConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationParserConfig.Builder(); + } + + /** + * Setter for customCodeParserConfig. + * + *

customCodeParserConfig: Optional. Use custom code to parse the LLM response. + */ + @JsonProperty("customCodeParserConfig") + public abstract Builder customCodeParserConfig( + EvaluationParserConfigCustomCodeParserConfig customCodeParserConfig); + + /** + * Setter for customCodeParserConfig builder. + * + *

customCodeParserConfig: Optional. Use custom code to parse the LLM response. + */ + @CanIgnoreReturnValue + public Builder customCodeParserConfig( + EvaluationParserConfigCustomCodeParserConfig.Builder customCodeParserConfigBuilder) { + return customCodeParserConfig(customCodeParserConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customCodeParserConfig( + Optional customCodeParserConfig); + + /** Clears the value of customCodeParserConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomCodeParserConfig() { + return customCodeParserConfig(Optional.empty()); + } + + public abstract EvaluationParserConfig build(); + } + + /** Deserializes a JSON string to a EvaluationParserConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationParserConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationParserConfig.class); + } +} diff --git a/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java b/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java new file mode 100644 index 00000000000..f7705c96604 --- /dev/null +++ b/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Configuration for parsing the LLM response using custom code. This data type is not supported in + * Gemini API. + */ +@AutoValue +@JsonDeserialize(builder = EvaluationParserConfigCustomCodeParserConfig.Builder.class) +public abstract class EvaluationParserConfigCustomCodeParserConfig extends JsonSerializable { + /** + * Required. Python function for parsing results. The function should be defined within this + * string. The function takes a list of strings (LLM responses) and should return either a list of + * dictionaries (for rubrics) or a single dictionary (for a metric result). Example function + * signature: def parse(responses: list[str]) -> list[dict[str, Any]] | dict[str, Any]: When + * parsing rubrics, return a list of dictionaries, where each dictionary represents a Rubric. + * Example for rubrics: [ { "content": {"property": {"description": "The response is factual."}}, + * "type": "FACTUALITY", "importance": "HIGH" }, { "content": {"property": {"description": "The + * response is fluent."}}, "type": "FLUENCY", "importance": "MEDIUM" } ] When parsing critique + * results, return a dictionary representing a MetricResult. Example for a metric result: { + * "score": 0.8, "explanation": "The model followed most instructions.", "rubric_verdicts": [...] + * } ... code for result extraction and aggregation + */ + @JsonProperty("parsingFunction") + public abstract Optional parsingFunction(); + + /** Instantiates a builder for EvaluationParserConfigCustomCodeParserConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationParserConfigCustomCodeParserConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationParserConfigCustomCodeParserConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `EvaluationParserConfigCustomCodeParserConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationParserConfigCustomCodeParserConfig.Builder(); + } + + /** + * Setter for parsingFunction. + * + *

parsingFunction: Required. Python function for parsing results. The function should be + * defined within this string. The function takes a list of strings (LLM responses) and should + * return either a list of dictionaries (for rubrics) or a single dictionary (for a metric + * result). Example function signature: def parse(responses: list[str]) -> list[dict[str, Any]] + * | dict[str, Any]: When parsing rubrics, return a list of dictionaries, where each dictionary + * represents a Rubric. Example for rubrics: [ { "content": {"property": {"description": "The + * response is factual."}}, "type": "FACTUALITY", "importance": "HIGH" }, { "content": + * {"property": {"description": "The response is fluent."}}, "type": "FLUENCY", "importance": + * "MEDIUM" } ] When parsing critique results, return a dictionary representing a MetricResult. + * Example for a metric result: { "score": 0.8, "explanation": "The model followed most + * instructions.", "rubric_verdicts": [...] } ... code for result extraction and aggregation + */ + @JsonProperty("parsingFunction") + public abstract Builder parsingFunction(String parsingFunction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder parsingFunction(Optional parsingFunction); + + /** Clears the value of parsingFunction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearParsingFunction() { + return parsingFunction(Optional.empty()); + } + + public abstract EvaluationParserConfigCustomCodeParserConfig build(); + } + + /** Deserializes a JSON string to a EvaluationParserConfigCustomCodeParserConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationParserConfigCustomCodeParserConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, EvaluationParserConfigCustomCodeParserConfig.class); + } +} diff --git a/src/main/java/com/google/genai/types/ExecutableCode.java b/src/main/java/com/google/genai/types/ExecutableCode.java index 0f2dcd27868..f28d0506cd8 100644 --- a/src/main/java/com/google/genai/types/ExecutableCode.java +++ b/src/main/java/com/google/genai/types/ExecutableCode.java @@ -27,10 +27,9 @@ import java.util.Optional; /** - * Model-generated code executed server-side, results returned to the model. - * - *

Only generated when using the `CodeExecution` tool, in which the code will be automatically - * executed, and a corresponding `CodeExecutionResult` will also be generated. + * Code generated by the model that is meant to be executed, and the result returned to the model. + * Generated when using the `CodeExecution` tool, in which the code will be automatically executed, + * and a corresponding CodeExecutionResult will also be generated. */ @AutoValue @JsonDeserialize(builder = ExecutableCode.Builder.class) @@ -44,8 +43,8 @@ public abstract class ExecutableCode extends JsonSerializable { public abstract Optional language(); /** - * Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` - * with the matching `id`. + * Optional. Unique identifier of the `ExecutableCode` part. The server returns the + * `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI. */ @JsonProperty("id") public abstract Optional id(); @@ -127,8 +126,8 @@ public Builder language(String language) { /** * Setter for id. * - *

id: Unique identifier of the `ExecutableCode` part. The server returns the - * `CodeExecutionResult` with the matching `id`. + *

id: Optional. Unique identifier of the `ExecutableCode` part. The server returns the + * `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI. */ @JsonProperty("id") public abstract Builder id(String id); diff --git a/src/main/java/com/google/genai/types/FileSearchStore.java b/src/main/java/com/google/genai/types/FileSearchStore.java index 087dd25a24a..21799ee1200 100644 --- a/src/main/java/com/google/genai/types/FileSearchStore.java +++ b/src/main/java/com/google/genai/types/FileSearchStore.java @@ -32,38 +32,49 @@ @JsonDeserialize(builder = FileSearchStore.Builder.class) public abstract class FileSearchStore extends JsonSerializable { /** - * The resource name of the FileSearchStore. Example: `fileSearchStores/my-file-search-store-123` + * Output only. Immutable. Identifier. The `FileSearchStore` resource name. It is an ID (name + * excluding the "fileSearchStores/" prefix) that can contain up to 40 characters that are + * lowercase alphanumeric or dashes (-). It is output only. The unique name will be derived from + * `display_name` along with a 12 character random suffix. Example: + * `fileSearchStores/my-awesome-file-search-store-123a456b789c` If `display_name` is not provided, + * the name will be randomly generated. */ @JsonProperty("name") public abstract Optional name(); - /** The human-readable display name for the FileSearchStore. */ + /** + * Optional. The human-readable display name for the `FileSearchStore`. The display name must be + * no more than 512 characters in length, including spaces. Example: "Docs on Semantic Retriever". + */ @JsonProperty("displayName") public abstract Optional displayName(); - /** The Timestamp of when the FileSearchStore was created. */ + /** Output only. The Timestamp of when the `FileSearchStore` was created. */ @JsonProperty("createTime") public abstract Optional createTime(); - /** The Timestamp of when the FileSearchStore was last updated. */ + /** Output only. The Timestamp of when the `FileSearchStore` was last updated. */ @JsonProperty("updateTime") public abstract Optional updateTime(); - /** The number of documents in the FileSearchStore that are active and ready for retrieval. */ + /** + * Output only. The number of documents in the `FileSearchStore` that are active and ready for + * retrieval. + */ @JsonProperty("activeDocumentsCount") public abstract Optional activeDocumentsCount(); - /** The number of documents in the FileSearchStore that are being processed. */ + /** Output only. The number of documents in the `FileSearchStore` that are being processed. */ @JsonProperty("pendingDocumentsCount") public abstract Optional pendingDocumentsCount(); - /** The number of documents in the FileSearchStore that have failed processing. */ + /** Output only. The number of documents in the `FileSearchStore` that have failed processing. */ @JsonProperty("failedDocumentsCount") public abstract Optional failedDocumentsCount(); /** - * The size of raw bytes ingested into the FileSearchStore. This is the total size of all the - * documents in the FileSearchStore. + * Output only. The size of raw bytes ingested into the `FileSearchStore`. This is the total size + * of all the documents in the `FileSearchStore`. */ @JsonProperty("sizeBytes") public abstract Optional sizeBytes(); @@ -93,8 +104,12 @@ private static Builder create() { /** * Setter for name. * - *

name: The resource name of the FileSearchStore. Example: - * `fileSearchStores/my-file-search-store-123` + *

name: Output only. Immutable. Identifier. The `FileSearchStore` resource name. It is an ID + * (name excluding the "fileSearchStores/" prefix) that can contain up to 40 characters that are + * lowercase alphanumeric or dashes (-). It is output only. The unique name will be derived from + * `display_name` along with a 12 character random suffix. Example: + * `fileSearchStores/my-awesome-file-search-store-123a456b789c` If `display_name` is not + * provided, the name will be randomly generated. */ @JsonProperty("name") public abstract Builder name(String name); @@ -112,7 +127,9 @@ public Builder clearName() { /** * Setter for displayName. * - *

displayName: The human-readable display name for the FileSearchStore. + *

displayName: Optional. The human-readable display name for the `FileSearchStore`. The + * display name must be no more than 512 characters in length, including spaces. Example: "Docs + * on Semantic Retriever". */ @JsonProperty("displayName") public abstract Builder displayName(String displayName); @@ -130,7 +147,7 @@ public Builder clearDisplayName() { /** * Setter for createTime. * - *

createTime: The Timestamp of when the FileSearchStore was created. + *

createTime: Output only. The Timestamp of when the `FileSearchStore` was created. */ @JsonProperty("createTime") public abstract Builder createTime(Instant createTime); @@ -148,7 +165,7 @@ public Builder clearCreateTime() { /** * Setter for updateTime. * - *

updateTime: The Timestamp of when the FileSearchStore was last updated. + *

updateTime: Output only. The Timestamp of when the `FileSearchStore` was last updated. */ @JsonProperty("updateTime") public abstract Builder updateTime(Instant updateTime); @@ -166,8 +183,8 @@ public Builder clearUpdateTime() { /** * Setter for activeDocumentsCount. * - *

activeDocumentsCount: The number of documents in the FileSearchStore that are active and - * ready for retrieval. + *

activeDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * are active and ready for retrieval. */ @JsonProperty("activeDocumentsCount") public abstract Builder activeDocumentsCount(Long activeDocumentsCount); @@ -185,8 +202,8 @@ public Builder clearActiveDocumentsCount() { /** * Setter for pendingDocumentsCount. * - *

pendingDocumentsCount: The number of documents in the FileSearchStore that are being - * processed. + *

pendingDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * are being processed. */ @JsonProperty("pendingDocumentsCount") public abstract Builder pendingDocumentsCount(Long pendingDocumentsCount); @@ -204,8 +221,8 @@ public Builder clearPendingDocumentsCount() { /** * Setter for failedDocumentsCount. * - *

failedDocumentsCount: The number of documents in the FileSearchStore that have failed - * processing. + *

failedDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * have failed processing. */ @JsonProperty("failedDocumentsCount") public abstract Builder failedDocumentsCount(Long failedDocumentsCount); @@ -223,8 +240,8 @@ public Builder clearFailedDocumentsCount() { /** * Setter for sizeBytes. * - *

sizeBytes: The size of raw bytes ingested into the FileSearchStore. This is the total size - * of all the documents in the FileSearchStore. + *

sizeBytes: Output only. The size of raw bytes ingested into the `FileSearchStore`. This is + * the total size of all the documents in the `FileSearchStore`. */ @JsonProperty("sizeBytes") public abstract Builder sizeBytes(Long sizeBytes); diff --git a/src/main/java/com/google/genai/types/FunctionCall.java b/src/main/java/com/google/genai/types/FunctionCall.java index be59f41872e..2e763946034 100644 --- a/src/main/java/com/google/genai/types/FunctionCall.java +++ b/src/main/java/com/google/genai/types/FunctionCall.java @@ -44,12 +44,12 @@ public abstract class FunctionCall extends JsonSerializable { /** * Optional. The function parameters and values in JSON object format. See - * [FunctionDeclaration.parameters] for parameter details. + * FunctionDeclaration.parameters for parameter details. */ @JsonProperty("args") public abstract Optional> args(); - /** Optional. The name of the function to call. Matches [FunctionDeclaration.name]. */ + /** Optional. The name of the function to call. Matches FunctionDeclaration.name. */ @JsonProperty("name") public abstract Optional name(); @@ -108,7 +108,7 @@ public Builder clearId() { * Setter for args. * *

args: Optional. The function parameters and values in JSON object format. See - * [FunctionDeclaration.parameters] for parameter details. + * FunctionDeclaration.parameters for parameter details. */ @JsonProperty("args") public abstract Builder args(Map args); @@ -126,7 +126,7 @@ public Builder clearArgs() { /** * Setter for name. * - *

name: Optional. The name of the function to call. Matches [FunctionDeclaration.name]. + *

name: Optional. The name of the function to call. Matches FunctionDeclaration.name. */ @JsonProperty("name") public abstract Builder name(String name); diff --git a/src/main/java/com/google/genai/types/FunctionCallingConfig.java b/src/main/java/com/google/genai/types/FunctionCallingConfig.java index f5b59242c95..f0be8974339 100644 --- a/src/main/java/com/google/genai/types/FunctionCallingConfig.java +++ b/src/main/java/com/google/genai/types/FunctionCallingConfig.java @@ -34,8 +34,8 @@ public abstract class FunctionCallingConfig extends JsonSerializable { /** * Optional. Function names to call. Only set when the Mode is ANY. Function names should match - * [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the - * set of function names provided. + * FunctionDeclaration.name. With mode set to ANY, model will predict a function call from the set + * of function names provided. */ @JsonProperty("allowedFunctionNames") public abstract Optional> allowedFunctionNames(); @@ -47,7 +47,7 @@ public abstract class FunctionCallingConfig extends JsonSerializable { /** * Optional. When set to true, arguments of a single function call will be streamed out in * multiple parts/contents/responses. Partial parameter results will be returned in the - * [FunctionCall.partial_args] field. This field is not supported in Gemini API. + * `FunctionCall.partial_args` field. This field is not supported in Gemini API. */ @JsonProperty("streamFunctionCallArguments") public abstract Optional streamFunctionCallArguments(); @@ -74,7 +74,7 @@ private static Builder create() { * Setter for allowedFunctionNames. * *

allowedFunctionNames: Optional. Function names to call. Only set when the Mode is ANY. - * Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will + * Function names should match FunctionDeclaration.name. With mode set to ANY, model will * predict a function call from the set of function names provided. */ @JsonProperty("allowedFunctionNames") @@ -84,7 +84,7 @@ private static Builder create() { * Setter for allowedFunctionNames. * *

allowedFunctionNames: Optional. Function names to call. Only set when the Mode is ANY. - * Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will + * Function names should match FunctionDeclaration.name. With mode set to ANY, model will * predict a function call from the set of function names provided. */ @CanIgnoreReturnValue @@ -145,7 +145,7 @@ public Builder mode(String mode) { * *

streamFunctionCallArguments: Optional. When set to true, arguments of a single function * call will be streamed out in multiple parts/contents/responses. Partial parameter results - * will be returned in the [FunctionCall.partial_args] field. This field is not supported in + * will be returned in the `FunctionCall.partial_args` field. This field is not supported in * Gemini API. */ @JsonProperty("streamFunctionCallArguments") diff --git a/src/main/java/com/google/genai/types/FunctionDeclaration.java b/src/main/java/com/google/genai/types/FunctionDeclaration.java index bd9e3c5f3ef..8048a062325 100644 --- a/src/main/java/com/google/genai/types/FunctionDeclaration.java +++ b/src/main/java/com/google/genai/types/FunctionDeclaration.java @@ -54,7 +54,7 @@ public abstract class FunctionDeclaration extends JsonSerializable { /** * Required. The name of the function to call. Must start with a letter or an underscore. Must be - * a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 64. + * a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 128. */ @JsonProperty("name") public abstract Optional name(); @@ -146,7 +146,7 @@ public Builder clearDescription() { * *

name: Required. The name of the function to call. Must start with a letter or an * underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a - * maximum length of 64. + * maximum length of 128. */ @JsonProperty("name") public abstract Builder name(String name); diff --git a/src/main/java/com/google/genai/types/FunctionResponse.java b/src/main/java/com/google/genai/types/FunctionResponse.java index caf7fbd4ace..570cb464641 100644 --- a/src/main/java/com/google/genai/types/FunctionResponse.java +++ b/src/main/java/com/google/genai/types/FunctionResponse.java @@ -68,8 +68,8 @@ public abstract class FunctionResponse extends JsonSerializable { public abstract Optional id(); /** - * Required. The name of the function to call. Matches [FunctionDeclaration.name] and - * [FunctionCall.name]. + * Required. The name of the function to call. Matches FunctionDeclaration.name and + * FunctionCall.name. */ @JsonProperty("name") public abstract Optional name(); @@ -231,8 +231,8 @@ public Builder clearId() { /** * Setter for name. * - *

name: Required. The name of the function to call. Matches [FunctionDeclaration.name] and - * [FunctionCall.name]. + *

name: Required. The name of the function to call. Matches FunctionDeclaration.name and + * FunctionCall.name. */ @JsonProperty("name") public abstract Builder name(String name); diff --git a/src/main/java/com/google/genai/types/GenerationConfig.java b/src/main/java/com/google/genai/types/GenerationConfig.java index 39d45fd4cd3..3ff624ff1dd 100644 --- a/src/main/java/com/google/genai/types/GenerationConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfig.java @@ -124,7 +124,7 @@ public abstract class GenerationConfig extends JsonSerializable { * Optional. The IANA standard MIME type of the response. The model will generate output that * conforms to this MIME type. Supported values include 'text/plain' (default) and * 'application/json'. The model needs to be prompted to output the appropriate response type, - * otherwise the behavior is undefined. This is a preview feature. + * otherwise the behavior is undefined. */ @JsonProperty("responseMimeType") public abstract Optional responseMimeType(); @@ -499,7 +499,7 @@ public Builder clearResponseLogprobs() { *

responseMimeType: Optional. The IANA standard MIME type of the response. The model will * generate output that conforms to this MIME type. Supported values include 'text/plain' * (default) and 'application/json'. The model needs to be prompted to output the appropriate - * response type, otherwise the behavior is undefined. This is a preview feature. + * response type, otherwise the behavior is undefined. */ @JsonProperty("responseMimeType") public abstract Builder responseMimeType(String responseMimeType); diff --git a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java index 15c56779b2a..53d5e1ded4c 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java +++ b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java @@ -79,11 +79,18 @@ public abstract class GroundingChunkRetrievedContext extends JsonSerializable { @JsonProperty("fileSearchStore") public abstract Optional fileSearchStore(); - /** Optional. Page number of the retrieved context. This field is not supported in Vertex AI. */ + /** + * Optional. Page number of the retrieved context, if applicable. This field is not supported in + * Vertex AI. + */ @JsonProperty("pageNumber") public abstract Optional pageNumber(); - /** Optional. Media ID. This field is not supported in Vertex AI. */ + /** + * Optional. The media blob resource name for multimodal file search results. Format: + * fileSearchStores/{file_search_store_id}/media/{blob_id}. This field is not supported in Vertex + * AI. + */ @JsonProperty("mediaId") public abstract Optional mediaId(); @@ -280,8 +287,8 @@ public Builder clearFileSearchStore() { /** * Setter for pageNumber. * - *

pageNumber: Optional. Page number of the retrieved context. This field is not supported in - * Vertex AI. + *

pageNumber: Optional. Page number of the retrieved context, if applicable. This field is + * not supported in Vertex AI. */ @JsonProperty("pageNumber") public abstract Builder pageNumber(Integer pageNumber); @@ -299,7 +306,9 @@ public Builder clearPageNumber() { /** * Setter for mediaId. * - *

mediaId: Optional. Media ID. This field is not supported in Vertex AI. + *

mediaId: Optional. The media blob resource name for multimodal file search results. + * Format: fileSearchStores/{file_search_store_id}/media/{blob_id}. This field is not supported + * in Vertex AI. */ @JsonProperty("mediaId") public abstract Builder mediaId(String mediaId); diff --git a/src/main/java/com/google/genai/types/LLMBasedMetricSpec.java b/src/main/java/com/google/genai/types/LLMBasedMetricSpec.java index b37d1797dab..e8ba2737b33 100644 --- a/src/main/java/com/google/genai/types/LLMBasedMetricSpec.java +++ b/src/main/java/com/google/genai/types/LLMBasedMetricSpec.java @@ -62,6 +62,10 @@ public abstract class LLMBasedMetricSpec extends JsonSerializable { @JsonProperty("additionalConfig") public abstract Optional> additionalConfig(); + /** Optional. The parser config for the metric result. */ + @JsonProperty("resultParserConfig") + public abstract Optional resultParserConfig(); + /** Instantiates a builder for LLMBasedMetricSpec. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -240,6 +244,34 @@ public Builder clearAdditionalConfig() { return additionalConfig(Optional.empty()); } + /** + * Setter for resultParserConfig. + * + *

resultParserConfig: Optional. The parser config for the metric result. + */ + @JsonProperty("resultParserConfig") + public abstract Builder resultParserConfig(EvaluationParserConfig resultParserConfig); + + /** + * Setter for resultParserConfig builder. + * + *

resultParserConfig: Optional. The parser config for the metric result. + */ + @CanIgnoreReturnValue + public Builder resultParserConfig(EvaluationParserConfig.Builder resultParserConfigBuilder) { + return resultParserConfig(resultParserConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder resultParserConfig(Optional resultParserConfig); + + /** Clears the value of resultParserConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResultParserConfig() { + return resultParserConfig(Optional.empty()); + } + public abstract LLMBasedMetricSpec build(); } diff --git a/src/main/java/com/google/genai/types/McpServer.java b/src/main/java/com/google/genai/types/McpServer.java index 7b6bd914b2f..04b7ad5c61f 100644 --- a/src/main/java/com/google/genai/types/McpServer.java +++ b/src/main/java/com/google/genai/types/McpServer.java @@ -28,7 +28,7 @@ /** * A MCPServer is a server that can be called by the model to perform actions. It is a server that - * implements the MCP protocol. Next ID: 5. This data type is not supported in Vertex AI. + * implements the MCP protocol. Next ID: 6. This data type is not supported in Vertex AI. */ @AutoValue @JsonDeserialize(builder = McpServer.Builder.class) diff --git a/src/main/java/com/google/genai/types/Outcome.java b/src/main/java/com/google/genai/types/Outcome.java index 1b07350fa1e..f5d108d4306 100644 --- a/src/main/java/com/google/genai/types/Outcome.java +++ b/src/main/java/com/google/genai/types/Outcome.java @@ -31,15 +31,15 @@ public enum Known { /** Unspecified status. This value should not be used. */ OUTCOME_UNSPECIFIED, - /** Code execution completed successfully. */ + /** Code execution completed successfully. `output` contains the stdout, if any. */ OUTCOME_OK, - /** Code execution finished but with a failure. `stderr` should contain the reason. */ + /** Code execution failed. `output` contains the stderr and stdout, if any. */ OUTCOME_FAILED, /** - * Code execution ran for too long, and was cancelled. There may or may not be a partial output - * present. + * Code execution ran for too long, and was cancelled. There may or may not be a partial + * `output` present. */ OUTCOME_DEADLINE_EXCEEDED } diff --git a/src/main/java/com/google/genai/types/RagChunk.java b/src/main/java/com/google/genai/types/RagChunk.java index 63a02726f40..fed311d1910 100644 --- a/src/main/java/com/google/genai/types/RagChunk.java +++ b/src/main/java/com/google/genai/types/RagChunk.java @@ -41,6 +41,14 @@ public abstract class RagChunk extends JsonSerializable { @JsonProperty("text") public abstract Optional text(); + /** The ID of the chunk. */ + @JsonProperty("chunkId") + public abstract Optional chunkId(); + + /** The ID of the file that the chunk belongs to. */ + @JsonProperty("fileId") + public abstract Optional fileId(); + /** Instantiates a builder for RagChunk. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -105,6 +113,42 @@ public Builder clearText() { return text(Optional.empty()); } + /** + * Setter for chunkId. + * + *

chunkId: The ID of the chunk. + */ + @JsonProperty("chunkId") + public abstract Builder chunkId(String chunkId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder chunkId(Optional chunkId); + + /** Clears the value of chunkId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearChunkId() { + return chunkId(Optional.empty()); + } + + /** + * Setter for fileId. + * + *

fileId: The ID of the file that the chunk belongs to. + */ + @JsonProperty("fileId") + public abstract Builder fileId(String fileId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fileId(Optional fileId); + + /** Clears the value of fileId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFileId() { + return fileId(Optional.empty()); + } + public abstract RagChunk build(); } diff --git a/src/main/java/com/google/genai/types/ToolCodeExecution.java b/src/main/java/com/google/genai/types/ToolCodeExecution.java index ef62807939e..16d5e69996f 100644 --- a/src/main/java/com/google/genai/types/ToolCodeExecution.java +++ b/src/main/java/com/google/genai/types/ToolCodeExecution.java @@ -25,8 +25,8 @@ /** * Tool that executes code generated by the model, and automatically returns the result to the - * model. See also [ExecutableCode]and [CodeExecutionResult] which are input and output to this - * tool. This data type is not supported in Gemini API. + * model. See also ExecutableCode and CodeExecutionResult, which are input and output to this tool. + * This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = ToolCodeExecution.Builder.class) diff --git a/src/main/java/com/google/genai/types/ToolConfig.java b/src/main/java/com/google/genai/types/ToolConfig.java index 41ff579dcec..be7e0837c92 100644 --- a/src/main/java/com/google/genai/types/ToolConfig.java +++ b/src/main/java/com/google/genai/types/ToolConfig.java @@ -43,8 +43,9 @@ public abstract class ToolConfig extends JsonSerializable { public abstract Optional functionCallingConfig(); /** - * If true, the API response will include the server-side tool calls and responses within the - * `Content` message. This allows clients to observe the server's tool invocations. + * Optional. If true, the API response will include the server-side tool calls and responses + * within the `Content` message. This allows clients to observe the server's tool interactions. + * This field is not supported in Vertex AI. */ @JsonProperty("includeServerSideToolInvocations") public abstract Optional includeServerSideToolInvocations(); @@ -127,9 +128,9 @@ public Builder clearFunctionCallingConfig() { /** * Setter for includeServerSideToolInvocations. * - *

includeServerSideToolInvocations: If true, the API response will include the server-side - * tool calls and responses within the `Content` message. This allows clients to observe the - * server's tool invocations. + *

includeServerSideToolInvocations: Optional. If true, the API response will include the + * server-side tool calls and responses within the `Content` message. This allows clients to + * observe the server's tool interactions. This field is not supported in Vertex AI. */ @JsonProperty("includeServerSideToolInvocations") public abstract Builder includeServerSideToolInvocations( diff --git a/src/main/java/com/google/genai/types/TuningJob.java b/src/main/java/com/google/genai/types/TuningJob.java index 87d3cd9401e..aae066ffc75 100644 --- a/src/main/java/com/google/genai/types/TuningJob.java +++ b/src/main/java/com/google/genai/types/TuningJob.java @@ -201,14 +201,14 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("veoTuningSpec") public abstract Optional veoTuningSpec(); - /** Optional. Spec for creating a distillation dataset. */ - @JsonProperty("distillationSamplingSpec") - public abstract Optional distillationSamplingSpec(); - /** Output only. Tuning Job metadata. */ @JsonProperty("tuningJobMetadata") public abstract Optional tuningJobMetadata(); + /** Tuning Spec for Veo LoRA Tuning. */ + @JsonProperty("veoLoraTuningSpec") + public abstract Optional veoLoraTuningSpec(); + /** Instantiates a builder for TuningJob. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -997,62 +997,59 @@ public Builder clearVeoTuningSpec() { } /** - * Setter for distillationSamplingSpec. + * Setter for tuningJobMetadata. * - *

distillationSamplingSpec: Optional. Spec for creating a distillation dataset. + *

tuningJobMetadata: Output only. Tuning Job metadata. */ - @JsonProperty("distillationSamplingSpec") - public abstract Builder distillationSamplingSpec( - DistillationSamplingSpec distillationSamplingSpec); + @JsonProperty("tuningJobMetadata") + public abstract Builder tuningJobMetadata(TuningJobMetadata tuningJobMetadata); /** - * Setter for distillationSamplingSpec builder. + * Setter for tuningJobMetadata builder. * - *

distillationSamplingSpec: Optional. Spec for creating a distillation dataset. + *

tuningJobMetadata: Output only. Tuning Job metadata. */ @CanIgnoreReturnValue - public Builder distillationSamplingSpec( - DistillationSamplingSpec.Builder distillationSamplingSpecBuilder) { - return distillationSamplingSpec(distillationSamplingSpecBuilder.build()); + public Builder tuningJobMetadata(TuningJobMetadata.Builder tuningJobMetadataBuilder) { + return tuningJobMetadata(tuningJobMetadataBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder distillationSamplingSpec( - Optional distillationSamplingSpec); + abstract Builder tuningJobMetadata(Optional tuningJobMetadata); - /** Clears the value of distillationSamplingSpec field. */ + /** Clears the value of tuningJobMetadata field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearDistillationSamplingSpec() { - return distillationSamplingSpec(Optional.empty()); + public Builder clearTuningJobMetadata() { + return tuningJobMetadata(Optional.empty()); } /** - * Setter for tuningJobMetadata. + * Setter for veoLoraTuningSpec. * - *

tuningJobMetadata: Output only. Tuning Job metadata. + *

veoLoraTuningSpec: Tuning Spec for Veo LoRA Tuning. */ - @JsonProperty("tuningJobMetadata") - public abstract Builder tuningJobMetadata(TuningJobMetadata tuningJobMetadata); + @JsonProperty("veoLoraTuningSpec") + public abstract Builder veoLoraTuningSpec(VeoLoraTuningSpec veoLoraTuningSpec); /** - * Setter for tuningJobMetadata builder. + * Setter for veoLoraTuningSpec builder. * - *

tuningJobMetadata: Output only. Tuning Job metadata. + *

veoLoraTuningSpec: Tuning Spec for Veo LoRA Tuning. */ @CanIgnoreReturnValue - public Builder tuningJobMetadata(TuningJobMetadata.Builder tuningJobMetadataBuilder) { - return tuningJobMetadata(tuningJobMetadataBuilder.build()); + public Builder veoLoraTuningSpec(VeoLoraTuningSpec.Builder veoLoraTuningSpecBuilder) { + return veoLoraTuningSpec(veoLoraTuningSpecBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder tuningJobMetadata(Optional tuningJobMetadata); + abstract Builder veoLoraTuningSpec(Optional veoLoraTuningSpec); - /** Clears the value of tuningJobMetadata field. */ + /** Clears the value of veoLoraTuningSpec field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearTuningJobMetadata() { - return tuningJobMetadata(Optional.empty()); + public Builder clearVeoLoraTuningSpec() { + return veoLoraTuningSpec(Optional.empty()); } public abstract TuningJob build(); diff --git a/src/main/java/com/google/genai/types/TuningSpeed.java b/src/main/java/com/google/genai/types/TuningSpeed.java new file mode 100644 index 00000000000..21e7be0077a --- /dev/null +++ b/src/main/java/com/google/genai/types/TuningSpeed.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The speed of the tuning job. Only supported for Veo 3.0 models. This enum is not supported in + * Gemini API. + */ +public class TuningSpeed { + + /** Enum representing the known values for TuningSpeed. */ + public enum Known { + /** The default / unset value. For Veo 3.0 models, this defaults to FAST. */ + TUNING_SPEED_UNSPECIFIED, + + /** Regular tuning speed. */ + REGULAR, + + /** Fast tuning speed. */ + FAST + } + + private Known tuningSpeedEnum; + private final String value; + + @JsonCreator + public TuningSpeed(String value) { + this.value = value; + for (Known tuningSpeedEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(tuningSpeedEnum.toString(), value)) { + this.tuningSpeedEnum = tuningSpeedEnum; + break; + } + } + if (this.tuningSpeedEnum == null) { + this.tuningSpeedEnum = Known.TUNING_SPEED_UNSPECIFIED; + } + } + + public TuningSpeed(Known knownValue) { + this.tuningSpeedEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof TuningSpeed)) { + return false; + } + + TuningSpeed other = (TuningSpeed) o; + + if (this.tuningSpeedEnum != Known.TUNING_SPEED_UNSPECIFIED + && other.tuningSpeedEnum != Known.TUNING_SPEED_UNSPECIFIED) { + return this.tuningSpeedEnum == other.tuningSpeedEnum; + } else if (this.tuningSpeedEnum == Known.TUNING_SPEED_UNSPECIFIED + && other.tuningSpeedEnum == Known.TUNING_SPEED_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.tuningSpeedEnum != Known.TUNING_SPEED_UNSPECIFIED) { + return this.tuningSpeedEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.tuningSpeedEnum; + } +} diff --git a/src/main/java/com/google/genai/types/TuningTask.java b/src/main/java/com/google/genai/types/TuningTask.java index 033bb427533..2f6bd0405dc 100644 --- a/src/main/java/com/google/genai/types/TuningTask.java +++ b/src/main/java/com/google/genai/types/TuningTask.java @@ -23,7 +23,7 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */ +/** The tuning task for Veo. This enum is not supported in Gemini API. */ public class TuningTask { /** Enum representing the known values for TuningTask. */ diff --git a/src/main/java/com/google/genai/types/VeoHyperParameters.java b/src/main/java/com/google/genai/types/VeoHyperParameters.java index 173c416dfd0..1ed27411094 100644 --- a/src/main/java/com/google/genai/types/VeoHyperParameters.java +++ b/src/main/java/com/google/genai/types/VeoHyperParameters.java @@ -43,7 +43,7 @@ public abstract class VeoHyperParameters extends JsonSerializable { @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); - /** Optional. The tuning task. Either I2V or T2V. */ + /** The tuning task for Veo. */ @JsonProperty("tuningTask") public abstract Optional tuningTask(); @@ -55,6 +55,14 @@ public abstract class VeoHyperParameters extends JsonSerializable { @JsonProperty("veoDataMixtureRatio") public abstract Optional veoDataMixtureRatio(); + /** Optional. The adapter size for LoRA tuning. */ + @JsonProperty("adapterSize") + public abstract Optional adapterSize(); + + /** The speed of the tuning job. Only supported for Veo 3.0 models. */ + @JsonProperty("tuningSpeed") + public abstract Optional tuningSpeed(); + /** Instantiates a builder for VeoHyperParameters. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -113,7 +121,7 @@ public Builder clearLearningRateMultiplier() { /** * Setter for tuningTask. * - *

tuningTask: Optional. The tuning task. Either I2V or T2V. + *

tuningTask: The tuning task for Veo. */ @JsonProperty("tuningTask") public abstract Builder tuningTask(TuningTask tuningTask); @@ -131,7 +139,7 @@ public Builder clearTuningTask() { /** * Setter for tuningTask given a known enum. * - *

tuningTask: Optional. The tuning task. Either I2V or T2V. + *

tuningTask: The tuning task for Veo. */ @CanIgnoreReturnValue public Builder tuningTask(TuningTask.Known knownType) { @@ -141,7 +149,7 @@ public Builder tuningTask(TuningTask.Known knownType) { /** * Setter for tuningTask given a string. * - *

tuningTask: Optional. The tuning task. Either I2V or T2V. + *

tuningTask: The tuning task for Veo. */ @CanIgnoreReturnValue public Builder tuningTask(String tuningTask) { @@ -168,6 +176,82 @@ public Builder clearVeoDataMixtureRatio() { return veoDataMixtureRatio(Optional.empty()); } + /** + * Setter for adapterSize. + * + *

adapterSize: Optional. The adapter size for LoRA tuning. + */ + @JsonProperty("adapterSize") + public abstract Builder adapterSize(AdapterSize adapterSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder adapterSize(Optional adapterSize); + + /** Clears the value of adapterSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAdapterSize() { + return adapterSize(Optional.empty()); + } + + /** + * Setter for adapterSize given a known enum. + * + *

adapterSize: Optional. The adapter size for LoRA tuning. + */ + @CanIgnoreReturnValue + public Builder adapterSize(AdapterSize.Known knownType) { + return adapterSize(new AdapterSize(knownType)); + } + + /** + * Setter for adapterSize given a string. + * + *

adapterSize: Optional. The adapter size for LoRA tuning. + */ + @CanIgnoreReturnValue + public Builder adapterSize(String adapterSize) { + return adapterSize(new AdapterSize(adapterSize)); + } + + /** + * Setter for tuningSpeed. + * + *

tuningSpeed: The speed of the tuning job. Only supported for Veo 3.0 models. + */ + @JsonProperty("tuningSpeed") + public abstract Builder tuningSpeed(TuningSpeed tuningSpeed); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tuningSpeed(Optional tuningSpeed); + + /** Clears the value of tuningSpeed field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTuningSpeed() { + return tuningSpeed(Optional.empty()); + } + + /** + * Setter for tuningSpeed given a known enum. + * + *

tuningSpeed: The speed of the tuning job. Only supported for Veo 3.0 models. + */ + @CanIgnoreReturnValue + public Builder tuningSpeed(TuningSpeed.Known knownType) { + return tuningSpeed(new TuningSpeed(knownType)); + } + + /** + * Setter for tuningSpeed given a string. + * + *

tuningSpeed: The speed of the tuning job. Only supported for Veo 3.0 models. + */ + @CanIgnoreReturnValue + public Builder tuningSpeed(String tuningSpeed) { + return tuningSpeed(new TuningSpeed(tuningSpeed)); + } + public abstract VeoHyperParameters build(); } diff --git a/src/main/java/com/google/genai/types/VeoLoraTuningSpec.java b/src/main/java/com/google/genai/types/VeoLoraTuningSpec.java new file mode 100644 index 00000000000..727d8affe5d --- /dev/null +++ b/src/main/java/com/google/genai/types/VeoLoraTuningSpec.java @@ -0,0 +1,187 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tuning Spec for Veo LoRA Model Tuning. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = VeoLoraTuningSpec.Builder.class) +public abstract class VeoLoraTuningSpec extends JsonSerializable { + /** Optional. Hyperparameters for Veo LoRA. */ + @JsonProperty("hyperParameters") + public abstract Optional hyperParameters(); + + /** + * Required. Training dataset used for tuning. The dataset can be specified as either a Cloud + * Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. + */ + @JsonProperty("trainingDatasetUri") + public abstract Optional trainingDatasetUri(); + + /** + * Optional. Validation dataset used for tuning. The dataset can be specified as either a Cloud + * Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. + */ + @JsonProperty("validationDatasetUri") + public abstract Optional validationDatasetUri(); + + /** Optional. The orientation of the video. Defaults to LANDSCAPE. */ + @JsonProperty("videoOrientation") + public abstract Optional videoOrientation(); + + /** Instantiates a builder for VeoLoraTuningSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_VeoLoraTuningSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for VeoLoraTuningSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `VeoLoraTuningSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_VeoLoraTuningSpec.Builder(); + } + + /** + * Setter for hyperParameters. + * + *

hyperParameters: Optional. Hyperparameters for Veo LoRA. + */ + @JsonProperty("hyperParameters") + public abstract Builder hyperParameters(VeoHyperParameters hyperParameters); + + /** + * Setter for hyperParameters builder. + * + *

hyperParameters: Optional. Hyperparameters for Veo LoRA. + */ + @CanIgnoreReturnValue + public Builder hyperParameters(VeoHyperParameters.Builder hyperParametersBuilder) { + return hyperParameters(hyperParametersBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder hyperParameters(Optional hyperParameters); + + /** Clears the value of hyperParameters field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHyperParameters() { + return hyperParameters(Optional.empty()); + } + + /** + * Setter for trainingDatasetUri. + * + *

trainingDatasetUri: Required. Training dataset used for tuning. The dataset can be + * specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex + * Multimodal Dataset. + */ + @JsonProperty("trainingDatasetUri") + public abstract Builder trainingDatasetUri(String trainingDatasetUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder trainingDatasetUri(Optional trainingDatasetUri); + + /** Clears the value of trainingDatasetUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTrainingDatasetUri() { + return trainingDatasetUri(Optional.empty()); + } + + /** + * Setter for validationDatasetUri. + * + *

validationDatasetUri: Optional. Validation dataset used for tuning. The dataset can be + * specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex + * Multimodal Dataset. + */ + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder validationDatasetUri(Optional validationDatasetUri); + + /** Clears the value of validationDatasetUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValidationDatasetUri() { + return validationDatasetUri(Optional.empty()); + } + + /** + * Setter for videoOrientation. + * + *

videoOrientation: Optional. The orientation of the video. Defaults to LANDSCAPE. + */ + @JsonProperty("videoOrientation") + public abstract Builder videoOrientation(VideoOrientation videoOrientation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder videoOrientation(Optional videoOrientation); + + /** Clears the value of videoOrientation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVideoOrientation() { + return videoOrientation(Optional.empty()); + } + + /** + * Setter for videoOrientation given a known enum. + * + *

videoOrientation: Optional. The orientation of the video. Defaults to LANDSCAPE. + */ + @CanIgnoreReturnValue + public Builder videoOrientation(VideoOrientation.Known knownType) { + return videoOrientation(new VideoOrientation(knownType)); + } + + /** + * Setter for videoOrientation given a string. + * + *

videoOrientation: Optional. The orientation of the video. Defaults to LANDSCAPE. + */ + @CanIgnoreReturnValue + public Builder videoOrientation(String videoOrientation) { + return videoOrientation(new VideoOrientation(videoOrientation)); + } + + public abstract VeoLoraTuningSpec build(); + } + + /** Deserializes a JSON string to a VeoLoraTuningSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static VeoLoraTuningSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, VeoLoraTuningSpec.class); + } +} diff --git a/src/main/java/com/google/genai/types/VideoOrientation.java b/src/main/java/com/google/genai/types/VideoOrientation.java new file mode 100644 index 00000000000..f6e99fa17b5 --- /dev/null +++ b/src/main/java/com/google/genai/types/VideoOrientation.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The orientation of the video. Defaults to LANDSCAPE. This enum is not supported in Gemini API. + */ +public class VideoOrientation { + + /** Enum representing the known values for VideoOrientation. */ + public enum Known { + /** Unspecified video orientation. Defaults to landscape. */ + VIDEO_ORIENTATION_UNSPECIFIED, + + /** Landscape orientation (e.g. 16:9, 1280x720). */ + LANDSCAPE, + + /** Portrait orientation (e.g. 9:16, 720x1280). */ + PORTRAIT + } + + private Known videoOrientationEnum; + private final String value; + + @JsonCreator + public VideoOrientation(String value) { + this.value = value; + for (Known videoOrientationEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(videoOrientationEnum.toString(), value)) { + this.videoOrientationEnum = videoOrientationEnum; + break; + } + } + if (this.videoOrientationEnum == null) { + this.videoOrientationEnum = Known.VIDEO_ORIENTATION_UNSPECIFIED; + } + } + + public VideoOrientation(Known knownValue) { + this.videoOrientationEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof VideoOrientation)) { + return false; + } + + VideoOrientation other = (VideoOrientation) o; + + if (this.videoOrientationEnum != Known.VIDEO_ORIENTATION_UNSPECIFIED + && other.videoOrientationEnum != Known.VIDEO_ORIENTATION_UNSPECIFIED) { + return this.videoOrientationEnum == other.videoOrientationEnum; + } else if (this.videoOrientationEnum == Known.VIDEO_ORIENTATION_UNSPECIFIED + && other.videoOrientationEnum == Known.VIDEO_ORIENTATION_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.videoOrientationEnum != Known.VIDEO_ORIENTATION_UNSPECIFIED) { + return this.videoOrientationEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.videoOrientationEnum; + } +}