From 0f2a3cc7310424f60bf6a96492623b645fb7abc6 Mon Sep 17 00:00:00 2001 From: Yvonne Yu Date: Tue, 1 Sep 2026 17:41:54 -0700 Subject: [PATCH] feat: update discovery doc PiperOrigin-RevId: 974802327 --- src/main/java/com/google/genai/Batches.java | 62 +------ src/main/java/com/google/genai/Caches.java | 62 +------ .../java/com/google/genai/LiveConverters.java | 168 ++---------------- src/main/java/com/google/genai/Models.java | 73 +------- .../com/google/genai/TokensConverters.java | 62 +------ src/main/java/com/google/genai/Tunings.java | 16 +- .../genai/types/AudioTranscriptionConfig.java | 12 +- .../java/com/google/genai/types/Blob.java | 4 +- .../genai/types/CustomCodeExecutionSpec.java | 40 +++++ ...ionParserConfigCustomCodeParserConfig.java | 38 ++++ .../java/com/google/genai/types/FileData.java | 4 +- .../google/genai/types/GenerationConfig.java | 8 +- .../com/google/genai/types/McpServer.java | 2 +- .../java/com/google/genai/types/Mode.java | 117 ++++++++++++ .../types/ReinforcementTuningExample.java | 45 +++++ .../com/google/genai/types/TrafficType.java | 3 + .../genai/types/VideoResponseFormat.java | 23 +++ 17 files changed, 319 insertions(+), 420 deletions(-) create mode 100644 src/main/java/com/google/genai/types/Mode.java diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index 2203438f565..9c6155bfbb4 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -554,32 +554,6 @@ ObjectNode batchJobSourceToVertex(JsonNode fromObject, ObjectNode parentObject) return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"data"}, - Common.getValueByPath(fromObject, new String[] {"data"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode cancelBatchJobParametersToMldev( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { @@ -1100,32 +1074,6 @@ ObjectNode embeddingsBatchJobSourceToMldev( return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileUri"}, - Common.getValueByPath(fromObject, new String[] {"fileUri"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1898,10 +1846,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"fileData"}, - fileDataToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"fileData"})); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -1925,10 +1870,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"inlineData"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"inlineData"})); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { diff --git a/src/main/java/com/google/genai/Caches.java b/src/main/java/com/google/genai/Caches.java index 524656321c5..2b2c8241829 100644 --- a/src/main/java/com/google/genai/Caches.java +++ b/src/main/java/com/google/genai/Caches.java @@ -109,32 +109,6 @@ ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"data"}, - Common.getValueByPath(fromObject, new String[] {"data"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -479,32 +453,6 @@ ObjectNode deleteCachedContentResponseFromVertex(JsonNode fromObject, ObjectNode return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileUri"}, - Common.getValueByPath(fromObject, new String[] {"fileUri"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -831,10 +779,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"fileData"}, - fileDataToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"fileData"})); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -858,10 +803,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"inlineData"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"inlineData"})); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 7085017def6..b52bc01c77d 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -81,32 +81,6 @@ ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"data"}, - Common.getValueByPath(fromObject, new String[] {"data"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -190,32 +164,6 @@ ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileUri"}, - Common.getValueByPath(fromObject, new String[] {"fileUri"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -428,10 +376,11 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.getValueByPath(fromObject, new String[] {"responseFormat"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) { - throw new IllegalArgumentException( - "translationConfig parameter is only supported in Gemini Developer API mode, not in" - + " Gemini Enterprise Agent Platform mode."); + if (Common.getValueByPath(fromObject, new String[] {"translationConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"translationConfig"}, + Common.getValueByPath(fromObject, new String[] {"translationConfig"})); } if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { @@ -580,10 +529,7 @@ ObjectNode liveClientMessageToMldev(JsonNode fromObject, ObjectNode parentObject Common.setValueByPath( toObject, new String[] {"realtimeInput"}, - liveClientRealtimeInputToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"realtimeInput"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"realtimeInput"})); } if (Common.getValueByPath(fromObject, new String[] {"realtimeInputParameters"}) != null) { @@ -659,72 +605,6 @@ ObjectNode liveClientMessageToVertex(JsonNode fromObject, ObjectNode parentObjec return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode liveClientRealtimeInputToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"mediaChunks"}) != null) { - ArrayNode keyArray = - (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mediaChunks"}); - ObjectMapper objectMapper = new ObjectMapper(); - ArrayNode result = objectMapper.createArrayNode(); - - for (JsonNode item : keyArray) { - result.add(blobToMldev(JsonSerializable.toJsonNode(item), toObject)); - } - Common.setValueByPath(toObject, new String[] {"mediaChunks"}, result); - } - - if (Common.getValueByPath(fromObject, new String[] {"audio"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"audio"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"audio"})), - toObject)); - } - - if (Common.getValueByPath(fromObject, new String[] {"audioStreamEnd"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"audioStreamEnd"}, - Common.getValueByPath(fromObject, new String[] {"audioStreamEnd"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"video"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); - } - - if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"text"}, - Common.getValueByPath(fromObject, new String[] {"text"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"activityStart"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"activityStart"}, - Common.getValueByPath(fromObject, new String[] {"activityStart"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"activityEnd"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"activityEnd"}, - Common.getValueByPath(fromObject, new String[] {"activityEnd"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode liveClientRealtimeInputToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1425,27 +1305,17 @@ ObjectNode liveConnectParametersToVertex( ObjectNode liveSendRealtimeInputParametersToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"media"}) != null) { - ArrayNode keyArray = - (ArrayNode) - Transformers.tBlobs(Common.getValueByPath(fromObject, new String[] {"media"})); - ObjectMapper objectMapper = new ObjectMapper(); - ArrayNode result = objectMapper.createArrayNode(); - - for (JsonNode item : keyArray) { - result.add(blobToMldev(JsonSerializable.toJsonNode(item), toObject)); - } - Common.setValueByPath(toObject, new String[] {"mediaChunks"}, result); + Common.setValueByPath( + toObject, + new String[] {"mediaChunks"}, + Transformers.tBlobs(Common.getValueByPath(fromObject, new String[] {"media"}))); } if (Common.getValueByPath(fromObject, new String[] {"audio"}) != null) { Common.setValueByPath( toObject, new String[] {"audio"}, - blobToMldev( - JsonSerializable.toJsonNode( - Transformers.tAudioBlob( - Common.getValueByPath(fromObject, new String[] {"audio"}))), - toObject)); + Transformers.tAudioBlob(Common.getValueByPath(fromObject, new String[] {"audio"}))); } if (Common.getValueByPath(fromObject, new String[] {"audioStreamEnd"}) != null) { @@ -1459,11 +1329,7 @@ ObjectNode liveSendRealtimeInputParametersToMldev(JsonNode fromObject, ObjectNod Common.setValueByPath( toObject, new String[] {"video"}, - blobToMldev( - JsonSerializable.toJsonNode( - Transformers.tImageBlob( - Common.getValueByPath(fromObject, new String[] {"video"}))), - toObject)); + Transformers.tImageBlob(Common.getValueByPath(fromObject, new String[] {"video"}))); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { @@ -1757,10 +1623,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"fileData"}, - fileDataToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"fileData"})); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -1784,10 +1647,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"inlineData"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"inlineData"})); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 94bfbba0b6a..031600c6c53 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -171,32 +171,6 @@ ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonN return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"data"}, - Common.getValueByPath(fromObject, new String[] {"data"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1342,32 +1316,6 @@ ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject, Json return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileUri"}, - Common.getValueByPath(fromObject, new String[] {"fileUri"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { @@ -3280,10 +3228,11 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"responseFormat"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) { - throw new IllegalArgumentException( - "translationConfig parameter is only supported in Gemini Developer API mode, not in" - + " Gemini Enterprise Agent Platform mode."); + if (Common.getValueByPath(fromObject, new String[] {"translationConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"translationConfig"}, + Common.getValueByPath(fromObject, new String[] {"translationConfig"})); } if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { @@ -4025,11 +3974,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.setValueByPath( toObject, new String[] {"fileData"}, - fileDataToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject, - rootObject)); + Common.getValueByPath(fromObject, new String[] {"fileData"})); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -4054,11 +3999,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.setValueByPath( toObject, new String[] {"inlineData"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject, - rootObject)); + Common.getValueByPath(fromObject, new String[] {"inlineData"})); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { diff --git a/src/main/java/com/google/genai/TokensConverters.java b/src/main/java/com/google/genai/TokensConverters.java index 5a7ab599d4b..2629c2f4216 100644 --- a/src/main/java/com/google/genai/TokensConverters.java +++ b/src/main/java/com/google/genai/TokensConverters.java @@ -81,32 +81,6 @@ ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"data"}, - Common.getValueByPath(fromObject, new String[] {"data"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -208,32 +182,6 @@ ObjectNode createAuthTokenParametersToVertex(JsonNode fromObject, ObjectNode par return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { - throw new IllegalArgumentException( - "displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileUri"}, - Common.getValueByPath(fromObject, new String[] {"fileUri"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -564,10 +512,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"fileData"}, - fileDataToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"fileData"})); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -591,10 +536,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath( toObject, new String[] {"inlineData"}, - blobToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"inlineData"})); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index adc2513d360..57972ff7496 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -1227,6 +1227,13 @@ ObjectNode generationConfigFromVertex( Common.getValueByPath(fromObject, new String[] {"responseFormat"})); } + if (Common.getValueByPath(fromObject, new String[] {"translationConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"translationConfig"}, + Common.getValueByPath(fromObject, new String[] {"translationConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { Common.setValueByPath( toObject, @@ -1414,10 +1421,11 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"responseFormat"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) { - throw new IllegalArgumentException( - "translationConfig parameter is only supported in Gemini Developer API mode, not in" - + " Gemini Enterprise Agent Platform mode."); + if (Common.getValueByPath(fromObject, new String[] {"translationConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"translationConfig"}, + Common.getValueByPath(fromObject, new String[] {"translationConfig"})); } if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { diff --git a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java index cf0c11071b6..0f975f93c7d 100644 --- a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java +++ b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java @@ -33,8 +33,8 @@ @JsonDeserialize(builder = AudioTranscriptionConfig.Builder.class) public abstract class AudioTranscriptionConfig extends JsonSerializable { /** - * BCP-47 language codes providing hints about the languages present in the audio. If omitted or - * empty, defaults to automatic language detection. + * Optional. BCP-47 language codes providing hints about the languages present in the audio. If + * omitted or empty, defaults to automatic language detection. */ @JsonProperty("languageCodes") public abstract Optional> languageCodes(); @@ -106,8 +106,8 @@ private static Builder create() { /** * Setter for languageCodes. * - *

languageCodes: BCP-47 language codes providing hints about the languages present in the - * audio. If omitted or empty, defaults to automatic language detection. + *

languageCodes: Optional. BCP-47 language codes providing hints about the languages present + * in the audio. If omitted or empty, defaults to automatic language detection. */ @JsonProperty("languageCodes") public abstract Builder languageCodes(List languageCodes); @@ -115,8 +115,8 @@ private static Builder create() { /** * Setter for languageCodes. * - *

languageCodes: BCP-47 language codes providing hints about the languages present in the - * audio. If omitted or empty, defaults to automatic language detection. + *

languageCodes: Optional. BCP-47 language codes providing hints about the languages present + * in the audio. If omitted or empty, defaults to automatic language detection. */ @CanIgnoreReturnValue public Builder languageCodes(String... languageCodes) { diff --git a/src/main/java/com/google/genai/types/Blob.java b/src/main/java/com/google/genai/types/Blob.java index c8fbbd16aa2..6bf2b3dcbcc 100644 --- a/src/main/java/com/google/genai/types/Blob.java +++ b/src/main/java/com/google/genai/types/Blob.java @@ -41,7 +41,7 @@ public abstract class Blob extends JsonSerializable { * Optional. The display name of the blob. Used to provide a label or filename to distinguish * blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the * Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) - * are enabled. This field is not supported in Gemini API. + * are enabled. */ @JsonProperty("displayName") public abstract Optional displayName(); @@ -92,7 +92,7 @@ public Builder clearData() { *

displayName: Optional. The display name of the blob. Used to provide a label or filename * to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. * It is used in the Gemini calls only when server-side tools (`code_execution`, - * `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API. + * `google_search`, and `url_context`) are enabled. */ @JsonProperty("displayName") public abstract Builder displayName(String displayName); diff --git a/src/main/java/com/google/genai/types/CustomCodeExecutionSpec.java b/src/main/java/com/google/genai/types/CustomCodeExecutionSpec.java index 4fc011d1d23..d3583ddce80 100644 --- a/src/main/java/com/google/genai/types/CustomCodeExecutionSpec.java +++ b/src/main/java/com/google/genai/types/CustomCodeExecutionSpec.java @@ -39,6 +39,20 @@ public abstract class CustomCodeExecutionSpec extends JsonSerializable { @JsonProperty("evaluationFunction") public abstract Optional evaluationFunction(); + /** + * Optional. The region to use for code execution. If set, the Code Execution Sandbox will be + * invoked in the specified region regardless of the request's originating region. Must be a + * region where the Code Execution Sandbox is available. Supported regions: + * northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, us-west1, + * us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, europe-west2, + * europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, asia-east1, + * asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, asia-southeast1, + * australia-southeast2. If unset, the request's originating region is used; requests from regions + * where the sandbox is unavailable will fail with UNIMPLEMENTED. + */ + @JsonProperty("codeExecutionRegion") + public abstract Optional codeExecutionRegion(); + /** Instantiates a builder for CustomCodeExecutionSpec. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -79,6 +93,32 @@ public Builder clearEvaluationFunction() { return evaluationFunction(Optional.empty()); } + /** + * Setter for codeExecutionRegion. + * + *

codeExecutionRegion: Optional. The region to use for code execution. If set, the Code + * Execution Sandbox will be invoked in the specified region regardless of the request's + * originating region. Must be a region where the Code Execution Sandbox is available. Supported + * regions: northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, + * us-west1, us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, + * europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, + * asia-east1, asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, + * asia-southeast1, australia-southeast2. If unset, the request's originating region is used; + * requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED. + */ + @JsonProperty("codeExecutionRegion") + public abstract Builder codeExecutionRegion(String codeExecutionRegion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeExecutionRegion(Optional codeExecutionRegion); + + /** Clears the value of codeExecutionRegion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeExecutionRegion() { + return codeExecutionRegion(Optional.empty()); + } + public abstract CustomCodeExecutionSpec build(); } diff --git a/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java b/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java index 733de9d1230..383250dba6a 100644 --- a/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java +++ b/src/main/java/com/google/genai/types/EvaluationParserConfigCustomCodeParserConfig.java @@ -49,6 +49,19 @@ public abstract class EvaluationParserConfigCustomCodeParserConfig extends JsonS @JsonProperty("parsingFunction") public abstract Optional parsingFunction(); + /** + * Optional. The region to use for code execution. If set, the Code Execution Sandbox will be + * invoked in the specified region regardless of the request's originating region. Must be a + * region where the Code Execution Sandbox is available. Supported regions: + * northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, us-west1, + * us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, europe-west2, + * europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, asia-east1, + * asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, asia-southeast1, + * australia-southeast2. If unset, the request's originating region is used. + */ + @JsonProperty("codeExecutionRegion") + public abstract Optional codeExecutionRegion(); + /** Instantiates a builder for EvaluationParserConfigCustomCodeParserConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -99,6 +112,31 @@ public Builder clearParsingFunction() { return parsingFunction(Optional.empty()); } + /** + * Setter for codeExecutionRegion. + * + *

codeExecutionRegion: Optional. The region to use for code execution. If set, the Code + * Execution Sandbox will be invoked in the specified region regardless of the request's + * originating region. Must be a region where the Code Execution Sandbox is available. Supported + * regions: northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, + * us-west1, us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, + * europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, + * asia-east1, asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, + * asia-southeast1, australia-southeast2. If unset, the request's originating region is used. + */ + @JsonProperty("codeExecutionRegion") + public abstract Builder codeExecutionRegion(String codeExecutionRegion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeExecutionRegion(Optional codeExecutionRegion); + + /** Clears the value of codeExecutionRegion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeExecutionRegion() { + return codeExecutionRegion(Optional.empty()); + } + public abstract EvaluationParserConfigCustomCodeParserConfig build(); } diff --git a/src/main/java/com/google/genai/types/FileData.java b/src/main/java/com/google/genai/types/FileData.java index afb386ac60f..92b82aedd8f 100644 --- a/src/main/java/com/google/genai/types/FileData.java +++ b/src/main/java/com/google/genai/types/FileData.java @@ -37,7 +37,7 @@ public abstract class FileData extends JsonSerializable { * Optional. The display name of the file. Used to provide a label or filename to distinguish * files. This field is only returned in `PromptMessage` for prompt management. It is used in the * Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) - * are enabled. This field is not supported in Gemini API. + * are enabled. */ @JsonProperty("displayName") public abstract Optional displayName(); @@ -74,7 +74,7 @@ private static Builder create() { *

displayName: Optional. The display name of the file. Used to provide a label or filename * to distinguish files. This field is only returned in `PromptMessage` for prompt management. * It is used in the Gemini calls only when server side tools (`code_execution`, - * `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API. + * `google_search`, and `url_context`) are enabled. */ @JsonProperty("displayName") public abstract Builder displayName(String displayName); diff --git a/src/main/java/com/google/genai/types/GenerationConfig.java b/src/main/java/com/google/genai/types/GenerationConfig.java index ca4e47573c8..89e43c95ee3 100644 --- a/src/main/java/com/google/genai/types/GenerationConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfig.java @@ -223,7 +223,7 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("responseFormat") public abstract Optional> responseFormat(); - /** Optional. Config for translation. This field is not supported in Vertex AI. */ + /** Optional. Config for translation. */ @JsonProperty("translationConfig") public abstract Optional translationConfig(); @@ -925,8 +925,7 @@ public Builder clearResponseFormat() { /** * Setter for translationConfig. * - *

translationConfig: Optional. Config for translation. This field is not supported in Vertex - * AI. + *

translationConfig: Optional. Config for translation. */ @JsonProperty("translationConfig") public abstract Builder translationConfig(TranslationConfig translationConfig); @@ -934,8 +933,7 @@ public Builder clearResponseFormat() { /** * Setter for translationConfig builder. * - *

translationConfig: Optional. Config for translation. This field is not supported in Vertex - * AI. + *

translationConfig: Optional. Config for translation. */ @CanIgnoreReturnValue public Builder translationConfig(TranslationConfig.Builder translationConfigBuilder) { diff --git a/src/main/java/com/google/genai/types/McpServer.java b/src/main/java/com/google/genai/types/McpServer.java index 04b7ad5c61f..7e1c9b5296c 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: 6. This data type is not supported in Vertex AI. + * implements the MCP protocol. Next ID: 7. 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/Mode.java b/src/main/java/com/google/genai/types/Mode.java new file mode 100644 index 00000000000..1298dcfe637 --- /dev/null +++ b/src/main/java/com/google/genai/types/Mode.java @@ -0,0 +1,117 @@ +/* + * 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; + +/** + * Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If unspecified, defaults to + * `VERBATIM` transcription. In `SMART` mode, the model performs disfluency removal (eliminating + * filler words, repetitions, and false starts), light grammatical cleanup, automatic formatting + * (paragraphs, bullet points, numbered lists), and minor user edits (inline self-corrections). + * Timestamps and diarization are incompatible with mode `SMART`. This enum is not supported in + * Vertex AI. + */ +public class Mode { + + /** Enum representing the known values for Mode. */ + public enum Known { + /** Unspecified transcription mode. */ + MODE_UNSPECIFIED, + + /** Verbatim transcription mode. */ + VERBATIM, + + /** Smart transcription mode. */ + SMART + } + + private Known modeEnum; + private final String value; + + @JsonCreator + public Mode(String value) { + this.value = value; + for (Known modeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(modeEnum.toString(), value)) { + this.modeEnum = modeEnum; + break; + } + } + if (this.modeEnum == null) { + this.modeEnum = Known.MODE_UNSPECIFIED; + } + } + + public Mode(Known knownValue) { + this.modeEnum = 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 Mode)) { + return false; + } + + Mode other = (Mode) o; + + if (this.modeEnum != Known.MODE_UNSPECIFIED && other.modeEnum != Known.MODE_UNSPECIFIED) { + return this.modeEnum == other.modeEnum; + } else if (this.modeEnum == Known.MODE_UNSPECIFIED + && other.modeEnum == Known.MODE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.modeEnum != Known.MODE_UNSPECIFIED) { + return this.modeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.modeEnum; + } +} diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningExample.java b/src/main/java/com/google/genai/types/ReinforcementTuningExample.java index 87015670287..091fe24433f 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningExample.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningExample.java @@ -61,6 +61,10 @@ public abstract class ReinforcementTuningExample extends JsonSerializable { @JsonProperty("systemInstruction") public abstract Optional systemInstruction(); + /** Optional. Corresponds to tools in user-facing GenerateContentRequest. */ + @JsonProperty("tools") + public abstract Optional> tools(); + /** Instantiates a builder for ReinforcementTuningExample. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -177,6 +181,47 @@ public Builder clearSystemInstruction() { return systemInstruction(Optional.empty()); } + /** + * Setter for tools. + * + *

tools: Optional. Corresponds to tools in user-facing GenerateContentRequest. + */ + @JsonProperty("tools") + public abstract Builder tools(List tools); + + /** + * Setter for tools. + * + *

tools: Optional. Corresponds to tools in user-facing GenerateContentRequest. + */ + @CanIgnoreReturnValue + public Builder tools(Tool... tools) { + return tools(Arrays.asList(tools)); + } + + /** + * Setter for tools builder. + * + *

tools: Optional. Corresponds to tools in user-facing GenerateContentRequest. + */ + @CanIgnoreReturnValue + public Builder tools(Tool.Builder... toolsBuilders) { + return tools( + Arrays.asList(toolsBuilders).stream() + .map(Tool.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional> tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + public abstract ReinforcementTuningExample build(); } diff --git a/src/main/java/com/google/genai/types/TrafficType.java b/src/main/java/com/google/genai/types/TrafficType.java index f8ee63f4480..aa4d4ae845d 100644 --- a/src/main/java/com/google/genai/types/TrafficType.java +++ b/src/main/java/com/google/genai/types/TrafficType.java @@ -40,6 +40,9 @@ public enum Known { /** Type for Flex traffic. */ ON_DEMAND_FLEX, + /** Type for Off-Peak Pay-As-You-Go traffic. */ + ON_DEMAND_OFFPEAK, + /** Type for Provisioned Throughput traffic. */ PROVISIONED_THROUGHPUT } diff --git a/src/main/java/com/google/genai/types/VideoResponseFormat.java b/src/main/java/com/google/genai/types/VideoResponseFormat.java index fd13bc57a68..f6555ee55b7 100644 --- a/src/main/java/com/google/genai/types/VideoResponseFormat.java +++ b/src/main/java/com/google/genai/types/VideoResponseFormat.java @@ -53,6 +53,10 @@ public abstract class VideoResponseFormat extends JsonSerializable { @JsonProperty("gcsUri") public abstract Optional gcsUri(); + /** Optional. The video output resolution. Supported values: "360p", "720p", "1080p", "4k". */ + @JsonProperty("resolution") + public abstract Optional resolution(); + /** Instantiates a builder for VideoResponseFormat. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -184,6 +188,25 @@ public Builder clearGcsUri() { return gcsUri(Optional.empty()); } + /** + * Setter for resolution. + * + *

resolution: Optional. The video output resolution. Supported values: "360p", "720p", + * "1080p", "4k". + */ + @JsonProperty("resolution") + public abstract Builder resolution(String resolution); + + @ExcludeFromGeneratedCoverageReport + abstract Builder resolution(Optional resolution); + + /** Clears the value of resolution field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResolution() { + return resolution(Optional.empty()); + } + public abstract VideoResponseFormat build(); }