From 95fa74827e4f7a5c82d414304c9cacb4b56dc28e 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 +- .../types/ReinforcementTuningExample.java | 45 +++++ .../com/google/genai/types/TrafficType.java | 3 + .../genai/types/VideoResponseFormat.java | 23 +++ 16 files changed, 202 insertions(+), 420 deletions(-) diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index 2203438f5657..9c6155bfbb48 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 524656321c51..2b2c82418292 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 7085017def68..b52bc01c77d9 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 286ed6b52f25..541b6c3d8427 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 5a7ab599d4ba..2629c2f42161 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 adc2513d3604..57972ff74961 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 cf0c11071b6a..0f975f93c7df 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 c8fbbd16aa2d..6bf2b3dcbccb 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 4fc011d1d238..d3583ddce803 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 733de9d1230a..383250dba6ae 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 afb386ac60fd..92b82aedd8f0 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 ca4e47573c86..89e43c95ee33 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 04b7ad5c61f2..7e1c9b5296c6 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/ReinforcementTuningExample.java b/src/main/java/com/google/genai/types/ReinforcementTuningExample.java index 870156702876..091fe24433fd 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 f8ee63f4480d..aa4d4ae845d4 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 fd13bc57a689..f6555ee55b79 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(); }