From 19bb72022182a6a750b44747bb6de39f0337e743 Mon Sep 17 00:00:00 2001 From: Wanlin Du Date: Wed, 15 Jul 2026 18:13:09 -0700 Subject: [PATCH] feat: [GenerateContent] Add GenerationConfig.audio_transcription_config and Part.audio_transcription. PiperOrigin-RevId: 948653928 --- src/main/java/com/google/genai/Batches.java | 288 +++++++----- src/main/java/com/google/genai/Caches.java | 276 +++++------ .../java/com/google/genai/LiveConverters.java | 369 ++++++++------- src/main/java/com/google/genai/Models.java | 429 +++++++++++------- .../com/google/genai/TokensConverters.java | 139 +++--- src/main/java/com/google/genai/Tunings.java | 192 ++++---- .../genai/types/AudioTranscriptionConfig.java | 44 ++ .../google/genai/types/AutoraterConfig.java | 68 +-- .../java/com/google/genai/types/BatchJob.java | 60 +-- .../genai/types/BatchJobDestination.java | 74 +-- .../genai/types/BatchJobOutputInfo.java | 52 +-- .../google/genai/types/BatchJobSource.java | 52 +-- .../com/google/genai/types/ComputerUse.java | 48 +- .../genai/types/CreateTuningJobConfig.java | 80 ++-- .../com/google/genai/types/DatasetStats.java | 202 ++++----- .../types/DistillationHyperParameters.java | 130 +++--- .../genai/types/DistillationSamplingSpec.java | 100 ++-- .../google/genai/types/DistillationSpec.java | 104 ++--- .../java/com/google/genai/types/Document.java | 232 +++++----- .../genai/types/EmbedContentConfig.java | 64 +-- .../com/google/genai/types/FileSearch.java | 42 +- .../google/genai/types/FileSearchStore.java | 184 ++++---- .../com/google/genai/types/FunctionCall.java | 50 +- .../genai/types/FunctionDeclaration.java | 104 ++--- .../google/genai/types/FunctionResponse.java | 198 ++++---- .../genai/types/FunctionResponseBlob.java | 44 +- .../genai/types/FunctionResponseFileData.java | 58 +-- .../genai/types/FunctionResponsePart.java | 56 +-- .../genai/types/GenerateContentConfig.java | 121 +++-- .../google/genai/types/GenerationConfig.java | 137 ++++-- .../com/google/genai/types/GoogleSearch.java | 68 +-- .../google/genai/types/GroundingChunk.java | 64 +-- .../genai/types/GroundingChunkImage.java | 62 +-- .../types/GroundingChunkRetrievedContext.java | 52 +-- .../google/genai/types/GroundingMetadata.java | 80 ++-- .../com/google/genai/types/ImageConfig.java | 118 ++--- .../google/genai/types/LiveClientSetup.java | 64 +-- .../google/genai/types/LiveServerContent.java | 66 +-- .../java/com/google/genai/types/Part.java | 184 ++++---- .../java/com/google/genai/types/RagChunk.java | 88 ++-- .../ReinforcementTuningAutoraterScorer.java | 70 +-- ...TuningAutoraterScorerExactMatchScorer.java | 46 +- .../ReinforcementTuningHyperParameters.java | 194 ++++---- .../genai/types/ReinforcementTuningSpec.java | 98 ++-- ...orcementTuningStringMatchRewardScorer.java | 104 ++--- ...atchRewardScorerStringMatchExpression.java | 60 +-- .../google/genai/types/RetrievalConfig.java | 44 +- .../com/google/genai/types/SearchTypes.java | 60 +-- ...SingleReinforcementTuningRewardConfig.java | 162 +++---- .../java/com/google/genai/types/Tool.java | 332 +++++++------- .../com/google/genai/types/ToolConfig.java | 58 +-- .../com/google/genai/types/Transcription.java | 72 +++ .../google/genai/types/TuningDataStats.java | 66 +-- .../com/google/genai/types/TuningJob.java | 164 +++---- .../com/google/genai/types/UsageMetadata.java | 312 ++++++------- .../genai/types/VeoHyperParameters.java | 168 +++---- .../java/com/google/genai/types/WordInfo.java | 125 +++++ 57 files changed, 3788 insertions(+), 3190 deletions(-) create mode 100644 src/main/java/com/google/genai/types/WordInfo.java diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index d5cf780500e..de7cc322a83 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -64,6 +64,60 @@ public Batches(ApiClient apiClient) { this.apiClient = apiClient; } + @ExcludeFromGeneratedCoverageReport + ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"languageCodes"}))) { + throw new IllegalArgumentException( + "languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not" + + " in Gemini Developer API mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageAuto"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageAuto"}, + Common.getValueByPath(fromObject, new String[] {"languageAuto"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageHints"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageHints"}, + Common.getValueByPath(fromObject, new String[] {"languageHints"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"customVocabulary"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"customVocabulary"}, + Common.getValueByPath(fromObject, new String[] {"customVocabulary"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"adaptationPhrases"}, + Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"wordTimestamp"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"wordTimestamp"}, + Common.getValueByPath(fromObject, new String[] {"wordTimestamp"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"diarization"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"diarization"}, + Common.getValueByPath(fromObject, new String[] {"diarization"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -218,6 +272,16 @@ ObjectNode batchJobDestinationToVertex(JsonNode fromObject, ObjectNode parentObj Common.getValueByPath(fromObject, new String[] {"bigqueryUri"})); } + if (Common.getValueByPath(fromObject, new String[] {"vertexDataset"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"vertexMultimodalDatasetDestination"}, + vertexMultimodalDatasetDestinationToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"vertexDataset"})), + toObject)); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileName"}))) { throw new IllegalArgumentException( "fileName parameter is only supported in Gemini Developer API mode, not in Gemini" @@ -237,16 +301,6 @@ ObjectNode batchJobDestinationToVertex(JsonNode fromObject, ObjectNode parentObj + " not in Gemini Enterprise Agent Platform mode."); } - if (Common.getValueByPath(fromObject, new String[] {"vertexDataset"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"vertexMultimodalDatasetDestination"}, - vertexMultimodalDatasetDestinationToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"vertexDataset"})), - toObject)); - } - return toObject; } @@ -404,18 +458,18 @@ ObjectNode batchJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { toObject)); } - if (Common.getValueByPath(fromObject, new String[] {"completionStats"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"outputInfo"}) != null) { Common.setValueByPath( toObject, - new String[] {"completionStats"}, - Common.getValueByPath(fromObject, new String[] {"completionStats"})); + new String[] {"outputInfo"}, + Common.getValueByPath(fromObject, new String[] {"outputInfo"})); } - if (Common.getValueByPath(fromObject, new String[] {"outputInfo"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"completionStats"}) != null) { Common.setValueByPath( toObject, - new String[] {"outputInfo"}, - Common.getValueByPath(fromObject, new String[] {"outputInfo"})); + new String[] {"completionStats"}, + Common.getValueByPath(fromObject, new String[] {"completionStats"})); } return toObject; @@ -480,6 +534,12 @@ ObjectNode batchJobSourceToMldev( + " Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"}))) { + throw new IllegalArgumentException( + "vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode," + + " not in Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"fileName"}) != null) { Common.setValueByPath( toObject, @@ -499,12 +559,6 @@ ObjectNode batchJobSourceToMldev( Common.setValueByPath(toObject, new String[] {"requests", "requests"}, result); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"}))) { - throw new IllegalArgumentException( - "vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode," - + " not in Gemini Developer API mode."); - } - return toObject; } @@ -532,6 +586,13 @@ ObjectNode batchJobSourceToVertex(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"bigqueryUri"})); } + if (Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"vertexMultimodalDatasetSource", "datasetName"}, + Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileName"}))) { throw new IllegalArgumentException( "fileName parameter is only supported in Gemini Developer API mode, not in Gemini" @@ -544,13 +605,6 @@ ObjectNode batchJobSourceToVertex(JsonNode fromObject, ObjectNode parentObject) + " Enterprise Agent Platform mode."); } - if (Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"vertexMultimodalDatasetSource", "datasetName"}, - Common.getValueByPath(fromObject, new String[] {"vertexDatasetName"})); - } - return toObject; } @@ -1027,6 +1081,7 @@ 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, @@ -1129,11 +1184,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { - Common.setValueByPath( - toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); - } - if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) { Common.setValueByPath( toObject, @@ -1141,6 +1191,11 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"args"})); } + if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { + Common.setValueByPath( + toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); + } + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -1195,6 +1250,13 @@ ObjectNode generateContentConfigToMldev( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"serviceTier"}, + Common.getValueByPath(fromObject, new String[] {"serviceTier"})); + } + if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { Common.setValueByPath( parentObject, @@ -1400,6 +1462,16 @@ ObjectNode generateContentConfigToMldev( Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + audioTranscriptionConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"imageConfig"}) != null) { Common.setValueByPath( toObject, @@ -1423,13 +1495,6 @@ ObjectNode generateContentConfigToMldev( + " not in Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"serviceTier"}, - Common.getValueByPath(fromObject, new String[] {"serviceTier"})); - } - return toObject; } @@ -1549,13 +1614,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"searchTypes"}, - Common.getValueByPath(fromObject, new String[] {"searchTypes"})); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( "blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -1568,6 +1626,13 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { + " in Gemini Developer API mode."); } + if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"searchTypes"}, + Common.getValueByPath(fromObject, new String[] {"searchTypes"})); + } + if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { Common.setValueByPath( toObject, @@ -1601,12 +1666,6 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + " not in Gemini Developer API mode."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"prominentPeople"}))) { - throw new IllegalArgumentException( - "prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode," - + " not in Gemini Developer API mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"outputMimeType"}))) { throw new IllegalArgumentException( "outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not" @@ -1626,6 +1685,12 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + " not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"prominentPeople"}))) { + throw new IllegalArgumentException( + "prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode," + + " not in Gemini Developer API mode."); + } + return toObject; } @@ -1866,6 +1931,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCall"}, + Common.getValueByPath(fromObject, new String[] {"toolCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolResponse"}, + Common.getValueByPath(fromObject, new String[] {"toolResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -1945,20 +2031,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolCall"}, - Common.getValueByPath(fromObject, new String[] {"toolCall"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolResponse"}, - Common.getValueByPath(fromObject, new String[] {"toolResponse"})); - } - if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { Common.setValueByPath( toObject, @@ -1998,13 +2070,6 @@ ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"retrievalConfig"}, - Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); - } - if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( toObject, @@ -2015,6 +2080,13 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"retrievalConfig"}, + Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"includeServerSideToolInvocations"}) != null) { Common.setValueByPath( @@ -2035,30 +2107,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { + " Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileSearch"}, - Common.getValueByPath(fromObject, new String[] {"fileSearch"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - googleSearchToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, @@ -2069,6 +2117,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -2076,12 +2131,25 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"computerUse"}, + Common.getValueByPath(fromObject, new String[] {"computerUse"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) { throw new IllegalArgumentException( "enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform" + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { + throw new IllegalArgumentException( + "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" + + " Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -2089,6 +2157,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + googleSearchToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleSearch"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -2109,17 +2187,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { Common.setValueByPath( toObject, - new String[] {"mcpServers"}, - Common.getValueByPath(fromObject, new String[] {"mcpServers"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { - throw new IllegalArgumentException( - "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); + new String[] {"fileSearch"}, + Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } return toObject; diff --git a/src/main/java/com/google/genai/Caches.java b/src/main/java/com/google/genai/Caches.java index ca3b25b67e4..25931f807bb 100644 --- a/src/main/java/com/google/genai/Caches.java +++ b/src/main/java/com/google/genai/Caches.java @@ -164,6 +164,14 @@ ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObj @ExcludeFromGeneratedCoverageReport ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) + != null) { + Common.setValueByPath( + toObject, + new String[] {"enablePromptInjectionDetection"}, + Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); + } + if (Common.getValueByPath(fromObject, new String[] {"environment"}) != null) { Common.setValueByPath( toObject, @@ -178,14 +186,6 @@ ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"excludedPredefinedFunctions"})); } - if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) - != null) { - Common.setValueByPath( - toObject, - new String[] {"enablePromptInjectionDetection"}, - Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); - } - if (!Common.isZero( Common.getValueByPath(fromObject, new String[] {"disabledSafetyPolicies"}))) { throw new IllegalArgumentException( @@ -560,11 +560,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { - Common.setValueByPath( - toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); - } - if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) { Common.setValueByPath( toObject, @@ -572,6 +567,11 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"args"})); } + if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { + Common.setValueByPath( + toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); + } + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -677,13 +677,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"searchTypes"}, - Common.getValueByPath(fromObject, new String[] {"searchTypes"})); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( "blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -696,6 +689,13 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { + " in Gemini Developer API mode."); } + if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"searchTypes"}, + Common.getValueByPath(fromObject, new String[] {"searchTypes"})); + } + if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { Common.setValueByPath( toObject, @@ -859,6 +859,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCall"}, + Common.getValueByPath(fromObject, new String[] {"toolCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolResponse"}, + Common.getValueByPath(fromObject, new String[] {"toolResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -938,20 +959,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolCall"}, - Common.getValueByPath(fromObject, new String[] {"toolCall"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolResponse"}, - Common.getValueByPath(fromObject, new String[] {"toolResponse"})); - } - if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { Common.setValueByPath( toObject, @@ -972,6 +979,25 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { + throw new IllegalArgumentException( + "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { + throw new IllegalArgumentException( + "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -1048,18 +1074,6 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { - throw new IllegalArgumentException( - "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { - throw new IllegalArgumentException( - "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { throw new IllegalArgumentException( "partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini" @@ -1072,13 +1086,6 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"retrievalConfig"}, - Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); - } - if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( toObject, @@ -1089,6 +1096,13 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"retrievalConfig"}, + Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"includeServerSideToolInvocations"}) != null) { Common.setValueByPath( @@ -1103,18 +1117,18 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( toObject, - new String[] {"retrievalConfig"}, - Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); + new String[] {"functionCallingConfig"}, + Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})); } - if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { Common.setValueByPath( toObject, - new String[] {"functionCallingConfig"}, - Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})); + new String[] {"retrievalConfig"}, + Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); } if (!Common.isZero( @@ -1136,30 +1150,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { + " Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileSearch"}, - Common.getValueByPath(fromObject, new String[] {"fileSearch"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - googleSearchToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, @@ -1170,6 +1160,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -1177,12 +1174,25 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"computerUse"}, + Common.getValueByPath(fromObject, new String[] {"computerUse"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) { throw new IllegalArgumentException( "enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform" + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { + throw new IllegalArgumentException( + "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" + + " Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -1190,6 +1200,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + googleSearchToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleSearch"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -1210,17 +1230,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { Common.setValueByPath( toObject, - new String[] {"mcpServers"}, - Common.getValueByPath(fromObject, new String[] {"mcpServers"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { - throw new IllegalArgumentException( - "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); + new String[] {"fileSearch"}, + Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } return toObject; @@ -1236,41 +1250,40 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"retrieval"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, - new String[] {"computerUse"}, - computerUseToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"computerUse"})), - toObject)); + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { - throw new IllegalArgumentException( - "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + ArrayNode keyArray = + (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + for (JsonNode item : keyArray) { + result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + new String[] {"codeExecution"}, + Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { Common.setValueByPath( toObject, - new String[] {"codeExecution"}, - Common.getValueByPath(fromObject, new String[] {"codeExecution"})); + new String[] {"computerUse"}, + computerUseToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"computerUse"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}) != null) { @@ -1280,6 +1293,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"exaAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -1287,6 +1307,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -1308,23 +1335,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { - ArrayNode keyArray = - (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); - ObjectMapper objectMapper = new ObjectMapper(); - ArrayNode result = objectMapper.createArrayNode(); - - for (JsonNode item : keyArray) { - result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject)); - } - Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); - } - - if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"exaAiSearch"}, - Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { + throw new IllegalArgumentException( + "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); } return toObject; diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 56ea4c4cc49..c2c889dff9a 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -68,6 +68,20 @@ ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode paren Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"})); } + if (Common.getValueByPath(fromObject, new String[] {"wordTimestamp"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"wordTimestamp"}, + Common.getValueByPath(fromObject, new String[] {"wordTimestamp"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"diarization"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"diarization"}, + Common.getValueByPath(fromObject, new String[] {"diarization"})); + } + return toObject; } @@ -176,6 +190,14 @@ ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObj @ExcludeFromGeneratedCoverageReport ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) + != null) { + Common.setValueByPath( + toObject, + new String[] {"enablePromptInjectionDetection"}, + Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); + } + if (Common.getValueByPath(fromObject, new String[] {"environment"}) != null) { Common.setValueByPath( toObject, @@ -190,14 +212,6 @@ ObjectNode computerUseToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"excludedPredefinedFunctions"})); } - if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) - != null) { - Common.setValueByPath( - toObject, - new String[] {"enablePromptInjectionDetection"}, - Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); - } - if (!Common.isZero( Common.getValueByPath(fromObject, new String[] {"disabledSafetyPolicies"}))) { throw new IllegalArgumentException( @@ -311,11 +325,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { - Common.setValueByPath( - toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); - } - if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) { Common.setValueByPath( toObject, @@ -323,6 +332,11 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"args"})); } + if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { + Common.setValueByPath( + toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); + } + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -362,6 +376,13 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.getValueByPath(fromObject, new String[] {"responseJsonSchema"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { Common.setValueByPath( toObject, @@ -418,6 +439,13 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.getValueByPath(fromObject, new String[] {"presencePenalty"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseFormat"}, + Common.getValueByPath(fromObject, new String[] {"responseFormat"})); + } + if (Common.getValueByPath(fromObject, new String[] {"responseLogprobs"}) != null) { Common.setValueByPath( toObject, @@ -512,13 +540,6 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject + " in Gemini Enterprise Agent Platform mode."); } - if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"responseFormat"}, - 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" @@ -554,13 +575,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"searchTypes"}, - Common.getValueByPath(fromObject, new String[] {"searchTypes"})); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( "blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -573,6 +587,13 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { + " in Gemini Developer API mode."); } + if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"searchTypes"}, + Common.getValueByPath(fromObject, new String[] {"searchTypes"})); + } + if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { Common.setValueByPath( toObject, @@ -949,6 +970,13 @@ ObjectNode liveClientSetupToMldev(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"proactivity"})); } + if (Common.getValueByPath(fromObject, new String[] {"historyConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"historyConfig"}, + Common.getValueByPath(fromObject, new String[] {"historyConfig"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}))) { throw new IllegalArgumentException( "explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -974,13 +1002,6 @@ ObjectNode liveClientSetupToMldev(JsonNode fromObject, ObjectNode parentObject) Common.setValueByPath(toObject, new String[] {"safetySettings"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"historyConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"historyConfig"}, - Common.getValueByPath(fromObject, new String[] {"historyConfig"})); - } - return toObject; } @@ -1070,6 +1091,13 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"proactivity"})); } + if (Common.getValueByPath(fromObject, new String[] {"historyConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"historyConfig"}, + Common.getValueByPath(fromObject, new String[] {"historyConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}) != null) { Common.setValueByPath( toObject, @@ -1091,13 +1119,6 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"safetySettings"})); } - if (Common.getValueByPath(fromObject, new String[] {"historyConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"historyConfig"}, - Common.getValueByPath(fromObject, new String[] {"historyConfig"})); - } - return toObject; } @@ -1828,6 +1849,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCall"}, + Common.getValueByPath(fromObject, new String[] {"toolCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolResponse"}, + Common.getValueByPath(fromObject, new String[] {"toolResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -1907,20 +1949,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolCall"}, - Common.getValueByPath(fromObject, new String[] {"toolCall"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolResponse"}, - Common.getValueByPath(fromObject, new String[] {"toolResponse"})); - } - if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { Common.setValueByPath( toObject, @@ -1941,6 +1969,25 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { + throw new IllegalArgumentException( + "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { + throw new IllegalArgumentException( + "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -2017,18 +2064,6 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { - throw new IllegalArgumentException( - "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { - throw new IllegalArgumentException( - "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { throw new IllegalArgumentException( "partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini" @@ -2180,30 +2215,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { + " Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileSearch"}, - Common.getValueByPath(fromObject, new String[] {"fileSearch"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - googleSearchToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, @@ -2214,6 +2225,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -2221,12 +2239,25 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"computerUse"}, + Common.getValueByPath(fromObject, new String[] {"computerUse"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) { throw new IllegalArgumentException( "enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform" + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { + throw new IllegalArgumentException( + "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" + + " Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -2234,6 +2265,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + googleSearchToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleSearch"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -2254,17 +2295,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { Common.setValueByPath( toObject, - new String[] {"mcpServers"}, - Common.getValueByPath(fromObject, new String[] {"mcpServers"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { - throw new IllegalArgumentException( - "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); + new String[] {"fileSearch"}, + Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } return toObject; @@ -2280,41 +2315,40 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"retrieval"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, - new String[] {"computerUse"}, - computerUseToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"computerUse"})), - toObject)); + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { - throw new IllegalArgumentException( - "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + ArrayNode keyArray = + (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + for (JsonNode item : keyArray) { + result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + new String[] {"codeExecution"}, + Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { Common.setValueByPath( toObject, - new String[] {"codeExecution"}, - Common.getValueByPath(fromObject, new String[] {"codeExecution"})); + new String[] {"computerUse"}, + computerUseToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"computerUse"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}) != null) { @@ -2324,6 +2358,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"exaAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -2331,6 +2372,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -2352,23 +2400,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { - ArrayNode keyArray = - (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); - ObjectMapper objectMapper = new ObjectMapper(); - ArrayNode result = objectMapper.createArrayNode(); - - for (JsonNode item : keyArray) { - result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject)); - } - Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); - } - - if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"exaAiSearch"}, - Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { + throw new IllegalArgumentException( + "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); } return toObject; @@ -2377,46 +2412,39 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode usageMetadataFromVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"promptTokenCount"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"promptTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"promptTokenCount"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"cachedContentTokenCount"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"candidatesTokenCount"}) != null) { Common.setValueByPath( toObject, - new String[] {"cachedContentTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"cachedContentTokenCount"})); + new String[] {"responseTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"candidatesTokenCount"})); } - if (Common.getValueByPath(fromObject, new String[] {"candidatesTokenCount"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"candidatesTokensDetails"}) != null) { Common.setValueByPath( toObject, - new String[] {"responseTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"candidatesTokenCount"})); + new String[] {"responseTokensDetails"}, + Common.getValueByPath(fromObject, new String[] {"candidatesTokensDetails"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokenCount"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"cacheTokensDetails"}) != null) { Common.setValueByPath( toObject, - new String[] {"toolUsePromptTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokenCount"})); + new String[] {"cacheTokensDetails"}, + Common.getValueByPath(fromObject, new String[] {"cacheTokensDetails"})); } - if (Common.getValueByPath(fromObject, new String[] {"thoughtsTokenCount"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"cachedContentTokenCount"}) != null) { Common.setValueByPath( toObject, - new String[] {"thoughtsTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"thoughtsTokenCount"})); + new String[] {"cachedContentTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"cachedContentTokenCount"})); } - if (Common.getValueByPath(fromObject, new String[] {"totalTokenCount"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"promptTokenCount"}) != null) { Common.setValueByPath( toObject, - new String[] {"totalTokenCount"}, - Common.getValueByPath(fromObject, new String[] {"totalTokenCount"})); + new String[] {"promptTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"promptTokenCount"})); } if (Common.getValueByPath(fromObject, new String[] {"promptTokensDetails"}) != null) { @@ -2426,18 +2454,18 @@ ObjectNode usageMetadataFromVertex(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"promptTokensDetails"})); } - if (Common.getValueByPath(fromObject, new String[] {"cacheTokensDetails"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"thoughtsTokenCount"}) != null) { Common.setValueByPath( toObject, - new String[] {"cacheTokensDetails"}, - Common.getValueByPath(fromObject, new String[] {"cacheTokensDetails"})); + new String[] {"thoughtsTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"thoughtsTokenCount"})); } - if (Common.getValueByPath(fromObject, new String[] {"candidatesTokensDetails"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokenCount"}) != null) { Common.setValueByPath( toObject, - new String[] {"responseTokensDetails"}, - Common.getValueByPath(fromObject, new String[] {"candidatesTokensDetails"})); + new String[] {"toolUsePromptTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokenCount"})); } if (Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokensDetails"}) != null) { @@ -2447,6 +2475,13 @@ ObjectNode usageMetadataFromVertex(JsonNode fromObject, ObjectNode parentObject) Common.getValueByPath(fromObject, new String[] {"toolUsePromptTokensDetails"})); } + if (Common.getValueByPath(fromObject, new String[] {"totalTokenCount"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"totalTokenCount"}, + Common.getValueByPath(fromObject, new String[] {"totalTokenCount"})); + } + if (Common.getValueByPath(fromObject, new String[] {"trafficType"}) != null) { Common.setValueByPath( toObject, diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 994dc6ab6ee..52bb2e44bce 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -145,6 +145,61 @@ void videoGenerationReferenceTypeMldevEnumValidate(Object enumValue) { } } + @ExcludeFromGeneratedCoverageReport + ObjectNode audioTranscriptionConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"languageCodes"}))) { + throw new IllegalArgumentException( + "languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not" + + " in Gemini Developer API mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageAuto"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageAuto"}, + Common.getValueByPath(fromObject, new String[] {"languageAuto"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageHints"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageHints"}, + Common.getValueByPath(fromObject, new String[] {"languageHints"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"customVocabulary"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"customVocabulary"}, + Common.getValueByPath(fromObject, new String[] {"customVocabulary"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"adaptationPhrases"}, + Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"wordTimestamp"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"wordTimestamp"}, + Common.getValueByPath(fromObject, new String[] {"wordTimestamp"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"diarization"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"diarization"}, + Common.getValueByPath(fromObject, new String[] {"diarization"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -395,6 +450,14 @@ ObjectNode computeTokensResponseFromVertex( ObjectNode computerUseToVertex( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) + != null) { + Common.setValueByPath( + toObject, + new String[] {"enablePromptInjectionDetection"}, + Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); + } + if (Common.getValueByPath(fromObject, new String[] {"environment"}) != null) { Common.setValueByPath( toObject, @@ -409,14 +472,6 @@ ObjectNode computerUseToVertex( Common.getValueByPath(fromObject, new String[] {"excludedPredefinedFunctions"})); } - if (Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"}) - != null) { - Common.setValueByPath( - toObject, - new String[] {"enablePromptInjectionDetection"}, - Common.getValueByPath(fromObject, new String[] {"enablePromptInjectionDetection"})); - } - if (!Common.isZero( Common.getValueByPath(fromObject, new String[] {"disabledSafetyPolicies"}))) { throw new IllegalArgumentException( @@ -1000,6 +1055,7 @@ 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, @@ -1450,11 +1506,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNod ObjectNode functionCallToMldev( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { - Common.setValueByPath( - toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); - } - if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) { Common.setValueByPath( toObject, @@ -1462,6 +1513,11 @@ ObjectNode functionCallToMldev( Common.getValueByPath(fromObject, new String[] {"args"})); } + if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { + Common.setValueByPath( + toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); + } + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -1517,6 +1573,13 @@ ObjectNode generateContentConfigToMldev( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"serviceTier"}, + Common.getValueByPath(fromObject, new String[] {"serviceTier"})); + } + if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { Common.setValueByPath( parentObject, @@ -1726,6 +1789,17 @@ ObjectNode generateContentConfigToMldev( Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + audioTranscriptionConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})), + toObject, + rootObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"imageConfig"}) != null) { Common.setValueByPath( toObject, @@ -1750,13 +1824,6 @@ ObjectNode generateContentConfigToMldev( + " not in Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"serviceTier"}, - Common.getValueByPath(fromObject, new String[] {"serviceTier"})); - } - return toObject; } @@ -1765,6 +1832,13 @@ ObjectNode generateContentConfigToVertex( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"serviceTier"}, + Common.getValueByPath(fromObject, new String[] {"serviceTier"})); + } + if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { Common.setValueByPath( parentObject, @@ -1977,6 +2051,13 @@ ObjectNode generateContentConfigToVertex( Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"imageConfig"}) != null) { Common.setValueByPath( toObject, @@ -2002,13 +2083,6 @@ ObjectNode generateContentConfigToVertex( Common.getValueByPath(fromObject, new String[] {"modelArmorConfig"})); } - if (Common.getValueByPath(fromObject, new String[] {"serviceTier"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"serviceTier"}, - Common.getValueByPath(fromObject, new String[] {"serviceTier"})); - } - return toObject; } @@ -3415,6 +3489,13 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"responseJsonSchema"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { Common.setValueByPath( toObject, @@ -3471,6 +3552,13 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"presencePenalty"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseFormat"}, + Common.getValueByPath(fromObject, new String[] {"responseFormat"})); + } + if (Common.getValueByPath(fromObject, new String[] {"responseLogprobs"}) != null) { Common.setValueByPath( toObject, @@ -3566,13 +3654,6 @@ ObjectNode generationConfigToVertex( + " in Gemini Enterprise Agent Platform mode."); } - if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"responseFormat"}, - 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" @@ -3640,13 +3721,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject, JsonN ObjectNode googleSearchToMldev( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"searchTypes"}, - Common.getValueByPath(fromObject, new String[] {"searchTypes"})); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( "blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -3659,6 +3733,13 @@ ObjectNode googleSearchToMldev( + " in Gemini Developer API mode."); } + if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"searchTypes"}, + Common.getValueByPath(fromObject, new String[] {"searchTypes"})); + } + if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { Common.setValueByPath( toObject, @@ -3692,12 +3773,6 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject, Json + " not in Gemini Developer API mode."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"prominentPeople"}))) { - throw new IllegalArgumentException( - "prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode," - + " not in Gemini Developer API mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"outputMimeType"}))) { throw new IllegalArgumentException( "outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not" @@ -3717,6 +3792,12 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject, Json + " not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"prominentPeople"}))) { + throw new IllegalArgumentException( + "prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode," + + " not in Gemini Developer API mode."); + } + return toObject; } @@ -3745,13 +3826,6 @@ ObjectNode imageConfigToVertex( Common.getValueByPath(fromObject, new String[] {"personGeneration"})); } - if (Common.getValueByPath(fromObject, new String[] {"prominentPeople"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"prominentPeople"}, - Common.getValueByPath(fromObject, new String[] {"prominentPeople"})); - } - if (Common.getValueByPath(fromObject, new String[] {"outputMimeType"}) != null) { Common.setValueByPath( toObject, @@ -3773,6 +3847,13 @@ ObjectNode imageConfigToVertex( Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"})); } + if (Common.getValueByPath(fromObject, new String[] {"prominentPeople"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"prominentPeople"}, + Common.getValueByPath(fromObject, new String[] {"prominentPeople"})); + } + return toObject; } @@ -4309,6 +4390,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCall"}, + Common.getValueByPath(fromObject, new String[] {"toolCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolResponse"}, + Common.getValueByPath(fromObject, new String[] {"toolResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -4391,20 +4493,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolCall"}, - Common.getValueByPath(fromObject, new String[] {"toolCall"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolResponse"}, - Common.getValueByPath(fromObject, new String[] {"toolResponse"})); - } - if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { Common.setValueByPath( toObject, @@ -4425,6 +4513,25 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { + throw new IllegalArgumentException( + "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { + throw new IllegalArgumentException( + "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -4503,18 +4610,6 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolCall"}))) { - throw new IllegalArgumentException( - "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"toolResponse"}))) { - throw new IllegalArgumentException( - "toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { throw new IllegalArgumentException( "partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini" @@ -5124,13 +5219,6 @@ ObjectNode speechConfigToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"retrievalConfig"}, - Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); - } - if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( toObject, @@ -5142,6 +5230,13 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonN rootObject)); } + if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"retrievalConfig"}, + Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"includeServerSideToolInvocations"}) != null) { Common.setValueByPath( @@ -5156,18 +5251,18 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonN @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( toObject, - new String[] {"retrievalConfig"}, - Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); + new String[] {"functionCallingConfig"}, + Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})); } - if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { Common.setValueByPath( toObject, - new String[] {"functionCallingConfig"}, - Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})); + new String[] {"retrievalConfig"}, + Common.getValueByPath(fromObject, new String[] {"retrievalConfig"})); } if (!Common.isZero( @@ -5189,31 +5284,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro + " Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileSearch"}, - Common.getValueByPath(fromObject, new String[] {"fileSearch"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - googleSearchToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject, - rootObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, @@ -5225,6 +5295,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro rootObject)); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -5232,12 +5309,25 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"computerUse"}, + Common.getValueByPath(fromObject, new String[] {"computerUse"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) { throw new IllegalArgumentException( "enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform" + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { + throw new IllegalArgumentException( + "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" + + " Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -5245,6 +5335,17 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + googleSearchToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleSearch"})), + toObject, + rootObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -5265,17 +5366,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { Common.setValueByPath( toObject, - new String[] {"mcpServers"}, - Common.getValueByPath(fromObject, new String[] {"mcpServers"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { - throw new IllegalArgumentException( - "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); + new String[] {"fileSearch"}, + Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } return toObject; @@ -5291,42 +5386,41 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"retrieval"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, - new String[] {"computerUse"}, - computerUseToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"computerUse"})), - toObject, - rootObject)); + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { - throw new IllegalArgumentException( - "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" - + " Enterprise Agent Platform mode."); - } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + ArrayNode keyArray = + (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + for (JsonNode item : keyArray) { + result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); + } + Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + new String[] {"codeExecution"}, + Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { Common.setValueByPath( toObject, - new String[] {"codeExecution"}, - Common.getValueByPath(fromObject, new String[] {"codeExecution"})); + new String[] {"computerUse"}, + computerUseToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"computerUse"})), + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}) != null) { @@ -5336,6 +5430,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"exaAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -5343,6 +5444,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + Common.getValueByPath(fromObject, new String[] {"googleSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -5364,23 +5472,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { - ArrayNode keyArray = - (ArrayNode) Common.getValueByPath(fromObject, new String[] {"mcpServers"}); - ObjectMapper objectMapper = new ObjectMapper(); - ArrayNode result = objectMapper.createArrayNode(); - - for (JsonNode item : keyArray) { - result.add(mcpServerToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); - } - Common.setValueByPath(toObject, new String[] {"mcpServers"}, result); - } - - if (Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"exaAiSearch"}, - Common.getValueByPath(fromObject, new String[] {"exaAiSearch"})); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"fileSearch"}))) { + throw new IllegalArgumentException( + "fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); } return toObject; diff --git a/src/main/java/com/google/genai/TokensConverters.java b/src/main/java/com/google/genai/TokensConverters.java index ed18412e544..e81ebc10cae 100644 --- a/src/main/java/com/google/genai/TokensConverters.java +++ b/src/main/java/com/google/genai/TokensConverters.java @@ -68,6 +68,20 @@ ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode paren Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"})); } + if (Common.getValueByPath(fromObject, new String[] {"wordTimestamp"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"wordTimestamp"}, + Common.getValueByPath(fromObject, new String[] {"wordTimestamp"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"diarization"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"diarization"}, + Common.getValueByPath(fromObject, new String[] {"diarization"})); + } + return toObject; } @@ -277,11 +291,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { - Common.setValueByPath( - toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); - } - if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) { Common.setValueByPath( toObject, @@ -289,6 +298,11 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"args"})); } + if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { + Common.setValueByPath( + toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"})); + } + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -337,13 +351,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"searchTypes"}, - Common.getValueByPath(fromObject, new String[] {"searchTypes"})); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( "blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode," @@ -356,6 +363,13 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { + " in Gemini Developer API mode."); } + if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"searchTypes"}, + Common.getValueByPath(fromObject, new String[] {"searchTypes"})); + } + if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { Common.setValueByPath( toObject, @@ -586,6 +600,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); } + if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCall"}, + Common.getValueByPath(fromObject, new String[] {"toolCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolResponse"}, + Common.getValueByPath(fromObject, new String[] {"toolResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"audioTranscription"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscription"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscription"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { Common.setValueByPath( toObject, @@ -665,20 +700,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"toolCall"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolCall"}, - Common.getValueByPath(fromObject, new String[] {"toolCall"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"toolResponse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"toolResponse"}, - Common.getValueByPath(fromObject, new String[] {"toolResponse"})); - } - if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { Common.setValueByPath( toObject, @@ -743,30 +764,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { + " Gemini Developer API mode."); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"fileSearch"}, - Common.getValueByPath(fromObject, new String[] {"fileSearch"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleSearch"}, - googleSearchToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { Common.setValueByPath( toObject, @@ -777,6 +774,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -784,12 +788,25 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } + if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"computerUse"}, + Common.getValueByPath(fromObject, new String[] {"computerUse"})); + } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) { throw new IllegalArgumentException( "enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform" + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { + throw new IllegalArgumentException( + "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" + + " Gemini Developer API mode."); + } + if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( toObject, @@ -797,6 +814,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleSearch"}, + googleSearchToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleSearch"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) { Common.setValueByPath( toObject, @@ -817,17 +844,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } - if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"fileSearch"}) != null) { Common.setValueByPath( toObject, - new String[] {"mcpServers"}, - Common.getValueByPath(fromObject, new String[] {"mcpServers"})); - } - - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) { - throw new IllegalArgumentException( - "exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in" - + " Gemini Developer API mode."); + new String[] {"fileSearch"}, + Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } return toObject; diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index b54595a3470..5b1b96d4703 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -241,12 +241,6 @@ ObjectNode createTuningJobConfigToMldev( + " Gemini Developer API mode."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}))) { - throw new IllegalArgumentException( - "encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not" - + " in Gemini Developer API mode."); - } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"rewardConfig"}))) { throw new IllegalArgumentException( "rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not" @@ -295,6 +289,12 @@ ObjectNode createTuningJobConfigToMldev( + " mode, not in Gemini Developer API mode."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}))) { + throw new IllegalArgumentException( + "encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not" + + " in Gemini Developer API mode."); + } + return toObject; } @@ -666,13 +666,6 @@ ObjectNode createTuningJobConfigToVertex( Common.getValueByPath(fromObject, new String[] {"outputUri"})); } - if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"encryptionSpec"}, - Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); - } - if (Common.getValueByPath(fromObject, new String[] {"rewardConfig"}) != null) { Common.setValueByPath( parentObject, @@ -729,6 +722,13 @@ ObjectNode createTuningJobConfigToVertex( Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"})); } + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + return toObject; } @@ -814,13 +814,6 @@ ObjectNode createTuningJobParametersPrivateToVertex( ObjectNode distillationHyperParametersFromVertex( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"adapterSize"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"adapterSize"}, - Common.getValueByPath(fromObject, new String[] {"adapterSize"})); - } - if (Common.getValueByPath(fromObject, new String[] {"epochCount"}) != null) { Common.setValueByPath( toObject, @@ -835,15 +828,18 @@ ObjectNode distillationHyperParametersFromVertex( Common.getValueByPath(fromObject, new String[] {"learningRateMultiplier"})); } - if (Common.getValueByPath(fromObject, new String[] {"generationConfig"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"adapterSize"}) != null) { Common.setValueByPath( toObject, - new String[] {"generationConfig"}, - generationConfigFromVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"generationConfig"})), - toObject, - rootObject)); + new String[] {"adapterSize"}, + Common.getValueByPath(fromObject, new String[] {"adapterSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"batchSize"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"batchSize"}, + Common.getValueByPath(fromObject, new String[] {"batchSize"})); } if (Common.getValueByPath(fromObject, new String[] {"learningRate"}) != null) { @@ -853,11 +849,15 @@ ObjectNode distillationHyperParametersFromVertex( Common.getValueByPath(fromObject, new String[] {"learningRate"})); } - if (Common.getValueByPath(fromObject, new String[] {"batchSize"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"generationConfig"}) != null) { Common.setValueByPath( toObject, - new String[] {"batchSize"}, - Common.getValueByPath(fromObject, new String[] {"batchSize"})); + new String[] {"generationConfig"}, + generationConfigFromVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"generationConfig"})), + toObject, + rootObject)); } return toObject; @@ -867,32 +867,32 @@ ObjectNode distillationHyperParametersFromVertex( ObjectNode distillationSamplingSpecFromVertex( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"baseTeacherModel"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"}) != null) { Common.setValueByPath( toObject, - new String[] {"baseTeacherModel"}, - Common.getValueByPath(fromObject, new String[] {"baseTeacherModel"})); + new String[] {"promptDatasetUri"}, + Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"})); } - if (Common.getValueByPath(fromObject, new String[] {"tunedTeacherModelSource"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"}) != null) { Common.setValueByPath( toObject, - new String[] {"tunedTeacherModelSource"}, - Common.getValueByPath(fromObject, new String[] {"tunedTeacherModelSource"})); + new String[] {"validationDatasetUri"}, + Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"})); } - if (Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"baseTeacherModel"}) != null) { Common.setValueByPath( toObject, - new String[] {"validationDatasetUri"}, - Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"})); + new String[] {"baseTeacherModel"}, + Common.getValueByPath(fromObject, new String[] {"baseTeacherModel"})); } - if (Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"tunedTeacherModelSource"}) != null) { Common.setValueByPath( toObject, - new String[] {"promptDatasetUri"}, - Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"})); + new String[] {"tunedTeacherModelSource"}, + Common.getValueByPath(fromObject, new String[] {"tunedTeacherModelSource"})); } if (Common.getValueByPath(fromObject, new String[] {"hyperparameters"}) != null) { @@ -913,13 +913,6 @@ ObjectNode distillationSamplingSpecFromVertex( ObjectNode distillationSpecFromVertex( JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"promptDatasetUri"}, - Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"})); - } - if (Common.getValueByPath(fromObject, new String[] {"baseTeacherModel"}) != null) { Common.setValueByPath( toObject, @@ -945,6 +938,13 @@ ObjectNode distillationSpecFromVertex( Common.getValueByPath(fromObject, new String[] {"pipelineRootDirectory"})); } + if (Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"promptDatasetUri"}, + Common.getValueByPath(fromObject, new String[] {"promptDatasetUri"})); + } + if (Common.getValueByPath(fromObject, new String[] {"studentModel"}) != null) { Common.setValueByPath( toObject, @@ -966,18 +966,18 @@ ObjectNode distillationSpecFromVertex( Common.getValueByPath(fromObject, new String[] {"tunedTeacherModelSource"})); } - if (Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"tuningMode"}) != null) { Common.setValueByPath( toObject, - new String[] {"validationDatasetUri"}, - Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"})); + new String[] {"tuningMode"}, + Common.getValueByPath(fromObject, new String[] {"tuningMode"})); } - if (Common.getValueByPath(fromObject, new String[] {"tuningMode"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"}) != null) { Common.setValueByPath( toObject, - new String[] {"tuningMode"}, - Common.getValueByPath(fromObject, new String[] {"tuningMode"})); + new String[] {"validationDatasetUri"}, + Common.getValueByPath(fromObject, new String[] {"validationDatasetUri"})); } return toObject; @@ -1079,6 +1079,13 @@ ObjectNode generationConfigFromVertex( Common.getValueByPath(fromObject, new String[] {"responseJsonSchema"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { Common.setValueByPath( toObject, @@ -1135,6 +1142,13 @@ ObjectNode generationConfigFromVertex( Common.getValueByPath(fromObject, new String[] {"presencePenalty"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseFormat"}, + Common.getValueByPath(fromObject, new String[] {"responseFormat"})); + } + if (Common.getValueByPath(fromObject, new String[] {"responseLogprobs"}) != null) { Common.setValueByPath( toObject, @@ -1219,13 +1233,6 @@ ObjectNode generationConfigFromVertex( Common.getValueByPath(fromObject, new String[] {"topP"})); } - if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"responseFormat"}, - Common.getValueByPath(fromObject, new String[] {"responseFormat"})); - } - return toObject; } @@ -1247,6 +1254,13 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"responseJsonSchema"})); } + if (Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"audioTranscriptionConfig"}, + Common.getValueByPath(fromObject, new String[] {"audioTranscriptionConfig"})); + } + if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { Common.setValueByPath( toObject, @@ -1303,6 +1317,13 @@ ObjectNode generationConfigToVertex( Common.getValueByPath(fromObject, new String[] {"presencePenalty"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseFormat"}, + Common.getValueByPath(fromObject, new String[] {"responseFormat"})); + } + if (Common.getValueByPath(fromObject, new String[] {"responseLogprobs"}) != null) { Common.setValueByPath( toObject, @@ -1398,13 +1419,6 @@ ObjectNode generationConfigToVertex( + " in Gemini Enterprise Agent Platform mode."); } - if (Common.getValueByPath(fromObject, new String[] {"responseFormat"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"responseFormat"}, - 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" @@ -1946,6 +1960,17 @@ ObjectNode tuningJobFromVertex( Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"})); } + if (Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"distillationSamplingSpec"}, + distillationSamplingSpecFromVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"})), + toObject, + rootObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"distillationSpec"}) != null) { Common.setValueByPath( toObject, @@ -2059,25 +2084,18 @@ ObjectNode tuningJobFromVertex( Common.getValueByPath(fromObject, new String[] {"tunedModelDisplayName"})); } - if (Common.getValueByPath(fromObject, new String[] {"tuningJobState"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"tuningJobState"}, - Common.getValueByPath(fromObject, new String[] {"tuningJobState"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"}) != null) { Common.setValueByPath( toObject, - new String[] {"veoTuningSpec"}, - Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"})); + new String[] {"tuningJobMetadata"}, + Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"tuningJobState"}) != null) { Common.setValueByPath( toObject, - new String[] {"tuningJobMetadata"}, - Common.getValueByPath(fromObject, new String[] {"tuningJobMetadata"})); + new String[] {"tuningJobState"}, + Common.getValueByPath(fromObject, new String[] {"tuningJobState"})); } if (Common.getValueByPath(fromObject, new String[] {"veoLoraTuningSpec"}) != null) { @@ -2087,15 +2105,11 @@ ObjectNode tuningJobFromVertex( Common.getValueByPath(fromObject, new String[] {"veoLoraTuningSpec"})); } - if (Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"}) != null) { Common.setValueByPath( toObject, - new String[] {"distillationSamplingSpec"}, - distillationSamplingSpecFromVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"distillationSamplingSpec"})), - toObject, - rootObject)); + new String[] {"veoTuningSpec"}, + Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"})); } return toObject; diff --git a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java index 1b35bd23970..ecfaead0986 100644 --- a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java +++ b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java @@ -58,6 +58,14 @@ public abstract class AudioTranscriptionConfig extends JsonSerializable { @JsonProperty("adaptationPhrases") public abstract Optional> adaptationPhrases(); + /** Configures word-level timestamp generation. */ + @JsonProperty("wordTimestamp") + public abstract Optional wordTimestamp(); + + /** Configures speaker diarization. */ + @JsonProperty("diarization") + public abstract Optional diarization(); + /** Instantiates a builder for AudioTranscriptionConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -224,6 +232,42 @@ public Builder clearAdaptationPhrases() { return adaptationPhrases(Optional.empty()); } + /** + * Setter for wordTimestamp. + * + *

wordTimestamp: Configures word-level timestamp generation. + */ + @JsonProperty("wordTimestamp") + public abstract Builder wordTimestamp(boolean wordTimestamp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder wordTimestamp(Optional wordTimestamp); + + /** Clears the value of wordTimestamp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWordTimestamp() { + return wordTimestamp(Optional.empty()); + } + + /** + * Setter for diarization. + * + *

diarization: Configures speaker diarization. + */ + @JsonProperty("diarization") + public abstract Builder diarization(boolean diarization); + + @ExcludeFromGeneratedCoverageReport + abstract Builder diarization(Optional diarization); + + /** Clears the value of diarization field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDiarization() { + return diarization(Optional.empty()); + } + public abstract AudioTranscriptionConfig build(); } diff --git a/src/main/java/com/google/genai/types/AutoraterConfig.java b/src/main/java/com/google/genai/types/AutoraterConfig.java index a5c816aba8f..7765fe4a65a 100644 --- a/src/main/java/com/google/genai/types/AutoraterConfig.java +++ b/src/main/java/com/google/genai/types/AutoraterConfig.java @@ -37,6 +37,17 @@ public abstract class AutoraterConfig extends JsonSerializable { @JsonProperty("samplingCount") public abstract Optional samplingCount(); + /** + * Optional. Default is true. Whether to flip the candidate and baseline responses. This is only + * applicable to the pairwise metric. If enabled, also provide + * PairwiseMetricSpec.candidate_response_field_name and + * PairwiseMetricSpec.baseline_response_field_name. When rendering + * PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped + * for half of the samples to reduce bias. + */ + @JsonProperty("flipEnabled") + public abstract Optional flipEnabled(); + /** * The fully qualified name of the publisher model or tuned autorater endpoint to use. * @@ -52,17 +63,6 @@ public abstract class AutoraterConfig extends JsonSerializable { @JsonProperty("generationConfig") public abstract Optional generationConfig(); - /** - * Optional. Default is true. Whether to flip the candidate and baseline responses. This is only - * applicable to the pairwise metric. If enabled, also provide - * PairwiseMetricSpec.candidate_response_field_name and - * PairwiseMetricSpec.baseline_response_field_name. When rendering - * PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped - * for half of the samples to reduce bias. - */ - @JsonProperty("flipEnabled") - public abstract Optional flipEnabled(); - /** Instantiates a builder for AutoraterConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -100,6 +100,29 @@ public Builder clearSamplingCount() { return samplingCount(Optional.empty()); } + /** + * Setter for flipEnabled. + * + *

flipEnabled: Optional. Default is true. Whether to flip the candidate and baseline + * responses. This is only applicable to the pairwise metric. If enabled, also provide + * PairwiseMetricSpec.candidate_response_field_name and + * PairwiseMetricSpec.baseline_response_field_name. When rendering + * PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped + * for half of the samples to reduce bias. + */ + @JsonProperty("flipEnabled") + public abstract Builder flipEnabled(boolean flipEnabled); + + @ExcludeFromGeneratedCoverageReport + abstract Builder flipEnabled(Optional flipEnabled); + + /** Clears the value of flipEnabled field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFlipEnabled() { + return flipEnabled(Optional.empty()); + } + /** * Setter for autoraterModel. * @@ -153,29 +176,6 @@ public Builder clearGenerationConfig() { return generationConfig(Optional.empty()); } - /** - * Setter for flipEnabled. - * - *

flipEnabled: Optional. Default is true. Whether to flip the candidate and baseline - * responses. This is only applicable to the pairwise metric. If enabled, also provide - * PairwiseMetricSpec.candidate_response_field_name and - * PairwiseMetricSpec.baseline_response_field_name. When rendering - * PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped - * for half of the samples to reduce bias. - */ - @JsonProperty("flipEnabled") - public abstract Builder flipEnabled(boolean flipEnabled); - - @ExcludeFromGeneratedCoverageReport - abstract Builder flipEnabled(Optional flipEnabled); - - /** Clears the value of flipEnabled field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearFlipEnabled() { - return flipEnabled(Optional.empty()); - } - public abstract AutoraterConfig build(); } diff --git a/src/main/java/com/google/genai/types/BatchJob.java b/src/main/java/com/google/genai/types/BatchJob.java index aabeb9dc9a5..47b684b156f 100644 --- a/src/main/java/com/google/genai/types/BatchJob.java +++ b/src/main/java/com/google/genai/types/BatchJob.java @@ -80,6 +80,10 @@ public abstract class BatchJob extends JsonSerializable { @JsonProperty("dest") public abstract Optional dest(); + /** Information further describing the output of this job. Output only. */ + @JsonProperty("outputInfo") + public abstract Optional outputInfo(); + /** * Statistics on completed and failed prediction instances. This field is for Gemini Enterprise * Agent Platform only. @@ -87,10 +91,6 @@ public abstract class BatchJob extends JsonSerializable { @JsonProperty("completionStats") public abstract Optional completionStats(); - /** Information further describing the output of this job. Output only. */ - @JsonProperty("outputInfo") - public abstract Optional outputInfo(); - /** Instantiates a builder for BatchJob. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -364,61 +364,61 @@ public Builder clearDest() { } /** - * Setter for completionStats. + * Setter for outputInfo. * - *

completionStats: Statistics on completed and failed prediction instances. This field is - * for Gemini Enterprise Agent Platform only. + *

outputInfo: Information further describing the output of this job. Output only. */ - @JsonProperty("completionStats") - public abstract Builder completionStats(CompletionStats completionStats); + @JsonProperty("outputInfo") + public abstract Builder outputInfo(BatchJobOutputInfo outputInfo); /** - * Setter for completionStats builder. + * Setter for outputInfo builder. * - *

completionStats: Statistics on completed and failed prediction instances. This field is - * for Gemini Enterprise Agent Platform only. + *

outputInfo: Information further describing the output of this job. Output only. */ @CanIgnoreReturnValue - public Builder completionStats(CompletionStats.Builder completionStatsBuilder) { - return completionStats(completionStatsBuilder.build()); + public Builder outputInfo(BatchJobOutputInfo.Builder outputInfoBuilder) { + return outputInfo(outputInfoBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder completionStats(Optional completionStats); + abstract Builder outputInfo(Optional outputInfo); - /** Clears the value of completionStats field. */ + /** Clears the value of outputInfo field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCompletionStats() { - return completionStats(Optional.empty()); + public Builder clearOutputInfo() { + return outputInfo(Optional.empty()); } /** - * Setter for outputInfo. + * Setter for completionStats. * - *

outputInfo: Information further describing the output of this job. Output only. + *

completionStats: Statistics on completed and failed prediction instances. This field is + * for Gemini Enterprise Agent Platform only. */ - @JsonProperty("outputInfo") - public abstract Builder outputInfo(BatchJobOutputInfo outputInfo); + @JsonProperty("completionStats") + public abstract Builder completionStats(CompletionStats completionStats); /** - * Setter for outputInfo builder. + * Setter for completionStats builder. * - *

outputInfo: Information further describing the output of this job. Output only. + *

completionStats: Statistics on completed and failed prediction instances. This field is + * for Gemini Enterprise Agent Platform only. */ @CanIgnoreReturnValue - public Builder outputInfo(BatchJobOutputInfo.Builder outputInfoBuilder) { - return outputInfo(outputInfoBuilder.build()); + public Builder completionStats(CompletionStats.Builder completionStatsBuilder) { + return completionStats(completionStatsBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder outputInfo(Optional outputInfo); + abstract Builder completionStats(Optional completionStats); - /** Clears the value of outputInfo field. */ + /** Clears the value of completionStats field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearOutputInfo() { - return outputInfo(Optional.empty()); + public Builder clearCompletionStats() { + return completionStats(Optional.empty()); } public abstract BatchJob build(); diff --git a/src/main/java/com/google/genai/types/BatchJobDestination.java b/src/main/java/com/google/genai/types/BatchJobDestination.java index fd69e38644d..831a50469de 100644 --- a/src/main/java/com/google/genai/types/BatchJobDestination.java +++ b/src/main/java/com/google/genai/types/BatchJobDestination.java @@ -46,6 +46,13 @@ public abstract class BatchJobDestination extends JsonSerializable { @JsonProperty("bigqueryUri") public abstract Optional bigqueryUri(); + /** + * This field is experimental and may change in future versions. The Vertex AI dataset + * destination. + */ + @JsonProperty("vertexDataset") + public abstract Optional vertexDataset(); + /** * The Gemini Developer API's file resource name of the output data (e.g. "files/12345"). The file * will be a JSONL file with a single response per line. The responses will be @@ -69,13 +76,6 @@ public abstract class BatchJobDestination extends JsonSerializable { @JsonProperty("inlinedEmbedContentResponses") public abstract Optional> inlinedEmbedContentResponses(); - /** - * This field is experimental and may change in future versions. The Vertex AI dataset - * destination. - */ - @JsonProperty("vertexDataset") - public abstract Optional vertexDataset(); - /** Instantiates a builder for BatchJobDestination. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -149,6 +149,36 @@ public Builder clearBigqueryUri() { return bigqueryUri(Optional.empty()); } + /** + * Setter for vertexDataset. + * + *

vertexDataset: This field is experimental and may change in future versions. The Vertex AI + * dataset destination. + */ + @JsonProperty("vertexDataset") + public abstract Builder vertexDataset(VertexMultimodalDatasetDestination vertexDataset); + + /** + * Setter for vertexDataset builder. + * + *

vertexDataset: This field is experimental and may change in future versions. The Vertex AI + * dataset destination. + */ + @CanIgnoreReturnValue + public Builder vertexDataset(VertexMultimodalDatasetDestination.Builder vertexDatasetBuilder) { + return vertexDataset(vertexDatasetBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexDataset(Optional vertexDataset); + + /** Clears the value of vertexDataset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexDataset() { + return vertexDataset(Optional.empty()); + } + /** * Setter for fileName. * @@ -265,36 +295,6 @@ public Builder clearInlinedEmbedContentResponses() { return inlinedEmbedContentResponses(Optional.empty()); } - /** - * Setter for vertexDataset. - * - *

vertexDataset: This field is experimental and may change in future versions. The Vertex AI - * dataset destination. - */ - @JsonProperty("vertexDataset") - public abstract Builder vertexDataset(VertexMultimodalDatasetDestination vertexDataset); - - /** - * Setter for vertexDataset builder. - * - *

vertexDataset: This field is experimental and may change in future versions. The Vertex AI - * dataset destination. - */ - @CanIgnoreReturnValue - public Builder vertexDataset(VertexMultimodalDatasetDestination.Builder vertexDatasetBuilder) { - return vertexDataset(vertexDatasetBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder vertexDataset(Optional vertexDataset); - - /** Clears the value of vertexDataset field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearVertexDataset() { - return vertexDataset(Optional.empty()); - } - public abstract BatchJobDestination build(); } diff --git a/src/main/java/com/google/genai/types/BatchJobOutputInfo.java b/src/main/java/com/google/genai/types/BatchJobOutputInfo.java index 698ec91022e..68e1189ea5a 100644 --- a/src/main/java/com/google/genai/types/BatchJobOutputInfo.java +++ b/src/main/java/com/google/genai/types/BatchJobOutputInfo.java @@ -30,13 +30,6 @@ @AutoValue @JsonDeserialize(builder = BatchJobOutputInfo.Builder.class) public abstract class BatchJobOutputInfo extends JsonSerializable { - /** - * This field is experimental and may change in future versions. The Vertex AI dataset name - * containing the output data. - */ - @JsonProperty("vertexMultimodalDatasetName") - public abstract Optional vertexMultimodalDatasetName(); - /** * The full path of the Cloud Storage directory created, into which the prediction output is * written. @@ -51,6 +44,13 @@ public abstract class BatchJobOutputInfo extends JsonSerializable { @JsonProperty("bigqueryOutputTable") public abstract Optional bigqueryOutputTable(); + /** + * This field is experimental and may change in future versions. The Vertex AI dataset name + * containing the output data. + */ + @JsonProperty("vertexMultimodalDatasetName") + public abstract Optional vertexMultimodalDatasetName(); + /** Instantiates a builder for BatchJobOutputInfo. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -69,25 +69,6 @@ private static Builder create() { return new AutoValue_BatchJobOutputInfo.Builder(); } - /** - * Setter for vertexMultimodalDatasetName. - * - *

vertexMultimodalDatasetName: This field is experimental and may change in future versions. - * The Vertex AI dataset name containing the output data. - */ - @JsonProperty("vertexMultimodalDatasetName") - public abstract Builder vertexMultimodalDatasetName(String vertexMultimodalDatasetName); - - @ExcludeFromGeneratedCoverageReport - abstract Builder vertexMultimodalDatasetName(Optional vertexMultimodalDatasetName); - - /** Clears the value of vertexMultimodalDatasetName field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearVertexMultimodalDatasetName() { - return vertexMultimodalDatasetName(Optional.empty()); - } - /** * Setter for gcsOutputDirectory. * @@ -126,6 +107,25 @@ public Builder clearBigqueryOutputTable() { return bigqueryOutputTable(Optional.empty()); } + /** + * Setter for vertexMultimodalDatasetName. + * + *

vertexMultimodalDatasetName: This field is experimental and may change in future versions. + * The Vertex AI dataset name containing the output data. + */ + @JsonProperty("vertexMultimodalDatasetName") + public abstract Builder vertexMultimodalDatasetName(String vertexMultimodalDatasetName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexMultimodalDatasetName(Optional vertexMultimodalDatasetName); + + /** Clears the value of vertexMultimodalDatasetName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexMultimodalDatasetName() { + return vertexMultimodalDatasetName(Optional.empty()); + } + public abstract BatchJobOutputInfo build(); } diff --git a/src/main/java/com/google/genai/types/BatchJobSource.java b/src/main/java/com/google/genai/types/BatchJobSource.java index cfcb82c41cf..70e416e86b0 100644 --- a/src/main/java/com/google/genai/types/BatchJobSource.java +++ b/src/main/java/com/google/genai/types/BatchJobSource.java @@ -46,6 +46,13 @@ public abstract class BatchJobSource extends JsonSerializable { @JsonProperty("bigqueryUri") public abstract Optional bigqueryUri(); + /** + * This field is experimental and may change in future versions. The Vertex AI dataset resource + * name to use as input. Must be of type multimodal. + */ + @JsonProperty("vertexDatasetName") + public abstract Optional vertexDatasetName(); + /** The Gemini Developer API's file resource name of the input data (e.g. "files/12345"). */ @JsonProperty("fileName") public abstract Optional fileName(); @@ -54,13 +61,6 @@ public abstract class BatchJobSource extends JsonSerializable { @JsonProperty("inlinedRequests") public abstract Optional> inlinedRequests(); - /** - * This field is experimental and may change in future versions. The Vertex AI dataset resource - * name to use as input. Must be of type multimodal. - */ - @JsonProperty("vertexDatasetName") - public abstract Optional vertexDatasetName(); - /** Instantiates a builder for BatchJobSource. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -144,6 +144,25 @@ public Builder clearBigqueryUri() { return bigqueryUri(Optional.empty()); } + /** + * Setter for vertexDatasetName. + * + *

vertexDatasetName: This field is experimental and may change in future versions. The + * Vertex AI dataset resource name to use as input. Must be of type multimodal. + */ + @JsonProperty("vertexDatasetName") + public abstract Builder vertexDatasetName(String vertexDatasetName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexDatasetName(Optional vertexDatasetName); + + /** Clears the value of vertexDatasetName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexDatasetName() { + return vertexDatasetName(Optional.empty()); + } + /** * Setter for fileName. * @@ -204,25 +223,6 @@ public Builder clearInlinedRequests() { return inlinedRequests(Optional.empty()); } - /** - * Setter for vertexDatasetName. - * - *

vertexDatasetName: This field is experimental and may change in future versions. The - * Vertex AI dataset resource name to use as input. Must be of type multimodal. - */ - @JsonProperty("vertexDatasetName") - public abstract Builder vertexDatasetName(String vertexDatasetName); - - @ExcludeFromGeneratedCoverageReport - abstract Builder vertexDatasetName(Optional vertexDatasetName); - - /** Clears the value of vertexDatasetName field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearVertexDatasetName() { - return vertexDatasetName(Optional.empty()); - } - public abstract BatchJobSource build(); } diff --git a/src/main/java/com/google/genai/types/ComputerUse.java b/src/main/java/com/google/genai/types/ComputerUse.java index 1ecc3da044f..36431ddb82f 100644 --- a/src/main/java/com/google/genai/types/ComputerUse.java +++ b/src/main/java/com/google/genai/types/ComputerUse.java @@ -35,6 +35,10 @@ @AutoValue @JsonDeserialize(builder = ComputerUse.Builder.class) public abstract class ComputerUse extends JsonSerializable { + /** Optional. Enables the prompt injection detection check on computer-use request. */ + @JsonProperty("enablePromptInjectionDetection") + public abstract Optional enablePromptInjectionDetection(); + /** Required. The environment being operated. */ @JsonProperty("environment") public abstract Optional environment(); @@ -49,10 +53,6 @@ public abstract class ComputerUse extends JsonSerializable { @JsonProperty("excludedPredefinedFunctions") public abstract Optional> excludedPredefinedFunctions(); - /** Optional. Enables the prompt injection detection check on computer-use request. */ - @JsonProperty("enablePromptInjectionDetection") - public abstract Optional enablePromptInjectionDetection(); - /** * Optional. Disabled safety policies for computer use. This field is not supported in Vertex AI. */ @@ -77,6 +77,26 @@ private static Builder create() { return new AutoValue_ComputerUse.Builder(); } + /** + * Setter for enablePromptInjectionDetection. + * + *

enablePromptInjectionDetection: Optional. Enables the prompt injection detection check on + * computer-use request. + */ + @JsonProperty("enablePromptInjectionDetection") + public abstract Builder enablePromptInjectionDetection(boolean enablePromptInjectionDetection); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enablePromptInjectionDetection( + Optional enablePromptInjectionDetection); + + /** Clears the value of enablePromptInjectionDetection field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnablePromptInjectionDetection() { + return enablePromptInjectionDetection(Optional.empty()); + } + /** * Setter for environment. * @@ -152,26 +172,6 @@ public Builder clearExcludedPredefinedFunctions() { return excludedPredefinedFunctions(Optional.empty()); } - /** - * Setter for enablePromptInjectionDetection. - * - *

enablePromptInjectionDetection: Optional. Enables the prompt injection detection check on - * computer-use request. - */ - @JsonProperty("enablePromptInjectionDetection") - public abstract Builder enablePromptInjectionDetection(boolean enablePromptInjectionDetection); - - @ExcludeFromGeneratedCoverageReport - abstract Builder enablePromptInjectionDetection( - Optional enablePromptInjectionDetection); - - /** Clears the value of enablePromptInjectionDetection field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearEnablePromptInjectionDetection() { - return enablePromptInjectionDetection(Optional.empty()); - } - /** * Setter for disabledSafetyPolicies. * diff --git a/src/main/java/com/google/genai/types/CreateTuningJobConfig.java b/src/main/java/com/google/genai/types/CreateTuningJobConfig.java index 09b3c6adc66..e330f11d3b3 100644 --- a/src/main/java/com/google/genai/types/CreateTuningJobConfig.java +++ b/src/main/java/com/google/genai/types/CreateTuningJobConfig.java @@ -142,14 +142,6 @@ public abstract class CreateTuningJobConfig extends JsonSerializable { @JsonProperty("outputUri") public abstract Optional outputUri(); - /** - * The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. - * If this is set, then all resources created by the TuningJob will be encrypted with provided - * encryption key. - */ - @JsonProperty("encryptionSpec") - public abstract Optional encryptionSpec(); - /** Reward function configuration for reinforcement tuning. Reinforcement tuning only. */ @JsonProperty("rewardConfig") public abstract Optional rewardConfig(); @@ -194,6 +186,14 @@ public abstract class CreateTuningJobConfig extends JsonSerializable { @JsonProperty("validationDatasetUri") public abstract Optional validationDatasetUri(); + /** + * The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. + * If this is set, then all resources created by the TuningJob will be encrypted with provided + * encryption key. + */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + /** Instantiates a builder for CreateTuningJobConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -698,38 +698,6 @@ public Builder clearOutputUri() { return outputUri(Optional.empty()); } - /** - * Setter for encryptionSpec. - * - *

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

encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key - * options for a TuningJob. If this is set, then all resources created by the TuningJob will be - * encrypted with provided encryption key. - */ - @CanIgnoreReturnValue - public Builder encryptionSpec(EncryptionSpec.Builder encryptionSpecBuilder) { - return encryptionSpec(encryptionSpecBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder encryptionSpec(Optional encryptionSpec); - - /** Clears the value of encryptionSpec field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearEncryptionSpec() { - return encryptionSpec(Optional.empty()); - } - /** * Setter for rewardConfig. * @@ -931,6 +899,38 @@ public Builder clearValidationDatasetUri() { return validationDatasetUri(Optional.empty()); } + /** + * Setter for encryptionSpec. + * + *

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

encryptionSpec: The encryption spec of the tuning job. Customer-managed encryption key + * options for a TuningJob. If this is set, then all resources created by the TuningJob will be + * encrypted with provided encryption key. + */ + @CanIgnoreReturnValue + public Builder encryptionSpec(EncryptionSpec.Builder encryptionSpecBuilder) { + return encryptionSpec(encryptionSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + public abstract CreateTuningJobConfig build(); } diff --git a/src/main/java/com/google/genai/types/DatasetStats.java b/src/main/java/com/google/genai/types/DatasetStats.java index 905965486fd..970de542e87 100644 --- a/src/main/java/com/google/genai/types/DatasetStats.java +++ b/src/main/java/com/google/genai/types/DatasetStats.java @@ -34,6 +34,10 @@ @AutoValue @JsonDeserialize(builder = DatasetStats.Builder.class) public abstract class DatasetStats extends JsonSerializable { + /** Output only. Dataset distributions for the number of contents per example. */ + @JsonProperty("contentsPerExampleDistribution") + public abstract Optional contentsPerExampleDistribution(); + /** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */ @JsonProperty("droppedExampleIndices") public abstract Optional> droppedExampleIndices(); @@ -45,10 +49,21 @@ public abstract class DatasetStats extends JsonSerializable { @JsonProperty("droppedExampleReasons") public abstract Optional> droppedExampleReasons(); + /** + * Output only. Sample user dataset examples in the training dataset uri for Reinforcement Tuning. + */ + @JsonProperty("reinforcementTuningUserDatasetExamples") + public abstract Optional + reinforcementTuningUserDatasetExamples(); + /** Output only. Number of billable characters in the tuning dataset. */ @JsonProperty("totalBillableCharacterCount") public abstract Optional totalBillableCharacterCount(); + /** Output only. Number of billable tokens in the tuning dataset. */ + @JsonProperty("totalBillableTokenCount") + public abstract Optional totalBillableTokenCount(); + /** Output only. Number of tuning characters in the tuning dataset. */ @JsonProperty("totalTuningCharacterCount") public abstract Optional totalTuningCharacterCount(); @@ -77,21 +92,6 @@ public abstract class DatasetStats extends JsonSerializable { @JsonProperty("userOutputTokenDistribution") public abstract Optional userOutputTokenDistribution(); - /** Output only. Dataset distributions for the number of contents per example. */ - @JsonProperty("contentsPerExampleDistribution") - public abstract Optional contentsPerExampleDistribution(); - - /** - * Output only. Sample user dataset examples in the training dataset uri for Reinforcement Tuning. - */ - @JsonProperty("reinforcementTuningUserDatasetExamples") - public abstract Optional - reinforcementTuningUserDatasetExamples(); - - /** Output only. Number of billable tokens in the tuning dataset. */ - @JsonProperty("totalBillableTokenCount") - public abstract Optional totalBillableTokenCount(); - /** Instantiates a builder for DatasetStats. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -110,6 +110,39 @@ private static Builder create() { return new AutoValue_DatasetStats.Builder(); } + /** + * Setter for contentsPerExampleDistribution. + * + *

contentsPerExampleDistribution: Output only. Dataset distributions for the number of + * contents per example. + */ + @JsonProperty("contentsPerExampleDistribution") + public abstract Builder contentsPerExampleDistribution( + DatasetDistribution contentsPerExampleDistribution); + + /** + * Setter for contentsPerExampleDistribution builder. + * + *

contentsPerExampleDistribution: Output only. Dataset distributions for the number of + * contents per example. + */ + @CanIgnoreReturnValue + public Builder contentsPerExampleDistribution( + DatasetDistribution.Builder contentsPerExampleDistributionBuilder) { + return contentsPerExampleDistribution(contentsPerExampleDistributionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contentsPerExampleDistribution( + Optional contentsPerExampleDistribution); + + /** Clears the value of contentsPerExampleDistribution field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContentsPerExampleDistribution() { + return contentsPerExampleDistribution(Optional.empty()); + } + /** * Setter for droppedExampleIndices. * @@ -170,6 +203,41 @@ public Builder clearDroppedExampleReasons() { return droppedExampleReasons(Optional.empty()); } + /** + * Setter for reinforcementTuningUserDatasetExamples. + * + *

reinforcementTuningUserDatasetExamples: Output only. Sample user dataset examples in the + * training dataset uri for Reinforcement Tuning. + */ + @JsonProperty("reinforcementTuningUserDatasetExamples") + public abstract Builder reinforcementTuningUserDatasetExamples( + ReinforcementTuningUserDatasetExamples reinforcementTuningUserDatasetExamples); + + /** + * Setter for reinforcementTuningUserDatasetExamples builder. + * + *

reinforcementTuningUserDatasetExamples: Output only. Sample user dataset examples in the + * training dataset uri for Reinforcement Tuning. + */ + @CanIgnoreReturnValue + public Builder reinforcementTuningUserDatasetExamples( + ReinforcementTuningUserDatasetExamples.Builder + reinforcementTuningUserDatasetExamplesBuilder) { + return reinforcementTuningUserDatasetExamples( + reinforcementTuningUserDatasetExamplesBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reinforcementTuningUserDatasetExamples( + Optional reinforcementTuningUserDatasetExamples); + + /** Clears the value of reinforcementTuningUserDatasetExamples field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReinforcementTuningUserDatasetExamples() { + return reinforcementTuningUserDatasetExamples(Optional.empty()); + } + /** * Setter for totalBillableCharacterCount. * @@ -189,6 +257,24 @@ public Builder clearTotalBillableCharacterCount() { return totalBillableCharacterCount(Optional.empty()); } + /** + * Setter for totalBillableTokenCount. + * + *

totalBillableTokenCount: Output only. Number of billable tokens in the tuning dataset. + */ + @JsonProperty("totalBillableTokenCount") + public abstract Builder totalBillableTokenCount(Long totalBillableTokenCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder totalBillableTokenCount(Optional totalBillableTokenCount); + + /** Clears the value of totalBillableTokenCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTotalBillableTokenCount() { + return totalBillableTokenCount(Optional.empty()); + } + /** * Setter for totalTuningCharacterCount. * @@ -381,92 +467,6 @@ public Builder clearUserOutputTokenDistribution() { return userOutputTokenDistribution(Optional.empty()); } - /** - * Setter for contentsPerExampleDistribution. - * - *

contentsPerExampleDistribution: Output only. Dataset distributions for the number of - * contents per example. - */ - @JsonProperty("contentsPerExampleDistribution") - public abstract Builder contentsPerExampleDistribution( - DatasetDistribution contentsPerExampleDistribution); - - /** - * Setter for contentsPerExampleDistribution builder. - * - *

contentsPerExampleDistribution: Output only. Dataset distributions for the number of - * contents per example. - */ - @CanIgnoreReturnValue - public Builder contentsPerExampleDistribution( - DatasetDistribution.Builder contentsPerExampleDistributionBuilder) { - return contentsPerExampleDistribution(contentsPerExampleDistributionBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder contentsPerExampleDistribution( - Optional contentsPerExampleDistribution); - - /** Clears the value of contentsPerExampleDistribution field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearContentsPerExampleDistribution() { - return contentsPerExampleDistribution(Optional.empty()); - } - - /** - * Setter for reinforcementTuningUserDatasetExamples. - * - *

reinforcementTuningUserDatasetExamples: Output only. Sample user dataset examples in the - * training dataset uri for Reinforcement Tuning. - */ - @JsonProperty("reinforcementTuningUserDatasetExamples") - public abstract Builder reinforcementTuningUserDatasetExamples( - ReinforcementTuningUserDatasetExamples reinforcementTuningUserDatasetExamples); - - /** - * Setter for reinforcementTuningUserDatasetExamples builder. - * - *

reinforcementTuningUserDatasetExamples: Output only. Sample user dataset examples in the - * training dataset uri for Reinforcement Tuning. - */ - @CanIgnoreReturnValue - public Builder reinforcementTuningUserDatasetExamples( - ReinforcementTuningUserDatasetExamples.Builder - reinforcementTuningUserDatasetExamplesBuilder) { - return reinforcementTuningUserDatasetExamples( - reinforcementTuningUserDatasetExamplesBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder reinforcementTuningUserDatasetExamples( - Optional reinforcementTuningUserDatasetExamples); - - /** Clears the value of reinforcementTuningUserDatasetExamples field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearReinforcementTuningUserDatasetExamples() { - return reinforcementTuningUserDatasetExamples(Optional.empty()); - } - - /** - * Setter for totalBillableTokenCount. - * - *

totalBillableTokenCount: Output only. Number of billable tokens in the tuning dataset. - */ - @JsonProperty("totalBillableTokenCount") - public abstract Builder totalBillableTokenCount(Long totalBillableTokenCount); - - @ExcludeFromGeneratedCoverageReport - abstract Builder totalBillableTokenCount(Optional totalBillableTokenCount); - - /** Clears the value of totalBillableTokenCount field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearTotalBillableTokenCount() { - return totalBillableTokenCount(Optional.empty()); - } - public abstract DatasetStats build(); } diff --git a/src/main/java/com/google/genai/types/DistillationHyperParameters.java b/src/main/java/com/google/genai/types/DistillationHyperParameters.java index cd4ad941f34..0b24bb8b815 100644 --- a/src/main/java/com/google/genai/types/DistillationHyperParameters.java +++ b/src/main/java/com/google/genai/types/DistillationHyperParameters.java @@ -32,10 +32,6 @@ @InternalApi @JsonDeserialize(builder = DistillationHyperParameters.Builder.class) public abstract class DistillationHyperParameters extends JsonSerializable { - /** The size of the adapter. Can be 'small', 'medium', or 'large'. */ - @JsonProperty("adapterSize") - public abstract Optional adapterSize(); - /** Number of complete passes the model makes over the entire training dataset during training. */ @JsonProperty("epochCount") public abstract Optional epochCount(); @@ -44,6 +40,18 @@ public abstract class DistillationHyperParameters extends JsonSerializable { @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); + /** The size of the adapter. Can be 'small', 'medium', or 'large'. */ + @JsonProperty("adapterSize") + public abstract Optional adapterSize(); + + /** Batch size for tuning. This feature is only available for open source models. */ + @JsonProperty("batchSize") + public abstract Optional batchSize(); + + /** The learning rate for distillation tuning. */ + @JsonProperty("learningRate") + public abstract Optional learningRate(); + /** * Generation config for Distillation teacher model sampling. Only the following fields are * supported for distillation teacher samplings: - temperature - top_p - top_k - candidate_count - @@ -52,14 +60,6 @@ public abstract class DistillationHyperParameters extends JsonSerializable { @JsonProperty("generationConfig") public abstract Optional generationConfig(); - /** The learning rate for distillation tuning. */ - @JsonProperty("learningRate") - public abstract Optional learningRate(); - - /** Batch size for tuning. This feature is only available for open source models. */ - @JsonProperty("batchSize") - public abstract Optional batchSize(); - /** Instantiates a builder for DistillationHyperParameters. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -78,6 +78,43 @@ private static Builder create() { return new AutoValue_DistillationHyperParameters.Builder(); } + /** + * Setter for epochCount. + * + *

epochCount: Number of complete passes the model makes over the entire training dataset + * during training. + */ + @JsonProperty("epochCount") + public abstract Builder epochCount(Long epochCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder epochCount(Optional epochCount); + + /** Clears the value of epochCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEpochCount() { + return epochCount(Optional.empty()); + } + + /** + * Setter for learningRateMultiplier. + * + *

learningRateMultiplier: Multiplier for adjusting the default learning rate. + */ + @JsonProperty("learningRateMultiplier") + public abstract Builder learningRateMultiplier(Float learningRateMultiplier); + + @ExcludeFromGeneratedCoverageReport + abstract Builder learningRateMultiplier(Optional learningRateMultiplier); + + /** Clears the value of learningRateMultiplier field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLearningRateMultiplier() { + return learningRateMultiplier(Optional.empty()); + } + /** * Setter for adapterSize. * @@ -117,40 +154,39 @@ public Builder adapterSize(String adapterSize) { } /** - * Setter for epochCount. + * Setter for batchSize. * - *

epochCount: Number of complete passes the model makes over the entire training dataset - * during training. + *

batchSize: Batch size for tuning. This feature is only available for open source models. */ - @JsonProperty("epochCount") - public abstract Builder epochCount(Long epochCount); + @JsonProperty("batchSize") + public abstract Builder batchSize(Integer batchSize); @ExcludeFromGeneratedCoverageReport - abstract Builder epochCount(Optional epochCount); + abstract Builder batchSize(Optional batchSize); - /** Clears the value of epochCount field. */ + /** Clears the value of batchSize field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearEpochCount() { - return epochCount(Optional.empty()); + public Builder clearBatchSize() { + return batchSize(Optional.empty()); } /** - * Setter for learningRateMultiplier. + * Setter for learningRate. * - *

learningRateMultiplier: Multiplier for adjusting the default learning rate. + *

learningRate: The learning rate for distillation tuning. */ - @JsonProperty("learningRateMultiplier") - public abstract Builder learningRateMultiplier(Float learningRateMultiplier); + @JsonProperty("learningRate") + public abstract Builder learningRate(Float learningRate); @ExcludeFromGeneratedCoverageReport - abstract Builder learningRateMultiplier(Optional learningRateMultiplier); + abstract Builder learningRate(Optional learningRate); - /** Clears the value of learningRateMultiplier field. */ + /** Clears the value of learningRate field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearLearningRateMultiplier() { - return learningRateMultiplier(Optional.empty()); + public Builder clearLearningRate() { + return learningRate(Optional.empty()); } /** @@ -185,42 +221,6 @@ public Builder clearGenerationConfig() { return generationConfig(Optional.empty()); } - /** - * Setter for learningRate. - * - *

learningRate: The learning rate for distillation tuning. - */ - @JsonProperty("learningRate") - public abstract Builder learningRate(Float learningRate); - - @ExcludeFromGeneratedCoverageReport - abstract Builder learningRate(Optional learningRate); - - /** Clears the value of learningRate field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearLearningRate() { - return learningRate(Optional.empty()); - } - - /** - * Setter for batchSize. - * - *

batchSize: Batch size for tuning. This feature is only available for open source models. - */ - @JsonProperty("batchSize") - public abstract Builder batchSize(Integer batchSize); - - @ExcludeFromGeneratedCoverageReport - abstract Builder batchSize(Optional batchSize); - - /** Clears the value of batchSize field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearBatchSize() { - return batchSize(Optional.empty()); - } - public abstract DistillationHyperParameters build(); } diff --git a/src/main/java/com/google/genai/types/DistillationSamplingSpec.java b/src/main/java/com/google/genai/types/DistillationSamplingSpec.java index 74d7057dd30..328678d661f 100644 --- a/src/main/java/com/google/genai/types/DistillationSamplingSpec.java +++ b/src/main/java/com/google/genai/types/DistillationSamplingSpec.java @@ -30,6 +30,20 @@ @AutoValue @JsonDeserialize(builder = DistillationSamplingSpec.Builder.class) public abstract class DistillationSamplingSpec extends JsonSerializable { + /** + * 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(); + + /** + * 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(); + /** * 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). @@ -44,20 +58,6 @@ public abstract class DistillationSamplingSpec extends JsonSerializable { @JsonProperty("tunedTeacherModelSource") public abstract Optional tunedTeacherModelSource(); - /** - * 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(); - - /** - * 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(); - /** Hyperparameters for distillation tuning. */ @JsonProperty("hyperparameters") public abstract Optional hyperparameters(); @@ -81,79 +81,79 @@ private static Builder create() { } /** - * Setter for baseTeacherModel. + * Setter for promptDatasetUri. * - *

baseTeacherModel: 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). + *

promptDatasetUri: Cloud Storage path to file containing prompt dataset for distillation. + * The dataset must be formatted as a JSONL file. */ - @JsonProperty("baseTeacherModel") - public abstract Builder baseTeacherModel(String baseTeacherModel); + @JsonProperty("promptDatasetUri") + public abstract Builder promptDatasetUri(String promptDatasetUri); @ExcludeFromGeneratedCoverageReport - abstract Builder baseTeacherModel(Optional baseTeacherModel); + abstract Builder promptDatasetUri(Optional promptDatasetUri); - /** Clears the value of baseTeacherModel field. */ + /** Clears the value of promptDatasetUri field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearBaseTeacherModel() { - return baseTeacherModel(Optional.empty()); + public Builder clearPromptDatasetUri() { + return promptDatasetUri(Optional.empty()); } /** - * Setter for tunedTeacherModelSource. + * Setter for validationDatasetUri. * - *

tunedTeacherModelSource: The resource name of the Tuned teacher model. Format: - * `projects/{project}/locations/{location}/models/{model}`. + *

validationDatasetUri: Cloud Storage path to file containing validation dataset for + * distillation. The dataset must be formatted as a JSONL file. */ - @JsonProperty("tunedTeacherModelSource") - public abstract Builder tunedTeacherModelSource(String tunedTeacherModelSource); + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); @ExcludeFromGeneratedCoverageReport - abstract Builder tunedTeacherModelSource(Optional tunedTeacherModelSource); + abstract Builder validationDatasetUri(Optional validationDatasetUri); - /** Clears the value of tunedTeacherModelSource field. */ + /** Clears the value of validationDatasetUri field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearTunedTeacherModelSource() { - return tunedTeacherModelSource(Optional.empty()); + public Builder clearValidationDatasetUri() { + return validationDatasetUri(Optional.empty()); } /** - * Setter for validationDatasetUri. + * Setter for baseTeacherModel. * - *

validationDatasetUri: Cloud Storage path to file containing validation dataset for - * distillation. The dataset must be formatted as a JSONL file. + *

baseTeacherModel: 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("validationDatasetUri") - public abstract Builder validationDatasetUri(String validationDatasetUri); + @JsonProperty("baseTeacherModel") + public abstract Builder baseTeacherModel(String baseTeacherModel); @ExcludeFromGeneratedCoverageReport - abstract Builder validationDatasetUri(Optional validationDatasetUri); + abstract Builder baseTeacherModel(Optional baseTeacherModel); - /** Clears the value of validationDatasetUri field. */ + /** Clears the value of baseTeacherModel field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearValidationDatasetUri() { - return validationDatasetUri(Optional.empty()); + public Builder clearBaseTeacherModel() { + return baseTeacherModel(Optional.empty()); } /** - * Setter for promptDatasetUri. + * Setter for tunedTeacherModelSource. * - *

promptDatasetUri: Cloud Storage path to file containing prompt dataset for distillation. - * The dataset must be formatted as a JSONL file. + *

tunedTeacherModelSource: The resource name of the Tuned teacher model. Format: + * `projects/{project}/locations/{location}/models/{model}`. */ - @JsonProperty("promptDatasetUri") - public abstract Builder promptDatasetUri(String promptDatasetUri); + @JsonProperty("tunedTeacherModelSource") + public abstract Builder tunedTeacherModelSource(String tunedTeacherModelSource); @ExcludeFromGeneratedCoverageReport - abstract Builder promptDatasetUri(Optional promptDatasetUri); + abstract Builder tunedTeacherModelSource(Optional tunedTeacherModelSource); - /** Clears the value of promptDatasetUri field. */ + /** Clears the value of tunedTeacherModelSource field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearPromptDatasetUri() { - return promptDatasetUri(Optional.empty()); + public Builder clearTunedTeacherModelSource() { + return tunedTeacherModelSource(Optional.empty()); } /** diff --git a/src/main/java/com/google/genai/types/DistillationSpec.java b/src/main/java/com/google/genai/types/DistillationSpec.java index 9f55b8f88aa..efccdeca02f 100644 --- a/src/main/java/com/google/genai/types/DistillationSpec.java +++ b/src/main/java/com/google/genai/types/DistillationSpec.java @@ -30,13 +30,6 @@ @AutoValue @JsonDeserialize(builder = DistillationSpec.Builder.class) public abstract class DistillationSpec extends JsonSerializable { - /** - * 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(); - /** * 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). @@ -56,6 +49,13 @@ public abstract class DistillationSpec extends JsonSerializable { @JsonProperty("pipelineRootDirectory") public abstract Optional pipelineRootDirectory(); + /** + * 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(); + /** * The student model that is being tuned, e.g., "google/gemma-2b-1.1-it". Deprecated. Use * base_model instead. @@ -77,13 +77,6 @@ public abstract class DistillationSpec extends JsonSerializable { @JsonProperty("tunedTeacherModelSource") public abstract Optional tunedTeacherModelSource(); - /** - * Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must - * be formatted as a JSONL file. - */ - @JsonProperty("validationDatasetUri") - public abstract Optional validationDatasetUri(); - /** * Optional. Specifies the tuning mode for distillation (sft part). This feature is only available * for open source models. @@ -91,6 +84,13 @@ public abstract class DistillationSpec extends JsonSerializable { @JsonProperty("tuningMode") public abstract Optional tuningMode(); + /** + * Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must + * be formatted as a JSONL file. + */ + @JsonProperty("validationDatasetUri") + public abstract Optional validationDatasetUri(); + /** Instantiates a builder for DistillationSpec. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -109,25 +109,6 @@ private static Builder create() { return new AutoValue_DistillationSpec.Builder(); } - /** - * Setter for promptDatasetUri. - * - *

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); - - @ExcludeFromGeneratedCoverageReport - abstract Builder promptDatasetUri(Optional promptDatasetUri); - - /** Clears the value of promptDatasetUri field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearPromptDatasetUri() { - return promptDatasetUri(Optional.empty()); - } - /** * Setter for baseTeacherModel. * @@ -195,6 +176,25 @@ public Builder clearPipelineRootDirectory() { return pipelineRootDirectory(Optional.empty()); } + /** + * Setter for promptDatasetUri. + * + *

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); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptDatasetUri(Optional promptDatasetUri); + + /** Clears the value of promptDatasetUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptDatasetUri() { + return promptDatasetUri(Optional.empty()); + } + /** * Setter for studentModel. * @@ -252,25 +252,6 @@ public Builder clearTunedTeacherModelSource() { return tunedTeacherModelSource(Optional.empty()); } - /** - * Setter for validationDatasetUri. - * - *

validationDatasetUri: Optional. Cloud Storage path to file containing validation dataset - * for tuning. 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()); - } - /** * Setter for tuningMode. * @@ -312,6 +293,25 @@ public Builder tuningMode(String tuningMode) { return tuningMode(new TuningMode(tuningMode)); } + /** + * Setter for validationDatasetUri. + * + *

validationDatasetUri: Optional. Cloud Storage path to file containing validation dataset + * for tuning. 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 DistillationSpec build(); } diff --git a/src/main/java/com/google/genai/types/Document.java b/src/main/java/com/google/genai/types/Document.java index 0f309fb657b..05da3073b67 100644 --- a/src/main/java/com/google/genai/types/Document.java +++ b/src/main/java/com/google/genai/types/Document.java @@ -35,16 +35,16 @@ @AutoValue @JsonDeserialize(builder = Document.Builder.class) public abstract class Document extends JsonSerializable { + /** Output only. The Timestamp of when the `Document` was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + /** - * Immutable. Identifier. The `Document` resource name. The ID (name excluding the - * "fileSearchStores/*/documents/" prefix) can contain up to 40 characters that are lowercase - * alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on - * create, a unique name will be derived from `display_name` along with a 12 character random - * suffix. Example: - * `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c` + * Optional. User provided custom metadata stored as key-value pairs used for querying. A + * `Document` can have a maximum of 20 `CustomMetadata`. */ - @JsonProperty("name") - public abstract Optional name(); + @JsonProperty("customMetadata") + public abstract Optional> customMetadata(); /** * Optional. The human-readable display name for the `Document`. The display name must be no more @@ -53,28 +53,28 @@ public abstract class Document extends JsonSerializable { @JsonProperty("displayName") public abstract Optional displayName(); - /** Output only. Current state of the `Document`. */ - @JsonProperty("state") - public abstract Optional state(); - - /** Output only. The size of raw bytes ingested into the Document. */ - @JsonProperty("sizeBytes") - public abstract Optional sizeBytes(); - /** Output only. The mime type of the Document. */ @JsonProperty("mimeType") public abstract Optional mimeType(); - /** Output only. The Timestamp of when the `Document` was created. */ - @JsonProperty("createTime") - public abstract Optional createTime(); - /** - * Optional. User provided custom metadata stored as key-value pairs used for querying. A - * `Document` can have a maximum of 20 `CustomMetadata`. + * Immutable. Identifier. The `Document` resource name. The ID (name excluding the + * "fileSearchStores/*/documents/" prefix) can contain up to 40 characters that are lowercase + * alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on + * create, a unique name will be derived from `display_name` along with a 12 character random + * suffix. Example: + * `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c` */ - @JsonProperty("customMetadata") - public abstract Optional> customMetadata(); + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. The size of raw bytes ingested into the Document. */ + @JsonProperty("sizeBytes") + public abstract Optional sizeBytes(); + + /** Output only. Current state of the `Document`. */ + @JsonProperty("state") + public abstract Optional state(); /** Output only. The Timestamp of when the `Document` was last updated. */ @JsonProperty("updateTime") @@ -99,26 +99,65 @@ private static Builder create() { } /** - * Setter for name. + * Setter for createTime. * - *

name: Immutable. Identifier. The `Document` resource name. The ID (name excluding the - * "fileSearchStores/*/documents/" prefix) can contain up to 40 characters that are - * lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is - * empty on create, a unique name will be derived from `display_name` along with a 12 character - * random suffix. Example: - * `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c` + *

createTime: Output only. The Timestamp of when the `Document` was created. */ - @JsonProperty("name") - public abstract Builder name(String name); + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); @ExcludeFromGeneratedCoverageReport - abstract Builder name(Optional name); + abstract Builder createTime(Optional createTime); - /** Clears the value of name field. */ + /** Clears the value of createTime field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearName() { - return name(Optional.empty()); + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for customMetadata. + * + *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for + * querying. A `Document` can have a maximum of 20 `CustomMetadata`. + */ + @JsonProperty("customMetadata") + public abstract Builder customMetadata(List customMetadata); + + /** + * Setter for customMetadata. + * + *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for + * querying. A `Document` can have a maximum of 20 `CustomMetadata`. + */ + @CanIgnoreReturnValue + public Builder customMetadata(CustomMetadata... customMetadata) { + return customMetadata(Arrays.asList(customMetadata)); + } + + /** + * Setter for customMetadata builder. + * + *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for + * querying. A `Document` can have a maximum of 20 `CustomMetadata`. + */ + @CanIgnoreReturnValue + public Builder customMetadata(CustomMetadata.Builder... customMetadataBuilders) { + return customMetadata( + Arrays.asList(customMetadataBuilders).stream() + .map(CustomMetadata.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customMetadata(Optional> customMetadata); + + /** Clears the value of customMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomMetadata() { + return customMetadata(Optional.empty()); } /** @@ -142,41 +181,44 @@ public Builder clearDisplayName() { } /** - * Setter for state. + * Setter for mimeType. * - *

state: Output only. Current state of the `Document`. + *

mimeType: Output only. The mime type of the Document. */ - @JsonProperty("state") - public abstract Builder state(DocumentState state); + @JsonProperty("mimeType") + public abstract Builder mimeType(String mimeType); @ExcludeFromGeneratedCoverageReport - abstract Builder state(Optional state); + abstract Builder mimeType(Optional mimeType); - /** Clears the value of state field. */ + /** Clears the value of mimeType field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearState() { - return state(Optional.empty()); + public Builder clearMimeType() { + return mimeType(Optional.empty()); } /** - * Setter for state given a known enum. + * Setter for name. * - *

state: Output only. Current state of the `Document`. + *

name: Immutable. Identifier. The `Document` resource name. The ID (name excluding the + * "fileSearchStores/*/documents/" prefix) can contain up to 40 characters that are + * lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is + * empty on create, a unique name will be derived from `display_name` along with a 12 character + * random suffix. Example: + * `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c` */ - @CanIgnoreReturnValue - public Builder state(DocumentState.Known knownType) { - return state(new DocumentState(knownType)); - } + @JsonProperty("name") + public abstract Builder name(String name); - /** - * Setter for state given a string. - * - *

state: Output only. Current state of the `Document`. - */ + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder state(String state) { - return state(new DocumentState(state)); + public Builder clearName() { + return name(Optional.empty()); } /** @@ -198,83 +240,41 @@ public Builder clearSizeBytes() { } /** - * Setter for mimeType. - * - *

mimeType: Output only. The mime type of the Document. - */ - @JsonProperty("mimeType") - public abstract Builder mimeType(String mimeType); - - @ExcludeFromGeneratedCoverageReport - abstract Builder mimeType(Optional mimeType); - - /** Clears the value of mimeType field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearMimeType() { - return mimeType(Optional.empty()); - } - - /** - * Setter for createTime. + * Setter for state. * - *

createTime: Output only. The Timestamp of when the `Document` was created. + *

state: Output only. Current state of the `Document`. */ - @JsonProperty("createTime") - public abstract Builder createTime(Instant createTime); + @JsonProperty("state") + public abstract Builder state(DocumentState state); @ExcludeFromGeneratedCoverageReport - abstract Builder createTime(Optional createTime); + abstract Builder state(Optional state); - /** Clears the value of createTime field. */ + /** Clears the value of state field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCreateTime() { - return createTime(Optional.empty()); + public Builder clearState() { + return state(Optional.empty()); } /** - * Setter for customMetadata. - * - *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for - * querying. A `Document` can have a maximum of 20 `CustomMetadata`. - */ - @JsonProperty("customMetadata") - public abstract Builder customMetadata(List customMetadata); - - /** - * Setter for customMetadata. + * Setter for state given a known enum. * - *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for - * querying. A `Document` can have a maximum of 20 `CustomMetadata`. + *

state: Output only. Current state of the `Document`. */ @CanIgnoreReturnValue - public Builder customMetadata(CustomMetadata... customMetadata) { - return customMetadata(Arrays.asList(customMetadata)); + public Builder state(DocumentState.Known knownType) { + return state(new DocumentState(knownType)); } /** - * Setter for customMetadata builder. + * Setter for state given a string. * - *

customMetadata: Optional. User provided custom metadata stored as key-value pairs used for - * querying. A `Document` can have a maximum of 20 `CustomMetadata`. + *

state: Output only. Current state of the `Document`. */ @CanIgnoreReturnValue - public Builder customMetadata(CustomMetadata.Builder... customMetadataBuilders) { - return customMetadata( - Arrays.asList(customMetadataBuilders).stream() - .map(CustomMetadata.Builder::build) - .collect(toImmutableList())); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder customMetadata(Optional> customMetadata); - - /** Clears the value of customMetadata field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearCustomMetadata() { - return customMetadata(Optional.empty()); + public Builder state(String state) { + return state(new DocumentState(state)); } /** diff --git a/src/main/java/com/google/genai/types/EmbedContentConfig.java b/src/main/java/com/google/genai/types/EmbedContentConfig.java index 2a600f22aec..1f50e4729dc 100644 --- a/src/main/java/com/google/genai/types/EmbedContentConfig.java +++ b/src/main/java/com/google/genai/types/EmbedContentConfig.java @@ -30,6 +30,10 @@ @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(); @@ -72,10 +76,6 @@ 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,6 +94,34 @@ 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. * @@ -226,34 +254,6 @@ 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/FileSearch.java b/src/main/java/com/google/genai/types/FileSearch.java index 1887e04ba85..e95af56c1de 100644 --- a/src/main/java/com/google/genai/types/FileSearch.java +++ b/src/main/java/com/google/genai/types/FileSearch.java @@ -43,14 +43,14 @@ public abstract class FileSearch extends JsonSerializable { @JsonProperty("fileSearchStoreNames") public abstract Optional> fileSearchStoreNames(); - /** Optional. The number of semantic retrieval chunks to retrieve. */ - @JsonProperty("topK") - public abstract Optional topK(); - /** Optional. Metadata filter to apply to the semantic retrieval documents and chunks. */ @JsonProperty("metadataFilter") public abstract Optional metadataFilter(); + /** Optional. The number of semantic retrieval chunks to retrieve. */ + @JsonProperty("topK") + public abstract Optional topK(); + /** Instantiates a builder for FileSearch. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -100,40 +100,40 @@ public Builder clearFileSearchStoreNames() { } /** - * Setter for topK. + * Setter for metadataFilter. * - *

topK: Optional. The number of semantic retrieval chunks to retrieve. + *

metadataFilter: Optional. Metadata filter to apply to the semantic retrieval documents and + * chunks. */ - @JsonProperty("topK") - public abstract Builder topK(Integer topK); + @JsonProperty("metadataFilter") + public abstract Builder metadataFilter(String metadataFilter); @ExcludeFromGeneratedCoverageReport - abstract Builder topK(Optional topK); + abstract Builder metadataFilter(Optional metadataFilter); - /** Clears the value of topK field. */ + /** Clears the value of metadataFilter field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearTopK() { - return topK(Optional.empty()); + public Builder clearMetadataFilter() { + return metadataFilter(Optional.empty()); } /** - * Setter for metadataFilter. + * Setter for topK. * - *

metadataFilter: Optional. Metadata filter to apply to the semantic retrieval documents and - * chunks. + *

topK: Optional. The number of semantic retrieval chunks to retrieve. */ - @JsonProperty("metadataFilter") - public abstract Builder metadataFilter(String metadataFilter); + @JsonProperty("topK") + public abstract Builder topK(Integer topK); @ExcludeFromGeneratedCoverageReport - abstract Builder metadataFilter(Optional metadataFilter); + abstract Builder topK(Optional topK); - /** Clears the value of metadataFilter field. */ + /** Clears the value of topK field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearMetadataFilter() { - return metadataFilter(Optional.empty()); + public Builder clearTopK() { + return topK(Optional.empty()); } public abstract FileSearch build(); diff --git a/src/main/java/com/google/genai/types/FileSearchStore.java b/src/main/java/com/google/genai/types/FileSearchStore.java index 21799ee1200..8b886fd6b17 100644 --- a/src/main/java/com/google/genai/types/FileSearchStore.java +++ b/src/main/java/com/google/genai/types/FileSearchStore.java @@ -31,16 +31,20 @@ @AutoValue @JsonDeserialize(builder = FileSearchStore.Builder.class) public abstract class FileSearchStore extends JsonSerializable { + /** The embedding model used by the FileSearchStore. */ + @JsonProperty("embeddingModel") + public abstract Optional embeddingModel(); + /** - * 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. + * Output only. The number of documents in the `FileSearchStore` that are active and ready for + * retrieval. */ - @JsonProperty("name") - public abstract Optional name(); + @JsonProperty("activeDocumentsCount") + public abstract Optional activeDocumentsCount(); + + /** Output only. The Timestamp of when the `FileSearchStore` was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); /** * Optional. The human-readable display name for the `FileSearchStore`. The display name must be @@ -49,29 +53,25 @@ public abstract class FileSearchStore extends JsonSerializable { @JsonProperty("displayName") public abstract Optional displayName(); - /** Output only. The Timestamp of when the `FileSearchStore` was created. */ - @JsonProperty("createTime") - public abstract Optional createTime(); - - /** Output only. The Timestamp of when the `FileSearchStore` was last updated. */ - @JsonProperty("updateTime") - public abstract Optional updateTime(); + /** Output only. The number of documents in the `FileSearchStore` that have failed processing. */ + @JsonProperty("failedDocumentsCount") + public abstract Optional failedDocumentsCount(); /** - * Output only. The number of documents in the `FileSearchStore` that are active and ready for - * retrieval. + * 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("activeDocumentsCount") - public abstract Optional activeDocumentsCount(); + @JsonProperty("name") + public abstract Optional name(); /** Output only. The number of documents in the `FileSearchStore` that are being processed. */ @JsonProperty("pendingDocumentsCount") public abstract Optional pendingDocumentsCount(); - /** Output only. The number of documents in the `FileSearchStore` that have failed processing. */ - @JsonProperty("failedDocumentsCount") - public abstract Optional failedDocumentsCount(); - /** * Output only. The size of raw bytes ingested into the `FileSearchStore`. This is the total size * of all the documents in the `FileSearchStore`. @@ -79,9 +79,9 @@ public abstract class FileSearchStore extends JsonSerializable { @JsonProperty("sizeBytes") public abstract Optional sizeBytes(); - /** The embedding model used by the FileSearchStore. */ - @JsonProperty("embeddingModel") - public abstract Optional embeddingModel(); + /** Output only. The Timestamp of when the `FileSearchStore` was last updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); /** Instantiates a builder for FileSearchStore. */ @ExcludeFromGeneratedCoverageReport @@ -102,46 +102,40 @@ private static Builder create() { } /** - * Setter for name. + * Setter for embeddingModel. * - *

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. + *

embeddingModel: The embedding model used by the FileSearchStore. */ - @JsonProperty("name") - public abstract Builder name(String name); + @JsonProperty("embeddingModel") + public abstract Builder embeddingModel(String embeddingModel); @ExcludeFromGeneratedCoverageReport - abstract Builder name(Optional name); + abstract Builder embeddingModel(Optional embeddingModel); - /** Clears the value of name field. */ + /** Clears the value of embeddingModel field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearName() { - return name(Optional.empty()); + public Builder clearEmbeddingModel() { + return embeddingModel(Optional.empty()); } /** - * Setter for displayName. + * Setter for activeDocumentsCount. * - *

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". + *

activeDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * are active and ready for retrieval. */ - @JsonProperty("displayName") - public abstract Builder displayName(String displayName); + @JsonProperty("activeDocumentsCount") + public abstract Builder activeDocumentsCount(Long activeDocumentsCount); @ExcludeFromGeneratedCoverageReport - abstract Builder displayName(Optional displayName); + abstract Builder activeDocumentsCount(Optional activeDocumentsCount); - /** Clears the value of displayName field. */ + /** Clears the value of activeDocumentsCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearDisplayName() { - return displayName(Optional.empty()); + public Builder clearActiveDocumentsCount() { + return activeDocumentsCount(Optional.empty()); } /** @@ -163,78 +157,84 @@ public Builder clearCreateTime() { } /** - * Setter for updateTime. + * Setter for displayName. * - *

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

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("updateTime") - public abstract Builder updateTime(Instant updateTime); + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); @ExcludeFromGeneratedCoverageReport - abstract Builder updateTime(Optional updateTime); + abstract Builder displayName(Optional displayName); - /** Clears the value of updateTime field. */ + /** Clears the value of displayName field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearUpdateTime() { - return updateTime(Optional.empty()); + public Builder clearDisplayName() { + return displayName(Optional.empty()); } /** - * Setter for activeDocumentsCount. + * Setter for failedDocumentsCount. * - *

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

failedDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * have failed processing. */ - @JsonProperty("activeDocumentsCount") - public abstract Builder activeDocumentsCount(Long activeDocumentsCount); + @JsonProperty("failedDocumentsCount") + public abstract Builder failedDocumentsCount(Long failedDocumentsCount); @ExcludeFromGeneratedCoverageReport - abstract Builder activeDocumentsCount(Optional activeDocumentsCount); + abstract Builder failedDocumentsCount(Optional failedDocumentsCount); - /** Clears the value of activeDocumentsCount field. */ + /** Clears the value of failedDocumentsCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearActiveDocumentsCount() { - return activeDocumentsCount(Optional.empty()); + public Builder clearFailedDocumentsCount() { + return failedDocumentsCount(Optional.empty()); } /** - * Setter for pendingDocumentsCount. + * Setter for name. * - *

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

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("pendingDocumentsCount") - public abstract Builder pendingDocumentsCount(Long pendingDocumentsCount); + @JsonProperty("name") + public abstract Builder name(String name); @ExcludeFromGeneratedCoverageReport - abstract Builder pendingDocumentsCount(Optional pendingDocumentsCount); + abstract Builder name(Optional name); - /** Clears the value of pendingDocumentsCount field. */ + /** Clears the value of name field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearPendingDocumentsCount() { - return pendingDocumentsCount(Optional.empty()); + public Builder clearName() { + return name(Optional.empty()); } /** - * Setter for failedDocumentsCount. + * Setter for pendingDocumentsCount. * - *

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

pendingDocumentsCount: Output only. The number of documents in the `FileSearchStore` that + * are being processed. */ - @JsonProperty("failedDocumentsCount") - public abstract Builder failedDocumentsCount(Long failedDocumentsCount); + @JsonProperty("pendingDocumentsCount") + public abstract Builder pendingDocumentsCount(Long pendingDocumentsCount); @ExcludeFromGeneratedCoverageReport - abstract Builder failedDocumentsCount(Optional failedDocumentsCount); + abstract Builder pendingDocumentsCount(Optional pendingDocumentsCount); - /** Clears the value of failedDocumentsCount field. */ + /** Clears the value of pendingDocumentsCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearFailedDocumentsCount() { - return failedDocumentsCount(Optional.empty()); + public Builder clearPendingDocumentsCount() { + return pendingDocumentsCount(Optional.empty()); } /** @@ -257,21 +257,21 @@ public Builder clearSizeBytes() { } /** - * Setter for embeddingModel. + * Setter for updateTime. * - *

embeddingModel: The embedding model used by the FileSearchStore. + *

updateTime: Output only. The Timestamp of when the `FileSearchStore` was last updated. */ - @JsonProperty("embeddingModel") - public abstract Builder embeddingModel(String embeddingModel); + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); @ExcludeFromGeneratedCoverageReport - abstract Builder embeddingModel(Optional embeddingModel); + abstract Builder updateTime(Optional updateTime); - /** Clears the value of embeddingModel field. */ + /** Clears the value of updateTime field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearEmbeddingModel() { - return embeddingModel(Optional.empty()); + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); } public abstract FileSearchStore build(); diff --git a/src/main/java/com/google/genai/types/FunctionCall.java b/src/main/java/com/google/genai/types/FunctionCall.java index 6094f0b4541..41f7656829c 100644 --- a/src/main/java/com/google/genai/types/FunctionCall.java +++ b/src/main/java/com/google/genai/types/FunctionCall.java @@ -38,13 +38,6 @@ @AutoValue @JsonDeserialize(builder = FunctionCall.Builder.class) public abstract class FunctionCall extends JsonSerializable { - /** - * Optional. The unique id of the function call. If populated, the client to execute the - * `function_call` and return the response with the matching `id`. - */ - @JsonProperty("id") - public abstract Optional id(); - /** * Optional. The function parameters and values in JSON object format. See * FunctionDeclaration.parameters for parameter details. @@ -52,6 +45,13 @@ public abstract class FunctionCall extends JsonSerializable { @JsonProperty("args") public abstract Optional> args(); + /** + * Optional. The unique id of the function call. If populated, the client to execute the + * `function_call` and return the response with the matching `id`. + */ + @JsonProperty("id") + public abstract Optional id(); + /** Optional. The name of the function to call. Matches FunctionDeclaration.name. */ @JsonProperty("name") public abstract Optional name(); @@ -89,41 +89,41 @@ private static Builder create() { } /** - * Setter for id. + * Setter for args. * - *

id: Optional. The unique id of the function call. If populated, the client to execute the - * `function_call` and return the response with the matching `id`. + *

args: Optional. The function parameters and values in JSON object format. See + * FunctionDeclaration.parameters for parameter details. */ - @JsonProperty("id") - public abstract Builder id(String id); + @JsonProperty("args") + public abstract Builder args(Map args); @ExcludeFromGeneratedCoverageReport - abstract Builder id(Optional id); + abstract Builder args(Optional> args); - /** Clears the value of id field. */ + /** Clears the value of args field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearId() { - return id(Optional.empty()); + public Builder clearArgs() { + return args(Optional.empty()); } /** - * Setter for args. + * Setter for id. * - *

args: Optional. The function parameters and values in JSON object format. See - * FunctionDeclaration.parameters for parameter details. + *

id: Optional. The unique id of the function call. If populated, the client to execute the + * `function_call` and return the response with the matching `id`. */ - @JsonProperty("args") - public abstract Builder args(Map args); + @JsonProperty("id") + public abstract Builder id(String id); @ExcludeFromGeneratedCoverageReport - abstract Builder args(Optional> args); + abstract Builder id(Optional id); - /** Clears the value of args field. */ + /** Clears the value of id field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearArgs() { - return args(Optional.empty()); + public Builder clearId() { + return id(Optional.empty()); } /** diff --git a/src/main/java/com/google/genai/types/FunctionDeclaration.java b/src/main/java/com/google/genai/types/FunctionDeclaration.java index cca7a2e9ed0..95272b78712 100644 --- a/src/main/java/com/google/genai/types/FunctionDeclaration.java +++ b/src/main/java/com/google/genai/types/FunctionDeclaration.java @@ -45,6 +45,14 @@ @AutoValue @JsonDeserialize(builder = FunctionDeclaration.Builder.class) public abstract class FunctionDeclaration extends JsonSerializable { + /** + * Optional. Specifies the function Behavior. If not specified, the system keeps the current + * function call behavior. This field is currently only supported by the BidiGenerateContent + * method. + */ + @JsonProperty("behavior") + public abstract Optional behavior(); + /** * Optional. Description and purpose of the function. Model uses it to decide how and whether to * call the function. @@ -96,14 +104,6 @@ public abstract class FunctionDeclaration extends JsonSerializable { @JsonProperty("responseJsonSchema") public abstract Optional responseJsonSchema(); - /** - * Optional. Specifies the function Behavior. If not specified, the system keeps the current - * function call behavior. This field is currently only supported by the BidiGenerateContent - * method. - */ - @JsonProperty("behavior") - public abstract Optional behavior(); - /** Instantiates a builder for FunctionDeclaration. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -122,6 +122,50 @@ private static Builder create() { return new AutoValue_FunctionDeclaration.Builder(); } + /** + * Setter for behavior. + * + *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps + * the current function call behavior. This field is currently only supported by the + * BidiGenerateContent method. + */ + @JsonProperty("behavior") + public abstract Builder behavior(Behavior behavior); + + @ExcludeFromGeneratedCoverageReport + abstract Builder behavior(Optional behavior); + + /** Clears the value of behavior field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBehavior() { + return behavior(Optional.empty()); + } + + /** + * Setter for behavior given a known enum. + * + *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps + * the current function call behavior. This field is currently only supported by the + * BidiGenerateContent method. + */ + @CanIgnoreReturnValue + public Builder behavior(Behavior.Known knownType) { + return behavior(new Behavior(knownType)); + } + + /** + * Setter for behavior given a string. + * + *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps + * the current function call behavior. This field is currently only supported by the + * BidiGenerateContent method. + */ + @CanIgnoreReturnValue + public Builder behavior(String behavior) { + return behavior(new Behavior(behavior)); + } + /** * Setter for description. * @@ -275,50 +319,6 @@ public Builder clearResponseJsonSchema() { return responseJsonSchema(Optional.empty()); } - /** - * Setter for behavior. - * - *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps - * the current function call behavior. This field is currently only supported by the - * BidiGenerateContent method. - */ - @JsonProperty("behavior") - public abstract Builder behavior(Behavior behavior); - - @ExcludeFromGeneratedCoverageReport - abstract Builder behavior(Optional behavior); - - /** Clears the value of behavior field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearBehavior() { - return behavior(Optional.empty()); - } - - /** - * Setter for behavior given a known enum. - * - *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps - * the current function call behavior. This field is currently only supported by the - * BidiGenerateContent method. - */ - @CanIgnoreReturnValue - public Builder behavior(Behavior.Known knownType) { - return behavior(new Behavior(knownType)); - } - - /** - * Setter for behavior given a string. - * - *

behavior: Optional. Specifies the function Behavior. If not specified, the system keeps - * the current function call behavior. This field is currently only supported by the - * BidiGenerateContent method. - */ - @CanIgnoreReturnValue - public Builder behavior(String behavior) { - return behavior(new Behavior(behavior)); - } - public abstract FunctionDeclaration build(); } diff --git a/src/main/java/com/google/genai/types/FunctionResponse.java b/src/main/java/com/google/genai/types/FunctionResponse.java index cc220fcb59d..b767261c447 100644 --- a/src/main/java/com/google/genai/types/FunctionResponse.java +++ b/src/main/java/com/google/genai/types/FunctionResponse.java @@ -40,32 +40,6 @@ @AutoValue @JsonDeserialize(builder = FunctionResponse.Builder.class) public abstract class FunctionResponse extends JsonSerializable { - /** - * Optional. Signals that function call continues, and more responses will be returned, turning - * the function call into a generator. Is only applicable to NON_BLOCKING function calls, is - * ignored otherwise. If set to false, future responses will not be considered. It is allowed to - * return empty `response` with `will_continue=False` to signal that the function call is - * finished. This may still trigger the model generation. To avoid triggering the generation and - * finish the function call, additionally set `scheduling` to `SILENT`. This field is not - * supported in Vertex AI. - */ - @JsonProperty("willContinue") - public abstract Optional willContinue(); - - /** - * Optional. Specifies how the response should be scheduled in the conversation. Only applicable - * to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. - */ - @JsonProperty("scheduling") - public abstract Optional scheduling(); - - /** - * Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA - * MIME types. - */ - @JsonProperty("parts") - public abstract Optional> parts(); - /** * Optional. The id of the function call this response is for. Populated by the client to match * the corresponding function call `id`. @@ -80,6 +54,13 @@ public abstract class FunctionResponse extends JsonSerializable { @JsonProperty("name") public abstract Optional name(); + /** + * Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA + * MIME types. + */ + @JsonProperty("parts") + public abstract Optional> parts(); + /** * Required. The function response in JSON object format. Use "output" key to specify function * output and "error" key to specify error details (if any). If "output" and "error" keys are not @@ -88,6 +69,25 @@ public abstract class FunctionResponse extends JsonSerializable { @JsonProperty("response") public abstract Optional> response(); + /** + * Optional. Specifies how the response should be scheduled in the conversation. Only applicable + * to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. + */ + @JsonProperty("scheduling") + public abstract Optional scheduling(); + + /** + * Optional. Signals that function call continues, and more responses will be returned, turning + * the function call into a generator. Is only applicable to NON_BLOCKING function calls, is + * ignored otherwise. If set to false, future responses will not be considered. It is allowed to + * return empty `response` with `will_continue=False` to signal that the function call is + * finished. This may still trigger the model generation. To avoid triggering the generation and + * finish the function call, additionally set `scheduling` to `SILENT`. This field is not + * supported in Vertex AI. + */ + @JsonProperty("willContinue") + public abstract Optional willContinue(); + /** Instantiates a builder for FunctionResponse. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -107,68 +107,41 @@ private static Builder create() { } /** - * Setter for willContinue. + * Setter for id. * - *

willContinue: Optional. Signals that function call continues, and more responses will be - * returned, turning the function call into a generator. Is only applicable to NON_BLOCKING - * function calls, is ignored otherwise. If set to false, future responses will not be - * considered. It is allowed to return empty `response` with `will_continue=False` to signal - * that the function call is finished. This may still trigger the model generation. To avoid - * triggering the generation and finish the function call, additionally set `scheduling` to - * `SILENT`. This field is not supported in Vertex AI. + *

id: Optional. The id of the function call this response is for. Populated by the client to + * match the corresponding function call `id`. */ - @JsonProperty("willContinue") - public abstract Builder willContinue(boolean willContinue); + @JsonProperty("id") + public abstract Builder id(String id); @ExcludeFromGeneratedCoverageReport - abstract Builder willContinue(Optional willContinue); + abstract Builder id(Optional id); - /** Clears the value of willContinue field. */ + /** Clears the value of id field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearWillContinue() { - return willContinue(Optional.empty()); + public Builder clearId() { + return id(Optional.empty()); } /** - * Setter for scheduling. + * Setter for name. * - *

scheduling: Optional. Specifies how the response should be scheduled in the conversation. - * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. + *

name: Required. The name of the function to call. Matches FunctionDeclaration.name and + * FunctionCall.name. */ - @JsonProperty("scheduling") - public abstract Builder scheduling(FunctionResponseScheduling scheduling); + @JsonProperty("name") + public abstract Builder name(String name); @ExcludeFromGeneratedCoverageReport - abstract Builder scheduling(Optional scheduling); + abstract Builder name(Optional name); - /** Clears the value of scheduling field. */ + /** Clears the value of name field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearScheduling() { - return scheduling(Optional.empty()); - } - - /** - * Setter for scheduling given a known enum. - * - *

scheduling: Optional. Specifies how the response should be scheduled in the conversation. - * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. - */ - @CanIgnoreReturnValue - public Builder scheduling(FunctionResponseScheduling.Known knownType) { - return scheduling(new FunctionResponseScheduling(knownType)); - } - - /** - * Setter for scheduling given a string. - * - *

scheduling: Optional. Specifies how the response should be scheduled in the conversation. - * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. - */ - @CanIgnoreReturnValue - public Builder scheduling(String scheduling) { - return scheduling(new FunctionResponseScheduling(scheduling)); + public Builder clearName() { + return name(Optional.empty()); } /** @@ -216,61 +189,88 @@ public Builder clearParts() { } /** - * Setter for id. + * Setter for response. * - *

id: Optional. The id of the function call this response is for. Populated by the client to - * match the corresponding function call `id`. + *

response: Required. The function response in JSON object format. Use "output" key to + * specify function output and "error" key to specify error details (if any). If "output" and + * "error" keys are not specified, then whole "response" is treated as function output. */ - @JsonProperty("id") - public abstract Builder id(String id); + @JsonProperty("response") + public abstract Builder response(Map response); @ExcludeFromGeneratedCoverageReport - abstract Builder id(Optional id); + abstract Builder response(Optional> response); - /** Clears the value of id field. */ + /** Clears the value of response field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearId() { - return id(Optional.empty()); + public Builder clearResponse() { + return response(Optional.empty()); } /** - * Setter for name. + * Setter for scheduling. * - *

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

scheduling: Optional. Specifies how the response should be scheduled in the conversation. + * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */ - @JsonProperty("name") - public abstract Builder name(String name); + @JsonProperty("scheduling") + public abstract Builder scheduling(FunctionResponseScheduling scheduling); @ExcludeFromGeneratedCoverageReport - abstract Builder name(Optional name); + abstract Builder scheduling(Optional scheduling); - /** Clears the value of name field. */ + /** Clears the value of scheduling field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearName() { - return name(Optional.empty()); + public Builder clearScheduling() { + return scheduling(Optional.empty()); } /** - * Setter for response. + * Setter for scheduling given a known enum. * - *

response: Required. The function response in JSON object format. Use "output" key to - * specify function output and "error" key to specify error details (if any). If "output" and - * "error" keys are not specified, then whole "response" is treated as function output. + *

scheduling: Optional. Specifies how the response should be scheduled in the conversation. + * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */ - @JsonProperty("response") - public abstract Builder response(Map response); + @CanIgnoreReturnValue + public Builder scheduling(FunctionResponseScheduling.Known knownType) { + return scheduling(new FunctionResponseScheduling(knownType)); + } + + /** + * Setter for scheduling given a string. + * + *

scheduling: Optional. Specifies how the response should be scheduled in the conversation. + * Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. + */ + @CanIgnoreReturnValue + public Builder scheduling(String scheduling) { + return scheduling(new FunctionResponseScheduling(scheduling)); + } + + /** + * Setter for willContinue. + * + *

willContinue: Optional. Signals that function call continues, and more responses will be + * returned, turning the function call into a generator. Is only applicable to NON_BLOCKING + * function calls, is ignored otherwise. If set to false, future responses will not be + * considered. It is allowed to return empty `response` with `will_continue=False` to signal + * that the function call is finished. This may still trigger the model generation. To avoid + * triggering the generation and finish the function call, additionally set `scheduling` to + * `SILENT`. This field is not supported in Vertex AI. + */ + @JsonProperty("willContinue") + public abstract Builder willContinue(boolean willContinue); @ExcludeFromGeneratedCoverageReport - abstract Builder response(Optional> response); + abstract Builder willContinue(Optional willContinue); - /** Clears the value of response field. */ + /** Clears the value of willContinue field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearResponse() { - return response(Optional.empty()); + public Builder clearWillContinue() { + return willContinue(Optional.empty()); } public abstract FunctionResponse build(); diff --git a/src/main/java/com/google/genai/types/FunctionResponseBlob.java b/src/main/java/com/google/genai/types/FunctionResponseBlob.java index a3c59e8265a..e5254601143 100644 --- a/src/main/java/com/google/genai/types/FunctionResponseBlob.java +++ b/src/main/java/com/google/genai/types/FunctionResponseBlob.java @@ -33,10 +33,6 @@ @AutoValue @JsonDeserialize(builder = FunctionResponseBlob.Builder.class) public abstract class FunctionResponseBlob extends JsonSerializable { - /** Required. The IANA standard MIME type of the source data. */ - @JsonProperty("mimeType") - public abstract Optional mimeType(); - /** Required. Raw bytes. */ @JsonProperty("data") public abstract Optional data(); @@ -50,6 +46,10 @@ public abstract class FunctionResponseBlob extends JsonSerializable { @JsonProperty("displayName") public abstract Optional displayName(); + /** Required. The IANA standard MIME type of the source data. */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + /** Instantiates a builder for FunctionResponseBlob. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -68,24 +68,6 @@ private static Builder create() { return new AutoValue_FunctionResponseBlob.Builder(); } - /** - * Setter for mimeType. - * - *

mimeType: Required. The IANA standard MIME type of the source data. - */ - @JsonProperty("mimeType") - public abstract Builder mimeType(String mimeType); - - @ExcludeFromGeneratedCoverageReport - abstract Builder mimeType(Optional mimeType); - - /** Clears the value of mimeType field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearMimeType() { - return mimeType(Optional.empty()); - } - /** * Setter for data. * @@ -126,6 +108,24 @@ public Builder clearDisplayName() { return displayName(Optional.empty()); } + /** + * Setter for mimeType. + * + *

mimeType: Required. The IANA standard MIME type of the source data. + */ + @JsonProperty("mimeType") + public abstract Builder mimeType(String mimeType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mimeType(Optional mimeType); + + /** Clears the value of mimeType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMimeType() { + return mimeType(Optional.empty()); + } + public abstract FunctionResponseBlob build(); } diff --git a/src/main/java/com/google/genai/types/FunctionResponseFileData.java b/src/main/java/com/google/genai/types/FunctionResponseFileData.java index 2b346a2fb4e..e5c1bf2f36f 100644 --- a/src/main/java/com/google/genai/types/FunctionResponseFileData.java +++ b/src/main/java/com/google/genai/types/FunctionResponseFileData.java @@ -30,14 +30,6 @@ @AutoValue @JsonDeserialize(builder = FunctionResponseFileData.Builder.class) public abstract class FunctionResponseFileData extends JsonSerializable { - /** Required. URI. */ - @JsonProperty("fileUri") - public abstract Optional fileUri(); - - /** Required. The IANA standard MIME type of the source data. */ - @JsonProperty("mimeType") - public abstract Optional mimeType(); - /** * Optional. Display name of the file data. Used to provide a label or filename to distinguish * file datas. This field is only returned in PromptMessage for prompt management. It is currently @@ -47,6 +39,14 @@ public abstract class FunctionResponseFileData extends JsonSerializable { @JsonProperty("displayName") public abstract Optional displayName(); + /** Required. URI. */ + @JsonProperty("fileUri") + public abstract Optional fileUri(); + + /** Required. The IANA standard MIME type of the source data. */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + /** Instantiates a builder for FunctionResponseFileData. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -65,6 +65,27 @@ private static Builder create() { return new AutoValue_FunctionResponseFileData.Builder(); } + /** + * Setter for displayName. + * + *

displayName: Optional. Display name of the file data. Used to provide a label or filename + * to distinguish file datas. This field is only returned in PromptMessage for prompt + * management. It is currently used in the Gemini GenerateContent calls only when server side + * tools (code_execution, google_search, and url_context) are enabled. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + /** * Setter for fileUri. * @@ -101,27 +122,6 @@ public Builder clearMimeType() { return mimeType(Optional.empty()); } - /** - * Setter for displayName. - * - *

displayName: Optional. Display name of the file data. Used to provide a label or filename - * to distinguish file datas. This field is only returned in PromptMessage for prompt - * management. It is currently used in the Gemini GenerateContent calls only when server side - * tools (code_execution, google_search, and url_context) are enabled. - */ - @JsonProperty("displayName") - public abstract Builder displayName(String displayName); - - @ExcludeFromGeneratedCoverageReport - abstract Builder displayName(Optional displayName); - - /** Clears the value of displayName field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearDisplayName() { - return displayName(Optional.empty()); - } - public abstract FunctionResponseFileData build(); } diff --git a/src/main/java/com/google/genai/types/FunctionResponsePart.java b/src/main/java/com/google/genai/types/FunctionResponsePart.java index 0d545e1022a..9eed884c6ea 100644 --- a/src/main/java/com/google/genai/types/FunctionResponsePart.java +++ b/src/main/java/com/google/genai/types/FunctionResponsePart.java @@ -36,14 +36,14 @@ @AutoValue @JsonDeserialize(builder = FunctionResponsePart.Builder.class) public abstract class FunctionResponsePart extends JsonSerializable { - /** Inline media bytes. */ - @JsonProperty("inlineData") - public abstract Optional inlineData(); - /** URI based data. This field is not supported in Gemini API. */ @JsonProperty("fileData") public abstract Optional fileData(); + /** Inline media bytes. */ + @JsonProperty("inlineData") + public abstract Optional inlineData(); + /** Instantiates a builder for FunctionResponsePart. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -63,59 +63,59 @@ private static Builder create() { } /** - * Setter for inlineData. + * Setter for fileData. * - *

inlineData: Inline media bytes. + *

fileData: URI based data. This field is not supported in Gemini API. */ - @JsonProperty("inlineData") - public abstract Builder inlineData(FunctionResponseBlob inlineData); + @JsonProperty("fileData") + public abstract Builder fileData(FunctionResponseFileData fileData); /** - * Setter for inlineData builder. + * Setter for fileData builder. * - *

inlineData: Inline media bytes. + *

fileData: URI based data. This field is not supported in Gemini API. */ @CanIgnoreReturnValue - public Builder inlineData(FunctionResponseBlob.Builder inlineDataBuilder) { - return inlineData(inlineDataBuilder.build()); + public Builder fileData(FunctionResponseFileData.Builder fileDataBuilder) { + return fileData(fileDataBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder inlineData(Optional inlineData); + abstract Builder fileData(Optional fileData); - /** Clears the value of inlineData field. */ + /** Clears the value of fileData field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearInlineData() { - return inlineData(Optional.empty()); + public Builder clearFileData() { + return fileData(Optional.empty()); } /** - * Setter for fileData. + * Setter for inlineData. * - *

fileData: URI based data. This field is not supported in Gemini API. + *

inlineData: Inline media bytes. */ - @JsonProperty("fileData") - public abstract Builder fileData(FunctionResponseFileData fileData); + @JsonProperty("inlineData") + public abstract Builder inlineData(FunctionResponseBlob inlineData); /** - * Setter for fileData builder. + * Setter for inlineData builder. * - *

fileData: URI based data. This field is not supported in Gemini API. + *

inlineData: Inline media bytes. */ @CanIgnoreReturnValue - public Builder fileData(FunctionResponseFileData.Builder fileDataBuilder) { - return fileData(fileDataBuilder.build()); + public Builder inlineData(FunctionResponseBlob.Builder inlineDataBuilder) { + return inlineData(inlineDataBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder fileData(Optional fileData); + abstract Builder inlineData(Optional inlineData); - /** Clears the value of fileData field. */ + /** Clears the value of inlineData field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearFileData() { - return fileData(Optional.empty()); + public Builder clearInlineData() { + return inlineData(Optional.empty()); } public abstract FunctionResponsePart build(); diff --git a/src/main/java/com/google/genai/types/GenerateContentConfig.java b/src/main/java/com/google/genai/types/GenerateContentConfig.java index 1ef4635f37d..2c361f33d12 100644 --- a/src/main/java/com/google/genai/types/GenerateContentConfig.java +++ b/src/main/java/com/google/genai/types/GenerateContentConfig.java @@ -48,6 +48,10 @@ public abstract class GenerateContentConfig extends JsonSerializable { @JsonProperty("shouldReturnHttpResponse") public abstract Optional shouldReturnHttpResponse(); + /** The service tier to use for the request. For example, ServiceTier.FLEX. */ + @JsonProperty("serviceTier") + public abstract Optional serviceTier(); + /** * Instructions for the model to steer it toward better performance. For example, "Answer as * concisely as possible" or "Don't use technical terms in your response". @@ -221,6 +225,10 @@ public abstract class GenerateContentConfig extends JsonSerializable { @JsonProperty("thinkingConfig") public abstract Optional thinkingConfig(); + /** Optional. Configuration for audio transcription (speech recognition). */ + @JsonProperty("audioTranscriptionConfig") + public abstract Optional audioTranscriptionConfig(); + /** The image generation configuration. */ @JsonProperty("imageConfig") public abstract Optional imageConfig(); @@ -239,10 +247,6 @@ public abstract class GenerateContentConfig extends JsonSerializable { @JsonProperty("modelArmorConfig") public abstract Optional modelArmorConfig(); - /** The service tier to use for the request. For example, ServiceTier.FLEX. */ - @JsonProperty("serviceTier") - public abstract Optional serviceTier(); - /** Instantiates a builder for GenerateContentConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -308,6 +312,44 @@ public Builder clearShouldReturnHttpResponse() { return shouldReturnHttpResponse(Optional.empty()); } + /** + * Setter for serviceTier. + * + *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. + */ + @JsonProperty("serviceTier") + public abstract Builder serviceTier(ServiceTier serviceTier); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceTier(Optional serviceTier); + + /** Clears the value of serviceTier field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceTier() { + return serviceTier(Optional.empty()); + } + + /** + * Setter for serviceTier given a known enum. + * + *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. + */ + @CanIgnoreReturnValue + public Builder serviceTier(ServiceTier.Known knownType) { + return serviceTier(new ServiceTier(knownType)); + } + + /** + * Setter for serviceTier given a string. + * + *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. + */ + @CanIgnoreReturnValue + public Builder serviceTier(String serviceTier) { + return serviceTier(new ServiceTier(serviceTier)); + } + /** * Setter for systemInstruction. * @@ -1030,6 +1072,39 @@ public Builder clearThinkingConfig() { return thinkingConfig(Optional.empty()); } + /** + * Setter for audioTranscriptionConfig. + * + *

audioTranscriptionConfig: Optional. Configuration for audio transcription (speech + * recognition). + */ + @JsonProperty("audioTranscriptionConfig") + public abstract Builder audioTranscriptionConfig( + AudioTranscriptionConfig audioTranscriptionConfig); + + /** + * Setter for audioTranscriptionConfig builder. + * + *

audioTranscriptionConfig: Optional. Configuration for audio transcription (speech + * recognition). + */ + @CanIgnoreReturnValue + public Builder audioTranscriptionConfig( + AudioTranscriptionConfig.Builder audioTranscriptionConfigBuilder) { + return audioTranscriptionConfig(audioTranscriptionConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder audioTranscriptionConfig( + Optional audioTranscriptionConfig); + + /** Clears the value of audioTranscriptionConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAudioTranscriptionConfig() { + return audioTranscriptionConfig(Optional.empty()); + } + /** * Setter for imageConfig. * @@ -1107,44 +1182,6 @@ public Builder clearModelArmorConfig() { return modelArmorConfig(Optional.empty()); } - /** - * Setter for serviceTier. - * - *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. - */ - @JsonProperty("serviceTier") - public abstract Builder serviceTier(ServiceTier serviceTier); - - @ExcludeFromGeneratedCoverageReport - abstract Builder serviceTier(Optional serviceTier); - - /** Clears the value of serviceTier field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearServiceTier() { - return serviceTier(Optional.empty()); - } - - /** - * Setter for serviceTier given a known enum. - * - *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. - */ - @CanIgnoreReturnValue - public Builder serviceTier(ServiceTier.Known knownType) { - return serviceTier(new ServiceTier(knownType)); - } - - /** - * Setter for serviceTier given a string. - * - *

serviceTier: The service tier to use for the request. For example, ServiceTier.FLEX. - */ - @CanIgnoreReturnValue - public Builder serviceTier(String serviceTier) { - return serviceTier(new ServiceTier(serviceTier)); - } - public abstract GenerateContentConfig build(); } diff --git a/src/main/java/com/google/genai/types/GenerationConfig.java b/src/main/java/com/google/genai/types/GenerationConfig.java index e35403c01a4..da80a37d94a 100644 --- a/src/main/java/com/google/genai/types/GenerationConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfig.java @@ -46,6 +46,10 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("responseJsonSchema") public abstract Optional responseJsonSchema(); + /** Optional. Configuration for audio transcription (speech recognition). */ + @JsonProperty("audioTranscriptionConfig") + public abstract Optional audioTranscriptionConfig(); + /** * Optional. If enabled, audio timestamps will be included in the request to the model. This can * be useful for synchronizing audio with other modalities in the response. This field is not @@ -111,6 +115,12 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("presencePenalty") public abstract Optional presencePenalty(); + /** + * Optional. New response format field for the model to configure output formatting and delivery. + */ + @JsonProperty("responseFormat") + public abstract Optional> responseFormat(); + /** * Optional. If set to true, the log probabilities of the output tokens are returned. Log * probabilities are the logarithm of the probability of a token appearing in the output. A higher @@ -217,12 +227,6 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("enableEnhancedCivicAnswers") public abstract Optional enableEnhancedCivicAnswers(); - /** - * Optional. New response format field for the model to configure output formatting and delivery. - */ - @JsonProperty("responseFormat") - public abstract Optional> responseFormat(); - /** Optional. Config for translation. This field is not supported in Vertex AI. */ @JsonProperty("translationConfig") public abstract Optional translationConfig(); @@ -292,6 +296,39 @@ public Builder clearResponseJsonSchema() { return responseJsonSchema(Optional.empty()); } + /** + * Setter for audioTranscriptionConfig. + * + *

audioTranscriptionConfig: Optional. Configuration for audio transcription (speech + * recognition). + */ + @JsonProperty("audioTranscriptionConfig") + public abstract Builder audioTranscriptionConfig( + AudioTranscriptionConfig audioTranscriptionConfig); + + /** + * Setter for audioTranscriptionConfig builder. + * + *

audioTranscriptionConfig: Optional. Configuration for audio transcription (speech + * recognition). + */ + @CanIgnoreReturnValue + public Builder audioTranscriptionConfig( + AudioTranscriptionConfig.Builder audioTranscriptionConfigBuilder) { + return audioTranscriptionConfig(audioTranscriptionConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder audioTranscriptionConfig( + Optional audioTranscriptionConfig); + + /** Clears the value of audioTranscriptionConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAudioTranscriptionConfig() { + return audioTranscriptionConfig(Optional.empty()); + } + /** * Setter for audioTimestamp. * @@ -483,6 +520,50 @@ public Builder clearPresencePenalty() { return presencePenalty(Optional.empty()); } + /** + * Setter for responseFormat. + * + *

responseFormat: Optional. New response format field for the model to configure output + * formatting and delivery. + */ + @JsonProperty("responseFormat") + public abstract Builder responseFormat(List responseFormat); + + /** + * Setter for responseFormat. + * + *

responseFormat: Optional. New response format field for the model to configure output + * formatting and delivery. + */ + @CanIgnoreReturnValue + public Builder responseFormat(ResponseFormat... responseFormat) { + return responseFormat(Arrays.asList(responseFormat)); + } + + /** + * Setter for responseFormat builder. + * + *

responseFormat: Optional. New response format field for the model to configure output + * formatting and delivery. + */ + @CanIgnoreReturnValue + public Builder responseFormat(ResponseFormat.Builder... responseFormatBuilders) { + return responseFormat( + Arrays.asList(responseFormatBuilders).stream() + .map(ResponseFormat.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder responseFormat(Optional> responseFormat); + + /** Clears the value of responseFormat field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponseFormat() { + return responseFormat(Optional.empty()); + } + /** * Setter for responseLogprobs. * @@ -874,50 +955,6 @@ public Builder clearEnableEnhancedCivicAnswers() { return enableEnhancedCivicAnswers(Optional.empty()); } - /** - * Setter for responseFormat. - * - *

responseFormat: Optional. New response format field for the model to configure output - * formatting and delivery. - */ - @JsonProperty("responseFormat") - public abstract Builder responseFormat(List responseFormat); - - /** - * Setter for responseFormat. - * - *

responseFormat: Optional. New response format field for the model to configure output - * formatting and delivery. - */ - @CanIgnoreReturnValue - public Builder responseFormat(ResponseFormat... responseFormat) { - return responseFormat(Arrays.asList(responseFormat)); - } - - /** - * Setter for responseFormat builder. - * - *

responseFormat: Optional. New response format field for the model to configure output - * formatting and delivery. - */ - @CanIgnoreReturnValue - public Builder responseFormat(ResponseFormat.Builder... responseFormatBuilders) { - return responseFormat( - Arrays.asList(responseFormatBuilders).stream() - .map(ResponseFormat.Builder::build) - .collect(toImmutableList())); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder responseFormat(Optional> responseFormat); - - /** Clears the value of responseFormat field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearResponseFormat() { - return responseFormat(Optional.empty()); - } - /** * Setter for translationConfig. * diff --git a/src/main/java/com/google/genai/types/GoogleSearch.java b/src/main/java/com/google/genai/types/GoogleSearch.java index acbb0d8152a..d67242e4757 100644 --- a/src/main/java/com/google/genai/types/GoogleSearch.java +++ b/src/main/java/com/google/genai/types/GoogleSearch.java @@ -32,10 +32,6 @@ @AutoValue @JsonDeserialize(builder = GoogleSearch.Builder.class) public abstract class GoogleSearch extends JsonSerializable { - /** Optional. The set of search types to enable. If not set, web search is enabled by default. */ - @JsonProperty("searchTypes") - public abstract Optional searchTypes(); - /** * Optional. Sites with confidence level chosen & above this value will be blocked from the search * results. This field is not supported in Gemini API. @@ -50,6 +46,10 @@ public abstract class GoogleSearch extends JsonSerializable { @JsonProperty("excludeDomains") public abstract Optional> excludeDomains(); + /** Optional. The set of search types to enable. If not set, web search is enabled by default. */ + @JsonProperty("searchTypes") + public abstract Optional searchTypes(); + /** * Optional. Filter search results to a specific time range. If customers set a start time, they * must set an end time (and vice versa). This field is not supported in Vertex AI. @@ -75,36 +75,6 @@ private static Builder create() { return new AutoValue_GoogleSearch.Builder(); } - /** - * Setter for searchTypes. - * - *

searchTypes: Optional. The set of search types to enable. If not set, web search is - * enabled by default. - */ - @JsonProperty("searchTypes") - public abstract Builder searchTypes(SearchTypes searchTypes); - - /** - * Setter for searchTypes builder. - * - *

searchTypes: Optional. The set of search types to enable. If not set, web search is - * enabled by default. - */ - @CanIgnoreReturnValue - public Builder searchTypes(SearchTypes.Builder searchTypesBuilder) { - return searchTypes(searchTypesBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder searchTypes(Optional searchTypes); - - /** Clears the value of searchTypes field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearSearchTypes() { - return searchTypes(Optional.empty()); - } - /** * Setter for blockingConfidence. * @@ -178,6 +148,36 @@ public Builder clearExcludeDomains() { return excludeDomains(Optional.empty()); } + /** + * Setter for searchTypes. + * + *

searchTypes: Optional. The set of search types to enable. If not set, web search is + * enabled by default. + */ + @JsonProperty("searchTypes") + public abstract Builder searchTypes(SearchTypes searchTypes); + + /** + * Setter for searchTypes builder. + * + *

searchTypes: Optional. The set of search types to enable. If not set, web search is + * enabled by default. + */ + @CanIgnoreReturnValue + public Builder searchTypes(SearchTypes.Builder searchTypesBuilder) { + return searchTypes(searchTypesBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder searchTypes(Optional searchTypes); + + /** Clears the value of searchTypes field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSearchTypes() { + return searchTypes(Optional.empty()); + } + /** * Setter for timeRangeFilter. * diff --git a/src/main/java/com/google/genai/types/GroundingChunk.java b/src/main/java/com/google/genai/types/GroundingChunk.java index b4e332694b2..1a405f5b5bb 100644 --- a/src/main/java/com/google/genai/types/GroundingChunk.java +++ b/src/main/java/com/google/genai/types/GroundingChunk.java @@ -35,10 +35,6 @@ @AutoValue @JsonDeserialize(builder = GroundingChunk.Builder.class) public abstract class GroundingChunk extends JsonSerializable { - /** A grounding chunk from an image search result. See the `Image` message for details. */ - @JsonProperty("image") - public abstract Optional image(); - /** * A `Maps` chunk is a piece of evidence that comes from Google Maps. * @@ -48,6 +44,10 @@ public abstract class GroundingChunk extends JsonSerializable { @JsonProperty("maps") public abstract Optional maps(); + /** A grounding chunk from an image search result. See the `Image` message for details. */ + @JsonProperty("image") + public abstract Optional image(); + /** * A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. * See the `RetrievedContext` message for details @@ -80,34 +80,6 @@ private static Builder create() { return new AutoValue_GroundingChunk.Builder(); } - /** - * Setter for image. - * - *

image: A grounding chunk from an image search result. See the `Image` message for details. - */ - @JsonProperty("image") - public abstract Builder image(GroundingChunkImage image); - - /** - * Setter for image builder. - * - *

image: A grounding chunk from an image search result. See the `Image` message for details. - */ - @CanIgnoreReturnValue - public Builder image(GroundingChunkImage.Builder imageBuilder) { - return image(imageBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder image(Optional image); - - /** Clears the value of image field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearImage() { - return image(Optional.empty()); - } - /** * Setter for maps. * @@ -142,6 +114,34 @@ public Builder clearMaps() { return maps(Optional.empty()); } + /** + * Setter for image. + * + *

image: A grounding chunk from an image search result. See the `Image` message for details. + */ + @JsonProperty("image") + public abstract Builder image(GroundingChunkImage image); + + /** + * Setter for image builder. + * + *

image: A grounding chunk from an image search result. See the `Image` message for details. + */ + @CanIgnoreReturnValue + public Builder image(GroundingChunkImage.Builder imageBuilder) { + return image(imageBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder image(Optional image); + + /** Clears the value of image field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImage() { + return image(Optional.empty()); + } + /** * Setter for retrievedContext. * diff --git a/src/main/java/com/google/genai/types/GroundingChunkImage.java b/src/main/java/com/google/genai/types/GroundingChunkImage.java index 80513f67ab3..bf89bf01d2c 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkImage.java +++ b/src/main/java/com/google/genai/types/GroundingChunkImage.java @@ -34,22 +34,22 @@ @AutoValue @JsonDeserialize(builder = GroundingChunkImage.Builder.class) public abstract class GroundingChunkImage extends JsonSerializable { - /** The URI of the image search result page. */ - @JsonProperty("sourceUri") - public abstract Optional sourceUri(); + /** The domain of the image search result page. */ + @JsonProperty("domain") + public abstract Optional domain(); /** The URI of the image. */ @JsonProperty("imageUri") public abstract Optional imageUri(); + /** The URI of the image search result page. */ + @JsonProperty("sourceUri") + public abstract Optional sourceUri(); + /** The title of the image search result page. */ @JsonProperty("title") public abstract Optional title(); - /** The domain of the image search result page. */ - @JsonProperty("domain") - public abstract Optional domain(); - /** Instantiates a builder for GroundingChunkImage. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -69,21 +69,21 @@ private static Builder create() { } /** - * Setter for sourceUri. + * Setter for domain. * - *

sourceUri: The URI of the image search result page. + *

domain: The domain of the image search result page. */ - @JsonProperty("sourceUri") - public abstract Builder sourceUri(String sourceUri); + @JsonProperty("domain") + public abstract Builder domain(String domain); @ExcludeFromGeneratedCoverageReport - abstract Builder sourceUri(Optional sourceUri); + abstract Builder domain(Optional domain); - /** Clears the value of sourceUri field. */ + /** Clears the value of domain field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearSourceUri() { - return sourceUri(Optional.empty()); + public Builder clearDomain() { + return domain(Optional.empty()); } /** @@ -105,39 +105,39 @@ public Builder clearImageUri() { } /** - * Setter for title. + * Setter for sourceUri. * - *

title: The title of the image search result page. + *

sourceUri: The URI of the image search result page. */ - @JsonProperty("title") - public abstract Builder title(String title); + @JsonProperty("sourceUri") + public abstract Builder sourceUri(String sourceUri); @ExcludeFromGeneratedCoverageReport - abstract Builder title(Optional title); + abstract Builder sourceUri(Optional sourceUri); - /** Clears the value of title field. */ + /** Clears the value of sourceUri field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearTitle() { - return title(Optional.empty()); + public Builder clearSourceUri() { + return sourceUri(Optional.empty()); } /** - * Setter for domain. + * Setter for title. * - *

domain: The domain of the image search result page. + *

title: The title of the image search result page. */ - @JsonProperty("domain") - public abstract Builder domain(String domain); + @JsonProperty("title") + public abstract Builder title(String title); @ExcludeFromGeneratedCoverageReport - abstract Builder domain(Optional domain); + abstract Builder title(Optional title); - /** Clears the value of domain field. */ + /** Clears the value of title field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearDomain() { - return domain(Optional.empty()); + public Builder clearTitle() { + return title(Optional.empty()); } public abstract GroundingChunkImage build(); diff --git a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java index 53d5e1ded4c..d237c04d852 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java +++ b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java @@ -79,13 +79,6 @@ public abstract class GroundingChunkRetrievedContext extends JsonSerializable { @JsonProperty("fileSearchStore") public abstract Optional fileSearchStore(); - /** - * Optional. Page number of the retrieved context, if applicable. This field is not supported in - * Vertex AI. - */ - @JsonProperty("pageNumber") - public abstract Optional pageNumber(); - /** * 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 @@ -94,6 +87,13 @@ public abstract class GroundingChunkRetrievedContext extends JsonSerializable { @JsonProperty("mediaId") public abstract Optional mediaId(); + /** + * Optional. Page number of the retrieved context, if applicable. This field is not supported in + * Vertex AI. + */ + @JsonProperty("pageNumber") + public abstract Optional pageNumber(); + /** Instantiates a builder for GroundingChunkRetrievedContext. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -284,25 +284,6 @@ public Builder clearFileSearchStore() { return fileSearchStore(Optional.empty()); } - /** - * Setter for pageNumber. - * - *

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); - - @ExcludeFromGeneratedCoverageReport - abstract Builder pageNumber(Optional pageNumber); - - /** Clears the value of pageNumber field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearPageNumber() { - return pageNumber(Optional.empty()); - } - /** * Setter for mediaId. * @@ -323,6 +304,25 @@ public Builder clearMediaId() { return mediaId(Optional.empty()); } + /** + * Setter for pageNumber. + * + *

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); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageNumber(Optional pageNumber); + + /** Clears the value of pageNumber field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageNumber() { + return pageNumber(Optional.empty()); + } + public abstract GroundingChunkRetrievedContext build(); } diff --git a/src/main/java/com/google/genai/types/GroundingMetadata.java b/src/main/java/com/google/genai/types/GroundingMetadata.java index 5e9fe0d8b4a..a3afad4ba1e 100644 --- a/src/main/java/com/google/genai/types/GroundingMetadata.java +++ b/src/main/java/com/google/genai/types/GroundingMetadata.java @@ -34,14 +34,6 @@ @AutoValue @JsonDeserialize(builder = GroundingMetadata.Builder.class) public abstract class GroundingMetadata extends JsonSerializable { - /** - * Optional. The image search queries that were used to generate the content. This field is - * populated only when the grounding source is Google Search with the Image Search search_type - * enabled. - */ - @JsonProperty("imageSearchQueries") - public abstract Optional> imageSearchQueries(); - /** * A list of supporting references retrieved from the grounding source. This field is populated * when the grounding source is Google Search, Vertex AI Search, or Google Maps. @@ -74,6 +66,14 @@ public abstract class GroundingMetadata extends JsonSerializable { @JsonProperty("googleMapsWidgetContextToken") public abstract Optional googleMapsWidgetContextToken(); + /** + * Optional. The image search queries that were used to generate the content. This field is + * populated only when the grounding source is Google Search with the Image Search search_type + * enabled. + */ + @JsonProperty("imageSearchQueries") + public abstract Optional> imageSearchQueries(); + /** * Optional. The queries that were executed by the retrieval tools. This field is populated only * when the grounding source is a retrieval tool, such as Vertex AI Search. This field is not @@ -108,38 +108,6 @@ private static Builder create() { return new AutoValue_GroundingMetadata.Builder(); } - /** - * Setter for imageSearchQueries. - * - *

imageSearchQueries: Optional. The image search queries that were used to generate the - * content. This field is populated only when the grounding source is Google Search with the - * Image Search search_type enabled. - */ - @JsonProperty("imageSearchQueries") - public abstract Builder imageSearchQueries(List imageSearchQueries); - - /** - * Setter for imageSearchQueries. - * - *

imageSearchQueries: Optional. The image search queries that were used to generate the - * content. This field is populated only when the grounding source is Google Search with the - * Image Search search_type enabled. - */ - @CanIgnoreReturnValue - public Builder imageSearchQueries(String... imageSearchQueries) { - return imageSearchQueries(Arrays.asList(imageSearchQueries)); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder imageSearchQueries(Optional> imageSearchQueries); - - /** Clears the value of imageSearchQueries field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearImageSearchQueries() { - return imageSearchQueries(Optional.empty()); - } - /** * Setter for groundingChunks. * @@ -334,6 +302,38 @@ public Builder clearGoogleMapsWidgetContextToken() { return googleMapsWidgetContextToken(Optional.empty()); } + /** + * Setter for imageSearchQueries. + * + *

imageSearchQueries: Optional. The image search queries that were used to generate the + * content. This field is populated only when the grounding source is Google Search with the + * Image Search search_type enabled. + */ + @JsonProperty("imageSearchQueries") + public abstract Builder imageSearchQueries(List imageSearchQueries); + + /** + * Setter for imageSearchQueries. + * + *

imageSearchQueries: Optional. The image search queries that were used to generate the + * content. This field is populated only when the grounding source is Google Search with the + * Image Search search_type enabled. + */ + @CanIgnoreReturnValue + public Builder imageSearchQueries(String... imageSearchQueries) { + return imageSearchQueries(Arrays.asList(imageSearchQueries)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder imageSearchQueries(Optional> imageSearchQueries); + + /** Clears the value of imageSearchQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImageSearchQueries() { + return imageSearchQueries(Optional.empty()); + } + /** * Setter for retrievalQueries. * diff --git a/src/main/java/com/google/genai/types/ImageConfig.java b/src/main/java/com/google/genai/types/ImageConfig.java index f2a9ae725bf..523ac550cce 100644 --- a/src/main/java/com/google/genai/types/ImageConfig.java +++ b/src/main/java/com/google/genai/types/ImageConfig.java @@ -50,15 +50,6 @@ public abstract class ImageConfig extends JsonSerializable { @JsonProperty("personGeneration") public abstract Optional personGeneration(); - /** - * Optional. Controls whether prominent people (celebrities) generation is allowed. If used with - * personGeneration, personGeneration enum would take precedence. For instance, if ALLOW_NONE is - * set, all person generation would be blocked. If this field is unspecified, the default behavior - * is to allow prominent people. This field is not supported in Gemini API. - */ - @JsonProperty("prominentPeople") - public abstract Optional prominentPeople(); - /** MIME type of the generated image. This field is not supported in Gemini API. */ @JsonProperty("outputMimeType") public abstract Optional outputMimeType(); @@ -77,6 +68,15 @@ public abstract class ImageConfig extends JsonSerializable { @JsonProperty("imageOutputOptions") public abstract Optional imageOutputOptions(); + /** + * Optional. Controls whether prominent people (celebrities) generation is allowed. If used with + * personGeneration, personGeneration enum would take precedence. For instance, if ALLOW_NONE is + * set, all person generation would be blocked. If this field is unspecified, the default behavior + * is to allow prominent people. This field is not supported in Gemini API. + */ + @JsonProperty("prominentPeople") + public abstract Optional prominentPeople(); + /** Instantiates a builder for ImageConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -152,56 +152,6 @@ public Builder clearPersonGeneration() { return personGeneration(Optional.empty()); } - /** - * Setter for prominentPeople. - * - *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is - * allowed. If used with personGeneration, personGeneration enum would take precedence. For - * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is - * unspecified, the default behavior is to allow prominent people. This field is not supported - * in Gemini API. - */ - @JsonProperty("prominentPeople") - public abstract Builder prominentPeople(ProminentPeople prominentPeople); - - @ExcludeFromGeneratedCoverageReport - abstract Builder prominentPeople(Optional prominentPeople); - - /** Clears the value of prominentPeople field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearProminentPeople() { - return prominentPeople(Optional.empty()); - } - - /** - * Setter for prominentPeople given a known enum. - * - *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is - * allowed. If used with personGeneration, personGeneration enum would take precedence. For - * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is - * unspecified, the default behavior is to allow prominent people. This field is not supported - * in Gemini API. - */ - @CanIgnoreReturnValue - public Builder prominentPeople(ProminentPeople.Known knownType) { - return prominentPeople(new ProminentPeople(knownType)); - } - - /** - * Setter for prominentPeople given a string. - * - *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is - * allowed. If used with personGeneration, personGeneration enum would take precedence. For - * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is - * unspecified, the default behavior is to allow prominent people. This field is not supported - * in Gemini API. - */ - @CanIgnoreReturnValue - public Builder prominentPeople(String prominentPeople) { - return prominentPeople(new ProminentPeople(prominentPeople)); - } - /** * Setter for outputMimeType. * @@ -271,6 +221,56 @@ public Builder clearImageOutputOptions() { return imageOutputOptions(Optional.empty()); } + /** + * Setter for prominentPeople. + * + *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is + * allowed. If used with personGeneration, personGeneration enum would take precedence. For + * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is + * unspecified, the default behavior is to allow prominent people. This field is not supported + * in Gemini API. + */ + @JsonProperty("prominentPeople") + public abstract Builder prominentPeople(ProminentPeople prominentPeople); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prominentPeople(Optional prominentPeople); + + /** Clears the value of prominentPeople field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearProminentPeople() { + return prominentPeople(Optional.empty()); + } + + /** + * Setter for prominentPeople given a known enum. + * + *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is + * allowed. If used with personGeneration, personGeneration enum would take precedence. For + * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is + * unspecified, the default behavior is to allow prominent people. This field is not supported + * in Gemini API. + */ + @CanIgnoreReturnValue + public Builder prominentPeople(ProminentPeople.Known knownType) { + return prominentPeople(new ProminentPeople(knownType)); + } + + /** + * Setter for prominentPeople given a string. + * + *

prominentPeople: Optional. Controls whether prominent people (celebrities) generation is + * allowed. If used with personGeneration, personGeneration enum would take precedence. For + * instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is + * unspecified, the default behavior is to allow prominent people. This field is not supported + * in Gemini API. + */ + @CanIgnoreReturnValue + public Builder prominentPeople(String prominentPeople) { + return prominentPeople(new ProminentPeople(prominentPeople)); + } + public abstract ImageConfig build(); } diff --git a/src/main/java/com/google/genai/types/LiveClientSetup.java b/src/main/java/com/google/genai/types/LiveClientSetup.java index 49ca51e6cb4..aaeb2eadc63 100644 --- a/src/main/java/com/google/genai/types/LiveClientSetup.java +++ b/src/main/java/com/google/genai/types/LiveClientSetup.java @@ -95,6 +95,10 @@ public abstract class LiveClientSetup extends JsonSerializable { @JsonProperty("proactivity") public abstract Optional proactivity(); + /** Configures the exchange of history between the client and the server. */ + @JsonProperty("historyConfig") + public abstract Optional historyConfig(); + /** * Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the * start and end of speech. This allows the server to process the audio more efficiently. @@ -110,10 +114,6 @@ public abstract class LiveClientSetup extends JsonSerializable { @JsonProperty("safetySettings") public abstract Optional> safetySettings(); - /** Configures the exchange of history between the client and the server. */ - @JsonProperty("historyConfig") - public abstract Optional historyConfig(); - /** Instantiates a builder for LiveClientSetup. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -451,6 +451,34 @@ public Builder clearProactivity() { return proactivity(Optional.empty()); } + /** + * Setter for historyConfig. + * + *

historyConfig: Configures the exchange of history between the client and the server. + */ + @JsonProperty("historyConfig") + public abstract Builder historyConfig(HistoryConfig historyConfig); + + /** + * Setter for historyConfig builder. + * + *

historyConfig: Configures the exchange of history between the client and the server. + */ + @CanIgnoreReturnValue + public Builder historyConfig(HistoryConfig.Builder historyConfigBuilder) { + return historyConfig(historyConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder historyConfig(Optional historyConfig); + + /** Clears the value of historyConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHistoryConfig() { + return historyConfig(Optional.empty()); + } + /** * Setter for explicitVadSignal. * @@ -540,34 +568,6 @@ public Builder clearSafetySettings() { return safetySettings(Optional.empty()); } - /** - * Setter for historyConfig. - * - *

historyConfig: Configures the exchange of history between the client and the server. - */ - @JsonProperty("historyConfig") - public abstract Builder historyConfig(HistoryConfig historyConfig); - - /** - * Setter for historyConfig builder. - * - *

historyConfig: Configures the exchange of history between the client and the server. - */ - @CanIgnoreReturnValue - public Builder historyConfig(HistoryConfig.Builder historyConfigBuilder) { - return historyConfig(historyConfigBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder historyConfig(Optional historyConfig); - - /** Clears the value of historyConfig field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearHistoryConfig() { - return historyConfig(Optional.empty()); - } - public abstract LiveClientSetup build(); } diff --git a/src/main/java/com/google/genai/types/LiveServerContent.java b/src/main/java/com/google/genai/types/LiveServerContent.java index 02b4913cd3d..3f28599a912 100644 --- a/src/main/java/com/google/genai/types/LiveServerContent.java +++ b/src/main/java/com/google/genai/types/LiveServerContent.java @@ -77,6 +77,10 @@ public abstract class LiveServerContent extends JsonSerializable { @JsonProperty("inputTranscription") public abstract Optional inputTranscription(); + /** Low latency transcription updated while the user is speaking. */ + @JsonProperty("interimInputTranscription") + public abstract Optional interimInputTranscription(); + /** * Output transcription. The transcription is independent to the model turn which means it doesn’t * imply any ordering between transcription and model turn. @@ -99,10 +103,6 @@ public abstract class LiveServerContent extends JsonSerializable { @JsonProperty("waitingForInput") public abstract Optional waitingForInput(); - /** Low latency transcription updated while the user is speaking. */ - @JsonProperty("interimInputTranscription") - public abstract Optional interimInputTranscription(); - /** Instantiates a builder for LiveServerContent. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -272,6 +272,35 @@ public Builder clearInputTranscription() { return inputTranscription(Optional.empty()); } + /** + * Setter for interimInputTranscription. + * + *

interimInputTranscription: Low latency transcription updated while the user is speaking. + */ + @JsonProperty("interimInputTranscription") + public abstract Builder interimInputTranscription(Transcription interimInputTranscription); + + /** + * Setter for interimInputTranscription builder. + * + *

interimInputTranscription: Low latency transcription updated while the user is speaking. + */ + @CanIgnoreReturnValue + public Builder interimInputTranscription( + Transcription.Builder interimInputTranscriptionBuilder) { + return interimInputTranscription(interimInputTranscriptionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder interimInputTranscription(Optional interimInputTranscription); + + /** Clears the value of interimInputTranscription field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInterimInputTranscription() { + return interimInputTranscription(Optional.empty()); + } + /** * Setter for outputTranscription. * @@ -387,35 +416,6 @@ public Builder clearWaitingForInput() { return waitingForInput(Optional.empty()); } - /** - * Setter for interimInputTranscription. - * - *

interimInputTranscription: Low latency transcription updated while the user is speaking. - */ - @JsonProperty("interimInputTranscription") - public abstract Builder interimInputTranscription(Transcription interimInputTranscription); - - /** - * Setter for interimInputTranscription builder. - * - *

interimInputTranscription: Low latency transcription updated while the user is speaking. - */ - @CanIgnoreReturnValue - public Builder interimInputTranscription( - Transcription.Builder interimInputTranscriptionBuilder) { - return interimInputTranscription(interimInputTranscriptionBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder interimInputTranscription(Optional interimInputTranscription); - - /** Clears the value of interimInputTranscription field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearInterimInputTranscription() { - return interimInputTranscription(Optional.empty()); - } - public abstract LiveServerContent build(); } diff --git a/src/main/java/com/google/genai/types/Part.java b/src/main/java/com/google/genai/types/Part.java index f8f75c3c17a..464e675e56d 100644 --- a/src/main/java/com/google/genai/types/Part.java +++ b/src/main/java/com/google/genai/types/Part.java @@ -40,6 +40,24 @@ public abstract class Part extends JsonSerializable { @JsonProperty("mediaResolution") public abstract Optional mediaResolution(); + /** + * Server-side tool call. This field is populated when the model predicts a tool invocation that + * should be executed on the server. The client is expected to echo this message back to the API. + */ + @JsonProperty("toolCall") + public abstract Optional toolCall(); + + /** + * The output from a server-side ToolCall execution. This field is populated by the client with + * the results of executing the corresponding ToolCall. + */ + @JsonProperty("toolResponse") + public abstract Optional toolResponse(); + + /** Output only. The transcription of the audio part. */ + @JsonProperty("audioTranscription") + public abstract Optional audioTranscription(); + /** Optional. The result of executing the ExecutableCode. */ @JsonProperty("codeExecutionResult") public abstract Optional codeExecutionResult(); @@ -99,20 +117,6 @@ public abstract class Part extends JsonSerializable { @JsonProperty("videoMetadata") public abstract Optional videoMetadata(); - /** - * Server-side tool call. This field is populated when the model predicts a tool invocation that - * should be executed on the server. The client is expected to echo this message back to the API. - */ - @JsonProperty("toolCall") - public abstract Optional toolCall(); - - /** - * The output from a server-side ToolCall execution. This field is populated by the client with - * the results of executing the corresponding ToolCall. - */ - @JsonProperty("toolResponse") - public abstract Optional toolResponse(); - /** * Custom metadata associated with the Part. Agents using genai.Part as content representation may * need to keep track of the additional information. For example it can be name of a file/source @@ -168,6 +172,96 @@ public Builder clearMediaResolution() { return mediaResolution(Optional.empty()); } + /** + * Setter for toolCall. + * + *

toolCall: Server-side tool call. This field is populated when the model predicts a tool + * invocation that should be executed on the server. The client is expected to echo this message + * back to the API. + */ + @JsonProperty("toolCall") + public abstract Builder toolCall(ToolCall toolCall); + + /** + * Setter for toolCall builder. + * + *

toolCall: Server-side tool call. This field is populated when the model predicts a tool + * invocation that should be executed on the server. The client is expected to echo this message + * back to the API. + */ + @CanIgnoreReturnValue + public Builder toolCall(ToolCall.Builder toolCallBuilder) { + return toolCall(toolCallBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolCall(Optional toolCall); + + /** Clears the value of toolCall field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolCall() { + return toolCall(Optional.empty()); + } + + /** + * Setter for toolResponse. + * + *

toolResponse: The output from a server-side ToolCall execution. This field is populated by + * the client with the results of executing the corresponding ToolCall. + */ + @JsonProperty("toolResponse") + public abstract Builder toolResponse(ToolResponse toolResponse); + + /** + * Setter for toolResponse builder. + * + *

toolResponse: The output from a server-side ToolCall execution. This field is populated by + * the client with the results of executing the corresponding ToolCall. + */ + @CanIgnoreReturnValue + public Builder toolResponse(ToolResponse.Builder toolResponseBuilder) { + return toolResponse(toolResponseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolResponse(Optional toolResponse); + + /** Clears the value of toolResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolResponse() { + return toolResponse(Optional.empty()); + } + + /** + * Setter for audioTranscription. + * + *

audioTranscription: Output only. The transcription of the audio part. + */ + @JsonProperty("audioTranscription") + public abstract Builder audioTranscription(Transcription audioTranscription); + + /** + * Setter for audioTranscription builder. + * + *

audioTranscription: Output only. The transcription of the audio part. + */ + @CanIgnoreReturnValue + public Builder audioTranscription(Transcription.Builder audioTranscriptionBuilder) { + return audioTranscription(audioTranscriptionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder audioTranscription(Optional audioTranscription); + + /** Clears the value of audioTranscription field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAudioTranscription() { + return audioTranscription(Optional.empty()); + } + /** * Setter for codeExecutionResult. * @@ -432,68 +526,6 @@ public Builder clearVideoMetadata() { return videoMetadata(Optional.empty()); } - /** - * Setter for toolCall. - * - *

toolCall: Server-side tool call. This field is populated when the model predicts a tool - * invocation that should be executed on the server. The client is expected to echo this message - * back to the API. - */ - @JsonProperty("toolCall") - public abstract Builder toolCall(ToolCall toolCall); - - /** - * Setter for toolCall builder. - * - *

toolCall: Server-side tool call. This field is populated when the model predicts a tool - * invocation that should be executed on the server. The client is expected to echo this message - * back to the API. - */ - @CanIgnoreReturnValue - public Builder toolCall(ToolCall.Builder toolCallBuilder) { - return toolCall(toolCallBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder toolCall(Optional toolCall); - - /** Clears the value of toolCall field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearToolCall() { - return toolCall(Optional.empty()); - } - - /** - * Setter for toolResponse. - * - *

toolResponse: The output from a server-side ToolCall execution. This field is populated by - * the client with the results of executing the corresponding ToolCall. - */ - @JsonProperty("toolResponse") - public abstract Builder toolResponse(ToolResponse toolResponse); - - /** - * Setter for toolResponse builder. - * - *

toolResponse: The output from a server-side ToolCall execution. This field is populated by - * the client with the results of executing the corresponding ToolCall. - */ - @CanIgnoreReturnValue - public Builder toolResponse(ToolResponse.Builder toolResponseBuilder) { - return toolResponse(toolResponseBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder toolResponse(Optional toolResponse); - - /** Clears the value of toolResponse field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearToolResponse() { - return toolResponse(Optional.empty()); - } - /** * Setter for partMetadata. * diff --git a/src/main/java/com/google/genai/types/RagChunk.java b/src/main/java/com/google/genai/types/RagChunk.java index fed311d1910..b53173d8cf0 100644 --- a/src/main/java/com/google/genai/types/RagChunk.java +++ b/src/main/java/com/google/genai/types/RagChunk.java @@ -33,14 +33,6 @@ @AutoValue @JsonDeserialize(builder = RagChunk.Builder.class) public abstract class RagChunk extends JsonSerializable { - /** If populated, represents where the chunk starts and ends in the document. */ - @JsonProperty("pageSpan") - public abstract Optional pageSpan(); - - /** The content of the chunk. */ - @JsonProperty("text") - public abstract Optional text(); - /** The ID of the chunk. */ @JsonProperty("chunkId") public abstract Optional chunkId(); @@ -49,6 +41,14 @@ public abstract class RagChunk extends JsonSerializable { @JsonProperty("fileId") public abstract Optional fileId(); + /** If populated, represents where the chunk starts and ends in the document. */ + @JsonProperty("pageSpan") + public abstract Optional pageSpan(); + + /** The content of the chunk. */ + @JsonProperty("text") + public abstract Optional text(); + /** Instantiates a builder for RagChunk. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -67,6 +67,42 @@ private static Builder create() { return new AutoValue_RagChunk.Builder(); } + /** + * 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()); + } + /** * Setter for pageSpan. * @@ -113,42 +149,6 @@ 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/ReinforcementTuningAutoraterScorer.java b/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorer.java index d125808ab4a..f678c001fc3 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorer.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorer.java @@ -50,6 +50,10 @@ public abstract class ReinforcementTuningAutoraterScorer extends JsonSerializabl @JsonProperty("autoraterResponseParseConfig") public abstract Optional autoraterResponseParseConfig(); + /** Scores autorater responses by using string match reward scorer. */ + @JsonProperty("exactMatchScorer") + public abstract Optional exactMatchScorer(); + /** * Scores autorater responses by directly converting parsed autorater response to a float reward. * Note: Reward is clipped to be within `[-1, 1]`, i.e., `reward = max(min(reward, 1.0), -1.0)`. @@ -58,10 +62,6 @@ public abstract class ReinforcementTuningAutoraterScorer extends JsonSerializabl public abstract Optional parsedResponseConversionScorer(); - /** Scores autorater responses by using string match reward scorer. */ - @JsonProperty("exactMatchScorer") - public abstract Optional exactMatchScorer(); - /** Instantiates a builder for ReinforcementTuningAutoraterScorer. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -166,6 +166,37 @@ public Builder clearAutoraterResponseParseConfig() { return autoraterResponseParseConfig(Optional.empty()); } + /** + * Setter for exactMatchScorer. + * + *

exactMatchScorer: Scores autorater responses by using string match reward scorer. + */ + @JsonProperty("exactMatchScorer") + public abstract Builder exactMatchScorer( + ReinforcementTuningAutoraterScorerExactMatchScorer exactMatchScorer); + + /** + * Setter for exactMatchScorer builder. + * + *

exactMatchScorer: Scores autorater responses by using string match reward scorer. + */ + @CanIgnoreReturnValue + public Builder exactMatchScorer( + ReinforcementTuningAutoraterScorerExactMatchScorer.Builder exactMatchScorerBuilder) { + return exactMatchScorer(exactMatchScorerBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exactMatchScorer( + Optional exactMatchScorer); + + /** Clears the value of exactMatchScorer field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExactMatchScorer() { + return exactMatchScorer(Optional.empty()); + } + /** * Setter for parsedResponseConversionScorer. * @@ -204,37 +235,6 @@ public Builder clearParsedResponseConversionScorer() { return parsedResponseConversionScorer(Optional.empty()); } - /** - * Setter for exactMatchScorer. - * - *

exactMatchScorer: Scores autorater responses by using string match reward scorer. - */ - @JsonProperty("exactMatchScorer") - public abstract Builder exactMatchScorer( - ReinforcementTuningAutoraterScorerExactMatchScorer exactMatchScorer); - - /** - * Setter for exactMatchScorer builder. - * - *

exactMatchScorer: Scores autorater responses by using string match reward scorer. - */ - @CanIgnoreReturnValue - public Builder exactMatchScorer( - ReinforcementTuningAutoraterScorerExactMatchScorer.Builder exactMatchScorerBuilder) { - return exactMatchScorer(exactMatchScorerBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder exactMatchScorer( - Optional exactMatchScorer); - - /** Clears the value of exactMatchScorer field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearExactMatchScorer() { - return exactMatchScorer(Optional.empty()); - } - public abstract ReinforcementTuningAutoraterScorer build(); } diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorerExactMatchScorer.java b/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorerExactMatchScorer.java index 1e5042989fb..2af5175fb2f 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorerExactMatchScorer.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningAutoraterScorerExactMatchScorer.java @@ -37,10 +37,6 @@ public abstract class ReinforcementTuningAutoraterScorerExactMatchScorer extends @JsonProperty("correctAnswerReward") public abstract Optional correctAnswerReward(); - /** Assigns this reward score if the parsed reward value does not equal the expression. */ - @JsonProperty("wrongAnswerReward") - public abstract Optional wrongAnswerReward(); - /** * The string expression to match against for scoring. This field supports placeholders in the * format of {{references.key}} that will be replaced before matching. Regex is not supported for @@ -57,6 +53,10 @@ public abstract class ReinforcementTuningAutoraterScorerExactMatchScorer extends @JsonProperty("expression") public abstract Optional expression(); + /** Assigns this reward score if the parsed reward value does not equal the expression. */ + @JsonProperty("wrongAnswerReward") + public abstract Optional wrongAnswerReward(); + /** Instantiates a builder for ReinforcementTuningAutoraterScorerExactMatchScorer. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -97,25 +97,6 @@ public Builder clearCorrectAnswerReward() { return correctAnswerReward(Optional.empty()); } - /** - * Setter for wrongAnswerReward. - * - *

wrongAnswerReward: Assigns this reward score if the parsed reward value does not equal the - * expression. - */ - @JsonProperty("wrongAnswerReward") - public abstract Builder wrongAnswerReward(Float wrongAnswerReward); - - @ExcludeFromGeneratedCoverageReport - abstract Builder wrongAnswerReward(Optional wrongAnswerReward); - - /** Clears the value of wrongAnswerReward field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearWrongAnswerReward() { - return wrongAnswerReward(Optional.empty()); - } - /** * Setter for expression. * @@ -144,6 +125,25 @@ public Builder clearExpression() { return expression(Optional.empty()); } + /** + * Setter for wrongAnswerReward. + * + *

wrongAnswerReward: Assigns this reward score if the parsed reward value does not equal the + * expression. + */ + @JsonProperty("wrongAnswerReward") + public abstract Builder wrongAnswerReward(Float wrongAnswerReward); + + @ExcludeFromGeneratedCoverageReport + abstract Builder wrongAnswerReward(Optional wrongAnswerReward); + + /** Clears the value of wrongAnswerReward field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWrongAnswerReward() { + return wrongAnswerReward(Optional.empty()); + } + public abstract ReinforcementTuningAutoraterScorerExactMatchScorer build(); } diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java b/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java index e94f49c6cc9..e4f2d82f336 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java @@ -32,10 +32,6 @@ @InternalApi @JsonDeserialize(builder = ReinforcementTuningHyperParameters.Builder.class) public abstract class ReinforcementTuningHyperParameters extends JsonSerializable { - /** Optional. Number of training epoches for the tuning job. */ - @JsonProperty("epochCount") - public abstract Optional epochCount(); - /** Learning rate multiplier for Reinforcement Learning. */ @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); @@ -44,10 +40,6 @@ public abstract class ReinforcementTuningHyperParameters extends JsonSerializabl @JsonProperty("adapterSize") public abstract Optional adapterSize(); - /** Optional. Number of different responses to generate per prompt during tuning. */ - @JsonProperty("samplesPerPrompt") - public abstract Optional samplesPerPrompt(); - /** * Optional. Batch size for the tuning job. How many prompts to process at a train step. If not * set, the batch size will be determined automatically. @@ -55,13 +47,6 @@ public abstract class ReinforcementTuningHyperParameters extends JsonSerializabl @JsonProperty("batchSize") public abstract Optional batchSize(); - /** - * Optional. How often at steps to evaluate the tuning job during training. If not set, evel will - * be run per epoch. `total_steps = epoch_count * samples_per_prompt / total_prompts_in_dataset` - */ - @JsonProperty("evaluateInterval") - public abstract Optional evaluateInterval(); - /** * Optional. How often at steps to save checkpoints during training. If not set, one checkpoint * per epoch will be set. ```total_steps = epoch_count * samples_per_prompt / @@ -70,17 +55,24 @@ public abstract class ReinforcementTuningHyperParameters extends JsonSerializabl @JsonProperty("checkpointInterval") public abstract Optional checkpointInterval(); + /** Optional. Number of training epoches for the tuning job. */ + @JsonProperty("epochCount") + public abstract Optional epochCount(); + + /** + * Optional. How often at steps to evaluate the tuning job during training. If not set, evel will + * be run per epoch. `total_steps = epoch_count * samples_per_prompt / total_prompts_in_dataset` + */ + @JsonProperty("evaluateInterval") + public abstract Optional evaluateInterval(); + /** Optional. The maximum number of tokens to generate per prompt. Default to 32768. */ @JsonProperty("maxOutputTokens") public abstract Optional maxOutputTokens(); - /** - * Indicates the maximum thinking depth during tuning. Starting from Gemini 3.5 models, the old - * thinking_budget will no longer be supported and will result in a user error if set. Instead, - * users should use the thinking_level parameter to control the maximum thinking depth. - */ - @JsonProperty("thinkingLevel") - public abstract Optional thinkingLevel(); + /** Optional. Number of different responses to generate per prompt during tuning. */ + @JsonProperty("samplesPerPrompt") + public abstract Optional samplesPerPrompt(); /** * Optional. The thinking budget for the tuning job to optimize for (Gemini 2.5 only). * -1 means @@ -90,6 +82,14 @@ public abstract class ReinforcementTuningHyperParameters extends JsonSerializabl @JsonProperty("thinkingBudget") public abstract Optional thinkingBudget(); + /** + * Indicates the maximum thinking depth during tuning. Starting from Gemini 3.5 models, the old + * thinking_budget will no longer be supported and will result in a user error if set. Instead, + * users should use the thinking_level parameter to control the maximum thinking depth. + */ + @JsonProperty("thinkingLevel") + public abstract Optional thinkingLevel(); + /** Instantiates a builder for ReinforcementTuningHyperParameters. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -111,24 +111,6 @@ private static Builder create() { return new AutoValue_ReinforcementTuningHyperParameters.Builder(); } - /** - * Setter for epochCount. - * - *

epochCount: Optional. Number of training epoches for the tuning job. - */ - @JsonProperty("epochCount") - public abstract Builder epochCount(Long epochCount); - - @ExcludeFromGeneratedCoverageReport - abstract Builder epochCount(Optional epochCount); - - /** Clears the value of epochCount field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearEpochCount() { - return epochCount(Optional.empty()); - } - /** * Setter for learningRateMultiplier. * @@ -186,41 +168,60 @@ public Builder adapterSize(String adapterSize) { } /** - * Setter for samplesPerPrompt. + * Setter for batchSize. * - *

samplesPerPrompt: Optional. Number of different responses to generate per prompt during - * tuning. + *

batchSize: Optional. Batch size for the tuning job. How many prompts to process at a train + * step. If not set, the batch size will be determined automatically. */ - @JsonProperty("samplesPerPrompt") - public abstract Builder samplesPerPrompt(Integer samplesPerPrompt); + @JsonProperty("batchSize") + public abstract Builder batchSize(Integer batchSize); @ExcludeFromGeneratedCoverageReport - abstract Builder samplesPerPrompt(Optional samplesPerPrompt); + abstract Builder batchSize(Optional batchSize); - /** Clears the value of samplesPerPrompt field. */ + /** Clears the value of batchSize field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearSamplesPerPrompt() { - return samplesPerPrompt(Optional.empty()); + public Builder clearBatchSize() { + return batchSize(Optional.empty()); } /** - * Setter for batchSize. + * Setter for checkpointInterval. * - *

batchSize: Optional. Batch size for the tuning job. How many prompts to process at a train - * step. If not set, the batch size will be determined automatically. + *

checkpointInterval: Optional. How often at steps to save checkpoints during training. If + * not set, one checkpoint per epoch will be set. ```total_steps = epoch_count * + * samples_per_prompt / total_prompts_in_dataset``` */ - @JsonProperty("batchSize") - public abstract Builder batchSize(Integer batchSize); + @JsonProperty("checkpointInterval") + public abstract Builder checkpointInterval(Integer checkpointInterval); @ExcludeFromGeneratedCoverageReport - abstract Builder batchSize(Optional batchSize); + abstract Builder checkpointInterval(Optional checkpointInterval); - /** Clears the value of batchSize field. */ + /** Clears the value of checkpointInterval field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearBatchSize() { - return batchSize(Optional.empty()); + public Builder clearCheckpointInterval() { + return checkpointInterval(Optional.empty()); + } + + /** + * Setter for epochCount. + * + *

epochCount: Optional. Number of training epoches for the tuning job. + */ + @JsonProperty("epochCount") + public abstract Builder epochCount(Long epochCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder epochCount(Optional epochCount); + + /** Clears the value of epochCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEpochCount() { + return epochCount(Optional.empty()); } /** @@ -244,42 +245,61 @@ public Builder clearEvaluateInterval() { } /** - * Setter for checkpointInterval. + * Setter for maxOutputTokens. * - *

checkpointInterval: Optional. How often at steps to save checkpoints during training. If - * not set, one checkpoint per epoch will be set. ```total_steps = epoch_count * - * samples_per_prompt / total_prompts_in_dataset``` + *

maxOutputTokens: Optional. The maximum number of tokens to generate per prompt. Default to + * 32768. */ - @JsonProperty("checkpointInterval") - public abstract Builder checkpointInterval(Integer checkpointInterval); + @JsonProperty("maxOutputTokens") + public abstract Builder maxOutputTokens(Integer maxOutputTokens); @ExcludeFromGeneratedCoverageReport - abstract Builder checkpointInterval(Optional checkpointInterval); + abstract Builder maxOutputTokens(Optional maxOutputTokens); - /** Clears the value of checkpointInterval field. */ + /** Clears the value of maxOutputTokens field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCheckpointInterval() { - return checkpointInterval(Optional.empty()); + public Builder clearMaxOutputTokens() { + return maxOutputTokens(Optional.empty()); } /** - * Setter for maxOutputTokens. + * Setter for samplesPerPrompt. * - *

maxOutputTokens: Optional. The maximum number of tokens to generate per prompt. Default to - * 32768. + *

samplesPerPrompt: Optional. Number of different responses to generate per prompt during + * tuning. */ - @JsonProperty("maxOutputTokens") - public abstract Builder maxOutputTokens(Integer maxOutputTokens); + @JsonProperty("samplesPerPrompt") + public abstract Builder samplesPerPrompt(Integer samplesPerPrompt); @ExcludeFromGeneratedCoverageReport - abstract Builder maxOutputTokens(Optional maxOutputTokens); + abstract Builder samplesPerPrompt(Optional samplesPerPrompt); - /** Clears the value of maxOutputTokens field. */ + /** Clears the value of samplesPerPrompt field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearMaxOutputTokens() { - return maxOutputTokens(Optional.empty()); + public Builder clearSamplesPerPrompt() { + return samplesPerPrompt(Optional.empty()); + } + + /** + * Setter for thinkingBudget. + * + *

thinkingBudget: Optional. The thinking budget for the tuning job to optimize for (Gemini + * 2.5 only). * -1 means dynamic thinking * 0 means no thinking * > 0 means thinking budget + * in tokens If not set, default to -1 (dynamic thinking). + */ + @JsonProperty("thinkingBudget") + public abstract Builder thinkingBudget(Integer thinkingBudget); + + @ExcludeFromGeneratedCoverageReport + abstract Builder thinkingBudget(Optional thinkingBudget); + + /** Clears the value of thinkingBudget field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearThinkingBudget() { + return thinkingBudget(Optional.empty()); } /** @@ -329,26 +349,6 @@ public Builder thinkingLevel(String thinkingLevel) { return thinkingLevel(new ReinforcementTuningThinkingLevel(thinkingLevel)); } - /** - * Setter for thinkingBudget. - * - *

thinkingBudget: Optional. The thinking budget for the tuning job to optimize for (Gemini - * 2.5 only). * -1 means dynamic thinking * 0 means no thinking * > 0 means thinking budget - * in tokens If not set, default to -1 (dynamic thinking). - */ - @JsonProperty("thinkingBudget") - public abstract Builder thinkingBudget(Integer thinkingBudget); - - @ExcludeFromGeneratedCoverageReport - abstract Builder thinkingBudget(Optional thinkingBudget); - - /** Clears the value of thinkingBudget field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearThinkingBudget() { - return thinkingBudget(Optional.empty()); - } - public abstract ReinforcementTuningHyperParameters build(); } diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningSpec.java b/src/main/java/com/google/genai/types/ReinforcementTuningSpec.java index bcbf1aea461..e1b64958fbf 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningSpec.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningSpec.java @@ -34,6 +34,14 @@ public abstract class ReinforcementTuningSpec extends JsonSerializable { @JsonProperty("compositeRewardConfig") public abstract Optional compositeRewardConfig(); + /** Single reward function configuration for reinforcement tuning. */ + @JsonProperty("singleRewardConfig") + public abstract Optional singleRewardConfig(); + + /** Additional hyper-parameters to use during tuning. */ + @JsonProperty("hyperParameters") + public abstract Optional hyperParameters(); + /** * Cloud Storage path to the file containing training dataset for tuning. The dataset must be * formatted as a JSONL file. @@ -48,14 +56,6 @@ public abstract class ReinforcementTuningSpec extends JsonSerializable { @JsonProperty("validationDatasetUri") public abstract Optional validationDatasetUri(); - /** Additional hyper-parameters to use during tuning. */ - @JsonProperty("hyperParameters") - public abstract Optional hyperParameters(); - - /** Single reward function configuration for reinforcement tuning. */ - @JsonProperty("singleRewardConfig") - public abstract Optional singleRewardConfig(); - /** Instantiates a builder for ReinforcementTuningSpec. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -106,41 +106,34 @@ public Builder clearCompositeRewardConfig() { } /** - * Setter for trainingDatasetUri. + * Setter for singleRewardConfig. * - *

trainingDatasetUri: Cloud Storage path to the file containing training dataset for tuning. - * The dataset must be formatted as a JSONL file. + *

singleRewardConfig: Single reward function configuration for reinforcement tuning. */ - @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()); - } + @JsonProperty("singleRewardConfig") + public abstract Builder singleRewardConfig( + SingleReinforcementTuningRewardConfig singleRewardConfig); /** - * Setter for validationDatasetUri. + * Setter for singleRewardConfig builder. * - *

validationDatasetUri: Cloud Storage path to the file containing validation dataset for - * tuning. The dataset must be formatted as a JSONL file. + *

singleRewardConfig: Single reward function configuration for reinforcement tuning. */ - @JsonProperty("validationDatasetUri") - public abstract Builder validationDatasetUri(String validationDatasetUri); + @CanIgnoreReturnValue + public Builder singleRewardConfig( + SingleReinforcementTuningRewardConfig.Builder singleRewardConfigBuilder) { + return singleRewardConfig(singleRewardConfigBuilder.build()); + } @ExcludeFromGeneratedCoverageReport - abstract Builder validationDatasetUri(Optional validationDatasetUri); + abstract Builder singleRewardConfig( + Optional singleRewardConfig); - /** Clears the value of validationDatasetUri field. */ + /** Clears the value of singleRewardConfig field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearValidationDatasetUri() { - return validationDatasetUri(Optional.empty()); + public Builder clearSingleRewardConfig() { + return singleRewardConfig(Optional.empty()); } /** @@ -173,34 +166,41 @@ public Builder clearHyperParameters() { } /** - * Setter for singleRewardConfig. + * Setter for trainingDatasetUri. * - *

singleRewardConfig: Single reward function configuration for reinforcement tuning. + *

trainingDatasetUri: Cloud Storage path to the file containing training dataset for tuning. + * The dataset must be formatted as a JSONL file. */ - @JsonProperty("singleRewardConfig") - public abstract Builder singleRewardConfig( - SingleReinforcementTuningRewardConfig singleRewardConfig); + @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 singleRewardConfig builder. + * Setter for validationDatasetUri. * - *

singleRewardConfig: Single reward function configuration for reinforcement tuning. + *

validationDatasetUri: Cloud Storage path to the file containing validation dataset for + * tuning. The dataset must be formatted as a JSONL file. */ - @CanIgnoreReturnValue - public Builder singleRewardConfig( - SingleReinforcementTuningRewardConfig.Builder singleRewardConfigBuilder) { - return singleRewardConfig(singleRewardConfigBuilder.build()); - } + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); @ExcludeFromGeneratedCoverageReport - abstract Builder singleRewardConfig( - Optional singleRewardConfig); + abstract Builder validationDatasetUri(Optional validationDatasetUri); - /** Clears the value of singleRewardConfig field. */ + /** Clears the value of validationDatasetUri field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearSingleRewardConfig() { - return singleRewardConfig(Optional.empty()); + public Builder clearValidationDatasetUri() { + return validationDatasetUri(Optional.empty()); } public abstract ReinforcementTuningSpec build(); diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorer.java b/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorer.java index 2502c61f801..f756a5aca56 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorer.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorer.java @@ -36,13 +36,6 @@ @AutoValue @JsonDeserialize(builder = ReinforcementTuningStringMatchRewardScorer.Builder.class) public abstract class ReinforcementTuningStringMatchRewardScorer extends JsonSerializable { - /** - * Wrong answer reward is returned if the parsed response is evaluated as `false`. All wrong - * answers get the same reward. - */ - @JsonProperty("wrongAnswerReward") - public abstract Optional wrongAnswerReward(); - /** * Correct answer rewawrd is returned if the parsed response is evaluated as `true`. All correct * answers get the same reward. @@ -50,15 +43,22 @@ public abstract class ReinforcementTuningStringMatchRewardScorer extends JsonSer @JsonProperty("correctAnswerReward") public abstract Optional correctAnswerReward(); + /** Uses json match expression to evaluate parsed response. */ + @JsonProperty("jsonMatchExpression") + public abstract Optional + jsonMatchExpression(); + /** Uses string match expression to evaluate parsed response. */ @JsonProperty("stringMatchExpression") public abstract Optional stringMatchExpression(); - /** Uses json match expression to evaluate parsed response. */ - @JsonProperty("jsonMatchExpression") - public abstract Optional - jsonMatchExpression(); + /** + * Wrong answer reward is returned if the parsed response is evaluated as `false`. All wrong + * answers get the same reward. + */ + @JsonProperty("wrongAnswerReward") + public abstract Optional wrongAnswerReward(); /** Instantiates a builder for ReinforcementTuningStringMatchRewardScorer. */ @ExcludeFromGeneratedCoverageReport @@ -82,41 +82,55 @@ private static Builder create() { } /** - * Setter for wrongAnswerReward. + * Setter for correctAnswerReward. * - *

wrongAnswerReward: Wrong answer reward is returned if the parsed response is evaluated as - * `false`. All wrong answers get the same reward. + *

correctAnswerReward: Correct answer rewawrd is returned if the parsed response is + * evaluated as `true`. All correct answers get the same reward. */ - @JsonProperty("wrongAnswerReward") - public abstract Builder wrongAnswerReward(Float wrongAnswerReward); + @JsonProperty("correctAnswerReward") + public abstract Builder correctAnswerReward(Float correctAnswerReward); @ExcludeFromGeneratedCoverageReport - abstract Builder wrongAnswerReward(Optional wrongAnswerReward); + abstract Builder correctAnswerReward(Optional correctAnswerReward); - /** Clears the value of wrongAnswerReward field. */ + /** Clears the value of correctAnswerReward field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearWrongAnswerReward() { - return wrongAnswerReward(Optional.empty()); + public Builder clearCorrectAnswerReward() { + return correctAnswerReward(Optional.empty()); } /** - * Setter for correctAnswerReward. + * Setter for jsonMatchExpression. * - *

correctAnswerReward: Correct answer rewawrd is returned if the parsed response is - * evaluated as `true`. All correct answers get the same reward. + *

jsonMatchExpression: Uses json match expression to evaluate parsed response. */ - @JsonProperty("correctAnswerReward") - public abstract Builder correctAnswerReward(Float correctAnswerReward); + @JsonProperty("jsonMatchExpression") + public abstract Builder jsonMatchExpression( + ReinforcementTuningStringMatchRewardScorerJsonMatchExpression jsonMatchExpression); + + /** + * Setter for jsonMatchExpression builder. + * + *

jsonMatchExpression: Uses json match expression to evaluate parsed response. + */ + @CanIgnoreReturnValue + public Builder jsonMatchExpression( + ReinforcementTuningStringMatchRewardScorerJsonMatchExpression.Builder + jsonMatchExpressionBuilder) { + return jsonMatchExpression(jsonMatchExpressionBuilder.build()); + } @ExcludeFromGeneratedCoverageReport - abstract Builder correctAnswerReward(Optional correctAnswerReward); + abstract Builder jsonMatchExpression( + Optional + jsonMatchExpression); - /** Clears the value of correctAnswerReward field. */ + /** Clears the value of jsonMatchExpression field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCorrectAnswerReward() { - return correctAnswerReward(Optional.empty()); + public Builder clearJsonMatchExpression() { + return jsonMatchExpression(Optional.empty()); } /** @@ -153,36 +167,22 @@ public Builder clearStringMatchExpression() { } /** - * Setter for jsonMatchExpression. - * - *

jsonMatchExpression: Uses json match expression to evaluate parsed response. - */ - @JsonProperty("jsonMatchExpression") - public abstract Builder jsonMatchExpression( - ReinforcementTuningStringMatchRewardScorerJsonMatchExpression jsonMatchExpression); - - /** - * Setter for jsonMatchExpression builder. + * Setter for wrongAnswerReward. * - *

jsonMatchExpression: Uses json match expression to evaluate parsed response. + *

wrongAnswerReward: Wrong answer reward is returned if the parsed response is evaluated as + * `false`. All wrong answers get the same reward. */ - @CanIgnoreReturnValue - public Builder jsonMatchExpression( - ReinforcementTuningStringMatchRewardScorerJsonMatchExpression.Builder - jsonMatchExpressionBuilder) { - return jsonMatchExpression(jsonMatchExpressionBuilder.build()); - } + @JsonProperty("wrongAnswerReward") + public abstract Builder wrongAnswerReward(Float wrongAnswerReward); @ExcludeFromGeneratedCoverageReport - abstract Builder jsonMatchExpression( - Optional - jsonMatchExpression); + abstract Builder wrongAnswerReward(Optional wrongAnswerReward); - /** Clears the value of jsonMatchExpression field. */ + /** Clears the value of wrongAnswerReward field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearJsonMatchExpression() { - return jsonMatchExpression(Optional.empty()); + public Builder clearWrongAnswerReward() { + return wrongAnswerReward(Optional.empty()); } public abstract ReinforcementTuningStringMatchRewardScorer build(); diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorerStringMatchExpression.java b/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorerStringMatchExpression.java index 2e007ec91cb..d62cf8cfebb 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorerStringMatchExpression.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningStringMatchRewardScorerStringMatchExpression.java @@ -36,10 +36,6 @@ builder = ReinforcementTuningStringMatchRewardScorerStringMatchExpression.Builder.class) public abstract class ReinforcementTuningStringMatchRewardScorerStringMatchExpression extends JsonSerializable { - /** Match operation to use for evaluating rewards. */ - @JsonProperty("matchOperation") - public abstract Optional matchOperation(); - /** * A string or a regular expression to match against for evaluating rewards. Users can also * provide a references map of `{key: value}` whose `value` will be used to replace the @@ -54,6 +50,10 @@ public abstract class ReinforcementTuningStringMatchRewardScorerStringMatchExpre @JsonProperty("expression") public abstract Optional expression(); + /** Match operation to use for evaluating rewards. */ + @JsonProperty("matchOperation") + public abstract Optional matchOperation(); + /** Instantiates a builder for ReinforcementTuningStringMatchRewardScorerStringMatchExpression. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -77,6 +77,32 @@ private static Builder create() { .Builder(); } + /** + * Setter for expression. + * + *

expression: A string or a regular expression to match against for evaluating rewards. + * Users can also provide a references map of `{key: value}` whose `value` will be used to + * replace the placeholder {{references.key}} in the expression. For example, if the following + * `references` are defined in the training / validation dataset: ``` { "systemInstruction": + * ..., "contents": ..., "references": { "concise_answer": "Yes", "verbose_answer": "The answer + * is Yes" } } ``` and if users define the following StringMatchExpression: { "matchOperation": + * "REGEX_CONTAINS", "expression": ".*{{references.concise_answer}}.*" } On evaluating the + * reward for each sample response, this StringMatchExpression will be substituted as: ``` { + * "matchOperation": "REGEX_CONTAINS", "expression": ".*Yes.*" } ``` + */ + @JsonProperty("expression") + public abstract Builder expression(String expression); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expression(Optional expression); + + /** Clears the value of expression field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpression() { + return expression(Optional.empty()); + } + /** * Setter for matchOperation. * @@ -115,32 +141,6 @@ public Builder matchOperation(String matchOperation) { return matchOperation(new MatchOperation(matchOperation)); } - /** - * Setter for expression. - * - *

expression: A string or a regular expression to match against for evaluating rewards. - * Users can also provide a references map of `{key: value}` whose `value` will be used to - * replace the placeholder {{references.key}} in the expression. For example, if the following - * `references` are defined in the training / validation dataset: ``` { "systemInstruction": - * ..., "contents": ..., "references": { "concise_answer": "Yes", "verbose_answer": "The answer - * is Yes" } } ``` and if users define the following StringMatchExpression: { "matchOperation": - * "REGEX_CONTAINS", "expression": ".*{{references.concise_answer}}.*" } On evaluating the - * reward for each sample response, this StringMatchExpression will be substituted as: ``` { - * "matchOperation": "REGEX_CONTAINS", "expression": ".*Yes.*" } ``` - */ - @JsonProperty("expression") - public abstract Builder expression(String expression); - - @ExcludeFromGeneratedCoverageReport - abstract Builder expression(Optional expression); - - /** Clears the value of expression field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearExpression() { - return expression(Optional.empty()); - } - public abstract ReinforcementTuningStringMatchRewardScorerStringMatchExpression build(); } diff --git a/src/main/java/com/google/genai/types/RetrievalConfig.java b/src/main/java/com/google/genai/types/RetrievalConfig.java index 727b382dcef..855964d4a61 100644 --- a/src/main/java/com/google/genai/types/RetrievalConfig.java +++ b/src/main/java/com/google/genai/types/RetrievalConfig.java @@ -30,14 +30,14 @@ @AutoValue @JsonDeserialize(builder = RetrievalConfig.Builder.class) public abstract class RetrievalConfig extends JsonSerializable { - /** The location of the user. */ - @JsonProperty("latLng") - public abstract Optional latLng(); - /** The language code of the user. */ @JsonProperty("languageCode") public abstract Optional languageCode(); + /** The location of the user. */ + @JsonProperty("latLng") + public abstract Optional latLng(); + /** Instantiates a builder for RetrievalConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -56,6 +56,24 @@ private static Builder create() { return new AutoValue_RetrievalConfig.Builder(); } + /** + * Setter for languageCode. + * + *

languageCode: The language code of the user. + */ + @JsonProperty("languageCode") + public abstract Builder languageCode(String languageCode); + + @ExcludeFromGeneratedCoverageReport + abstract Builder languageCode(Optional languageCode); + + /** Clears the value of languageCode field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLanguageCode() { + return languageCode(Optional.empty()); + } + /** * Setter for latLng. * @@ -84,24 +102,6 @@ public Builder clearLatLng() { return latLng(Optional.empty()); } - /** - * Setter for languageCode. - * - *

languageCode: The language code of the user. - */ - @JsonProperty("languageCode") - public abstract Builder languageCode(String languageCode); - - @ExcludeFromGeneratedCoverageReport - abstract Builder languageCode(Optional languageCode); - - /** Clears the value of languageCode field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearLanguageCode() { - return languageCode(Optional.empty()); - } - public abstract RetrievalConfig build(); } diff --git a/src/main/java/com/google/genai/types/SearchTypes.java b/src/main/java/com/google/genai/types/SearchTypes.java index f86052de0e3..0d1bba9f95f 100644 --- a/src/main/java/com/google/genai/types/SearchTypes.java +++ b/src/main/java/com/google/genai/types/SearchTypes.java @@ -30,14 +30,14 @@ @AutoValue @JsonDeserialize(builder = SearchTypes.Builder.class) public abstract class SearchTypes extends JsonSerializable { - /** Optional. Setting this field enables web search. Only text results are returned. */ - @JsonProperty("webSearch") - public abstract Optional webSearch(); - /** Optional. Setting this field enables image search. Image bytes are returned. */ @JsonProperty("imageSearch") public abstract Optional imageSearch(); + /** Optional. Setting this field enables web search. Only text results are returned. */ + @JsonProperty("webSearch") + public abstract Optional webSearch(); + /** Instantiates a builder for SearchTypes. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -57,61 +57,61 @@ private static Builder create() { } /** - * Setter for webSearch. + * Setter for imageSearch. * - *

webSearch: Optional. Setting this field enables web search. Only text results are - * returned. + *

imageSearch: Optional. Setting this field enables image search. Image bytes are returned. */ - @JsonProperty("webSearch") - public abstract Builder webSearch(WebSearch webSearch); + @JsonProperty("imageSearch") + public abstract Builder imageSearch(ImageSearch imageSearch); /** - * Setter for webSearch builder. + * Setter for imageSearch builder. * - *

webSearch: Optional. Setting this field enables web search. Only text results are - * returned. + *

imageSearch: Optional. Setting this field enables image search. Image bytes are returned. */ @CanIgnoreReturnValue - public Builder webSearch(WebSearch.Builder webSearchBuilder) { - return webSearch(webSearchBuilder.build()); + public Builder imageSearch(ImageSearch.Builder imageSearchBuilder) { + return imageSearch(imageSearchBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder webSearch(Optional webSearch); + abstract Builder imageSearch(Optional imageSearch); - /** Clears the value of webSearch field. */ + /** Clears the value of imageSearch field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearWebSearch() { - return webSearch(Optional.empty()); + public Builder clearImageSearch() { + return imageSearch(Optional.empty()); } /** - * Setter for imageSearch. + * Setter for webSearch. * - *

imageSearch: Optional. Setting this field enables image search. Image bytes are returned. + *

webSearch: Optional. Setting this field enables web search. Only text results are + * returned. */ - @JsonProperty("imageSearch") - public abstract Builder imageSearch(ImageSearch imageSearch); + @JsonProperty("webSearch") + public abstract Builder webSearch(WebSearch webSearch); /** - * Setter for imageSearch builder. + * Setter for webSearch builder. * - *

imageSearch: Optional. Setting this field enables image search. Image bytes are returned. + *

webSearch: Optional. Setting this field enables web search. Only text results are + * returned. */ @CanIgnoreReturnValue - public Builder imageSearch(ImageSearch.Builder imageSearchBuilder) { - return imageSearch(imageSearchBuilder.build()); + public Builder webSearch(WebSearch.Builder webSearchBuilder) { + return webSearch(webSearchBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder imageSearch(Optional imageSearch); + abstract Builder webSearch(Optional webSearch); - /** Clears the value of imageSearch field. */ + /** Clears the value of webSearch field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearImageSearch() { - return imageSearch(Optional.empty()); + public Builder clearWebSearch() { + return webSearch(Optional.empty()); } public abstract SearchTypes build(); diff --git a/src/main/java/com/google/genai/types/SingleReinforcementTuningRewardConfig.java b/src/main/java/com/google/genai/types/SingleReinforcementTuningRewardConfig.java index a2c64bba329..6b416988581 100644 --- a/src/main/java/com/google/genai/types/SingleReinforcementTuningRewardConfig.java +++ b/src/main/java/com/google/genai/types/SingleReinforcementTuningRewardConfig.java @@ -34,9 +34,20 @@ public abstract class SingleReinforcementTuningRewardConfig extends JsonSerializ @JsonProperty("autoraterScorer") public abstract Optional autoraterScorer(); - /** A unique reward name for identifying each single reinforcement tuning reward. */ - @JsonProperty("rewardName") - public abstract Optional rewardName(); + /** + * ReinforcementTuningCloudRunRewardScorer is used to score parsed responses by calling a Cloud + * Run service. + */ + @JsonProperty("cloudRunRewardScorer") + public abstract Optional cloudRunRewardScorer(); + + /** + * ReinforcementTuningCodeExecutionRewardScorer is used to score parsed responses for code + * execution use cases. + */ + @JsonProperty("codeExecutionRewardScorer") + public abstract Optional + codeExecutionRewardScorer(); /** * Defines how to parse sample response. For example, given a sample response for evaluating the @@ -48,13 +59,9 @@ public abstract class SingleReinforcementTuningRewardConfig extends JsonSerializ @JsonProperty("parseResponseConfig") public abstract Optional parseResponseConfig(); - /** - * ReinforcementTuningCodeExecutionRewardScorer is used to score parsed responses for code - * execution use cases. - */ - @JsonProperty("codeExecutionRewardScorer") - public abstract Optional - codeExecutionRewardScorer(); + /** A unique reward name for identifying each single reinforcement tuning reward. */ + @JsonProperty("rewardName") + public abstract Optional rewardName(); /** * ReinforcementTuningStringMatchRewardScorer is used to score parsed responses for simple string @@ -63,13 +70,6 @@ public abstract class SingleReinforcementTuningRewardConfig extends JsonSerializ @JsonProperty("stringMatchRewardScorer") public abstract Optional stringMatchRewardScorer(); - /** - * ReinforcementTuningCloudRunRewardScorer is used to score parsed responses by calling a Cloud - * Run service. - */ - @JsonProperty("cloudRunRewardScorer") - public abstract Optional cloudRunRewardScorer(); - /** Instantiates a builder for SingleReinforcementTuningRewardConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -123,21 +123,69 @@ public Builder clearAutoraterScorer() { } /** - * Setter for rewardName. + * Setter for cloudRunRewardScorer. * - *

rewardName: A unique reward name for identifying each single reinforcement tuning reward. + *

cloudRunRewardScorer: ReinforcementTuningCloudRunRewardScorer is used to score parsed + * responses by calling a Cloud Run service. */ - @JsonProperty("rewardName") - public abstract Builder rewardName(String rewardName); + @JsonProperty("cloudRunRewardScorer") + public abstract Builder cloudRunRewardScorer( + ReinforcementTuningCloudRunRewardScorer cloudRunRewardScorer); + + /** + * Setter for cloudRunRewardScorer builder. + * + *

cloudRunRewardScorer: ReinforcementTuningCloudRunRewardScorer is used to score parsed + * responses by calling a Cloud Run service. + */ + @CanIgnoreReturnValue + public Builder cloudRunRewardScorer( + ReinforcementTuningCloudRunRewardScorer.Builder cloudRunRewardScorerBuilder) { + return cloudRunRewardScorer(cloudRunRewardScorerBuilder.build()); + } @ExcludeFromGeneratedCoverageReport - abstract Builder rewardName(Optional rewardName); + abstract Builder cloudRunRewardScorer( + Optional cloudRunRewardScorer); - /** Clears the value of rewardName field. */ + /** Clears the value of cloudRunRewardScorer field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearRewardName() { - return rewardName(Optional.empty()); + public Builder clearCloudRunRewardScorer() { + return cloudRunRewardScorer(Optional.empty()); + } + + /** + * Setter for codeExecutionRewardScorer. + * + *

codeExecutionRewardScorer: ReinforcementTuningCodeExecutionRewardScorer is used to score + * parsed responses for code execution use cases. + */ + @JsonProperty("codeExecutionRewardScorer") + public abstract Builder codeExecutionRewardScorer( + ReinforcementTuningCodeExecutionRewardScorer codeExecutionRewardScorer); + + /** + * Setter for codeExecutionRewardScorer builder. + * + *

codeExecutionRewardScorer: ReinforcementTuningCodeExecutionRewardScorer is used to score + * parsed responses for code execution use cases. + */ + @CanIgnoreReturnValue + public Builder codeExecutionRewardScorer( + ReinforcementTuningCodeExecutionRewardScorer.Builder codeExecutionRewardScorerBuilder) { + return codeExecutionRewardScorer(codeExecutionRewardScorerBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeExecutionRewardScorer( + Optional codeExecutionRewardScorer); + + /** Clears the value of codeExecutionRewardScorer field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeExecutionRewardScorer() { + return codeExecutionRewardScorer(Optional.empty()); } /** @@ -180,36 +228,21 @@ public Builder clearParseResponseConfig() { } /** - * Setter for codeExecutionRewardScorer. - * - *

codeExecutionRewardScorer: ReinforcementTuningCodeExecutionRewardScorer is used to score - * parsed responses for code execution use cases. - */ - @JsonProperty("codeExecutionRewardScorer") - public abstract Builder codeExecutionRewardScorer( - ReinforcementTuningCodeExecutionRewardScorer codeExecutionRewardScorer); - - /** - * Setter for codeExecutionRewardScorer builder. + * Setter for rewardName. * - *

codeExecutionRewardScorer: ReinforcementTuningCodeExecutionRewardScorer is used to score - * parsed responses for code execution use cases. + *

rewardName: A unique reward name for identifying each single reinforcement tuning reward. */ - @CanIgnoreReturnValue - public Builder codeExecutionRewardScorer( - ReinforcementTuningCodeExecutionRewardScorer.Builder codeExecutionRewardScorerBuilder) { - return codeExecutionRewardScorer(codeExecutionRewardScorerBuilder.build()); - } + @JsonProperty("rewardName") + public abstract Builder rewardName(String rewardName); @ExcludeFromGeneratedCoverageReport - abstract Builder codeExecutionRewardScorer( - Optional codeExecutionRewardScorer); + abstract Builder rewardName(Optional rewardName); - /** Clears the value of codeExecutionRewardScorer field. */ + /** Clears the value of rewardName field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCodeExecutionRewardScorer() { - return codeExecutionRewardScorer(Optional.empty()); + public Builder clearRewardName() { + return rewardName(Optional.empty()); } /** @@ -245,39 +278,6 @@ public Builder clearStringMatchRewardScorer() { return stringMatchRewardScorer(Optional.empty()); } - /** - * Setter for cloudRunRewardScorer. - * - *

cloudRunRewardScorer: ReinforcementTuningCloudRunRewardScorer is used to score parsed - * responses by calling a Cloud Run service. - */ - @JsonProperty("cloudRunRewardScorer") - public abstract Builder cloudRunRewardScorer( - ReinforcementTuningCloudRunRewardScorer cloudRunRewardScorer); - - /** - * Setter for cloudRunRewardScorer builder. - * - *

cloudRunRewardScorer: ReinforcementTuningCloudRunRewardScorer is used to score parsed - * responses by calling a Cloud Run service. - */ - @CanIgnoreReturnValue - public Builder cloudRunRewardScorer( - ReinforcementTuningCloudRunRewardScorer.Builder cloudRunRewardScorerBuilder) { - return cloudRunRewardScorer(cloudRunRewardScorerBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder cloudRunRewardScorer( - Optional cloudRunRewardScorer); - - /** Clears the value of cloudRunRewardScorer field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearCloudRunRewardScorer() { - return cloudRunRewardScorer(Optional.empty()); - } - public abstract SingleReinforcementTuningRewardConfig build(); } diff --git a/src/main/java/com/google/genai/types/Tool.java b/src/main/java/com/google/genai/types/Tool.java index 68121d26195..b080b45eabe 100644 --- a/src/main/java/com/google/genai/types/Tool.java +++ b/src/main/java/com/google/genai/types/Tool.java @@ -51,26 +51,6 @@ public abstract class Tool extends JsonSerializable { @JsonIgnore public abstract Optional> functions(); - /** - * Optional. Tool to support the model interacting directly with the computer. If enabled, it - * automatically populates computer-use specific Function Declarations. - */ - @JsonProperty("computerUse") - public abstract Optional computerUse(); - - /** - * Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. - * This field is not supported in Vertex AI. - */ - @JsonProperty("fileSearch") - public abstract Optional fileSearch(); - - /** - * Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google. - */ - @JsonProperty("googleSearch") - public abstract Optional googleSearch(); - /** * Optional. Tool that allows grounding the model's response with geospatial context related to * the user's query. @@ -78,10 +58,21 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("googleMaps") public abstract Optional googleMaps(); + /** Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */ + @JsonProperty("mcpServers") + public abstract Optional> mcpServers(); + /** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */ @JsonProperty("codeExecution") public abstract Optional codeExecution(); + /** + * Optional. Tool to support the model interacting directly with the computer. If enabled, it + * automatically populates computer-use specific Function Declarations. + */ + @JsonProperty("computerUse") + public abstract Optional computerUse(); + /** * Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 * compliance. This field is not supported in Gemini API. @@ -89,6 +80,14 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("enterpriseWebSearch") public abstract Optional enterpriseWebSearch(); + /** + * Optional. Uses Exa.ai to search for information to answer user queries. The search results will + * be grounded on Exa.ai and presented to the model for response generation. This field is not + * supported in Gemini API. + */ + @JsonProperty("exaAiSearch") + public abstract Optional exaAiSearch(); + /** * Optional. Function tool type. One or more function declarations to be passed to the model along * with the current user query. Model may decide to call a subset of these functions by populating @@ -99,6 +98,12 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("functionDeclarations") public abstract Optional> functionDeclarations(); + /** + * Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google. + */ + @JsonProperty("googleSearch") + public abstract Optional googleSearch(); + /** Optional. Specialized retrieval tool that is powered by Google Search. */ @JsonProperty("googleSearchRetrieval") public abstract Optional googleSearchRetrieval(); @@ -115,17 +120,12 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("urlContext") public abstract Optional urlContext(); - /** Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */ - @JsonProperty("mcpServers") - public abstract Optional> mcpServers(); - /** - * Optional. Uses Exa.ai to search for information to answer user queries. The search results will - * be grounded on Exa.ai and presented to the model for response generation. This field is not - * supported in Gemini API. + * Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. + * This field is not supported in Vertex AI. */ - @JsonProperty("exaAiSearch") - public abstract Optional exaAiSearch(); + @JsonProperty("fileSearch") + public abstract Optional fileSearch(); /** Instantiates a builder for Tool. */ @ExcludeFromGeneratedCoverageReport @@ -208,153 +208,134 @@ public Builder clearFunctions() { } /** - * Setter for computerUse. + * Setter for googleMaps. * - *

computerUse: Optional. Tool to support the model interacting directly with the computer. - * If enabled, it automatically populates computer-use specific Function Declarations. + *

googleMaps: Optional. Tool that allows grounding the model's response with geospatial + * context related to the user's query. */ - @JsonProperty("computerUse") - public abstract Builder computerUse(ComputerUse computerUse); + @JsonProperty("googleMaps") + public abstract Builder googleMaps(GoogleMaps googleMaps); /** - * Setter for computerUse builder. + * Setter for googleMaps builder. * - *

computerUse: Optional. Tool to support the model interacting directly with the computer. - * If enabled, it automatically populates computer-use specific Function Declarations. + *

googleMaps: Optional. Tool that allows grounding the model's response with geospatial + * context related to the user's query. */ @CanIgnoreReturnValue - public Builder computerUse(ComputerUse.Builder computerUseBuilder) { - return computerUse(computerUseBuilder.build()); + public Builder googleMaps(GoogleMaps.Builder googleMapsBuilder) { + return googleMaps(googleMapsBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder computerUse(Optional computerUse); + abstract Builder googleMaps(Optional googleMaps); - /** Clears the value of computerUse field. */ + /** Clears the value of googleMaps field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearComputerUse() { - return computerUse(Optional.empty()); + public Builder clearGoogleMaps() { + return googleMaps(Optional.empty()); } /** - * Setter for fileSearch. + * Setter for mcpServers. * - *

fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic - * Retrieval corpora. This field is not supported in Vertex AI. + *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */ - @JsonProperty("fileSearch") - public abstract Builder fileSearch(FileSearch fileSearch); + @JsonProperty("mcpServers") + public abstract Builder mcpServers(List mcpServers); /** - * Setter for fileSearch builder. + * Setter for mcpServers. * - *

fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic - * Retrieval corpora. This field is not supported in Vertex AI. + *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */ @CanIgnoreReturnValue - public Builder fileSearch(FileSearch.Builder fileSearchBuilder) { - return fileSearch(fileSearchBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder fileSearch(Optional fileSearch); - - /** Clears the value of fileSearch field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearFileSearch() { - return fileSearch(Optional.empty()); + public Builder mcpServers(McpServer... mcpServers) { + return mcpServers(Arrays.asList(mcpServers)); } /** - * Setter for googleSearch. - * - *

googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. - * Powered by Google. - */ - @JsonProperty("googleSearch") - public abstract Builder googleSearch(GoogleSearch googleSearch); - - /** - * Setter for googleSearch builder. + * Setter for mcpServers builder. * - *

googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. - * Powered by Google. + *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */ @CanIgnoreReturnValue - public Builder googleSearch(GoogleSearch.Builder googleSearchBuilder) { - return googleSearch(googleSearchBuilder.build()); + public Builder mcpServers(McpServer.Builder... mcpServersBuilders) { + return mcpServers( + Arrays.asList(mcpServersBuilders).stream() + .map(McpServer.Builder::build) + .collect(toImmutableList())); } @ExcludeFromGeneratedCoverageReport - abstract Builder googleSearch(Optional googleSearch); + abstract Builder mcpServers(Optional> mcpServers); - /** Clears the value of googleSearch field. */ + /** Clears the value of mcpServers field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearGoogleSearch() { - return googleSearch(Optional.empty()); + public Builder clearMcpServers() { + return mcpServers(Optional.empty()); } /** - * Setter for googleMaps. + * Setter for codeExecution. * - *

googleMaps: Optional. Tool that allows grounding the model's response with geospatial - * context related to the user's query. + *

codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as + * part of generation. */ - @JsonProperty("googleMaps") - public abstract Builder googleMaps(GoogleMaps googleMaps); + @JsonProperty("codeExecution") + public abstract Builder codeExecution(ToolCodeExecution codeExecution); /** - * Setter for googleMaps builder. + * Setter for codeExecution builder. * - *

googleMaps: Optional. Tool that allows grounding the model's response with geospatial - * context related to the user's query. + *

codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as + * part of generation. */ @CanIgnoreReturnValue - public Builder googleMaps(GoogleMaps.Builder googleMapsBuilder) { - return googleMaps(googleMapsBuilder.build()); + public Builder codeExecution(ToolCodeExecution.Builder codeExecutionBuilder) { + return codeExecution(codeExecutionBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder googleMaps(Optional googleMaps); + abstract Builder codeExecution(Optional codeExecution); - /** Clears the value of googleMaps field. */ + /** Clears the value of codeExecution field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearGoogleMaps() { - return googleMaps(Optional.empty()); + public Builder clearCodeExecution() { + return codeExecution(Optional.empty()); } /** - * Setter for codeExecution. + * Setter for computerUse. * - *

codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as - * part of generation. + *

computerUse: Optional. Tool to support the model interacting directly with the computer. + * If enabled, it automatically populates computer-use specific Function Declarations. */ - @JsonProperty("codeExecution") - public abstract Builder codeExecution(ToolCodeExecution codeExecution); + @JsonProperty("computerUse") + public abstract Builder computerUse(ComputerUse computerUse); /** - * Setter for codeExecution builder. + * Setter for computerUse builder. * - *

codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as - * part of generation. + *

computerUse: Optional. Tool to support the model interacting directly with the computer. + * If enabled, it automatically populates computer-use specific Function Declarations. */ @CanIgnoreReturnValue - public Builder codeExecution(ToolCodeExecution.Builder codeExecutionBuilder) { - return codeExecution(codeExecutionBuilder.build()); + public Builder computerUse(ComputerUse.Builder computerUseBuilder) { + return computerUse(computerUseBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder codeExecution(Optional codeExecution); + abstract Builder computerUse(Optional computerUse); - /** Clears the value of codeExecution field. */ + /** Clears the value of computerUse field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCodeExecution() { - return codeExecution(Optional.empty()); + public Builder clearComputerUse() { + return computerUse(Optional.empty()); } /** @@ -387,6 +368,38 @@ public Builder clearEnterpriseWebSearch() { return enterpriseWebSearch(Optional.empty()); } + /** + * Setter for exaAiSearch. + * + *

exaAiSearch: Optional. Uses Exa.ai to search for information to answer user queries. The + * search results will be grounded on Exa.ai and presented to the model for response generation. + * This field is not supported in Gemini API. + */ + @JsonProperty("exaAiSearch") + public abstract Builder exaAiSearch(ToolExaAiSearch exaAiSearch); + + /** + * Setter for exaAiSearch builder. + * + *

exaAiSearch: Optional. Uses Exa.ai to search for information to answer user queries. The + * search results will be grounded on Exa.ai and presented to the model for response generation. + * This field is not supported in Gemini API. + */ + @CanIgnoreReturnValue + public Builder exaAiSearch(ToolExaAiSearch.Builder exaAiSearchBuilder) { + return exaAiSearch(exaAiSearchBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exaAiSearch(Optional exaAiSearch); + + /** Clears the value of exaAiSearch field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExaAiSearch() { + return exaAiSearch(Optional.empty()); + } + /** * Setter for functionDeclarations. * @@ -444,6 +457,36 @@ public Builder clearFunctionDeclarations() { return functionDeclarations(Optional.empty()); } + /** + * Setter for googleSearch. + * + *

googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. + * Powered by Google. + */ + @JsonProperty("googleSearch") + public abstract Builder googleSearch(GoogleSearch googleSearch); + + /** + * Setter for googleSearch builder. + * + *

googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. + * Powered by Google. + */ + @CanIgnoreReturnValue + public Builder googleSearch(GoogleSearch.Builder googleSearchBuilder) { + return googleSearch(googleSearchBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleSearch(Optional googleSearch); + + /** Clears the value of googleSearch field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleSearch() { + return googleSearch(Optional.empty()); + } + /** * Setter for googleSearchRetrieval. * @@ -536,76 +579,33 @@ public Builder clearUrlContext() { } /** - * Setter for mcpServers. - * - *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. - */ - @JsonProperty("mcpServers") - public abstract Builder mcpServers(List mcpServers); - - /** - * Setter for mcpServers. - * - *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. - */ - @CanIgnoreReturnValue - public Builder mcpServers(McpServer... mcpServers) { - return mcpServers(Arrays.asList(mcpServers)); - } - - /** - * Setter for mcpServers builder. - * - *

mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI. - */ - @CanIgnoreReturnValue - public Builder mcpServers(McpServer.Builder... mcpServersBuilders) { - return mcpServers( - Arrays.asList(mcpServersBuilders).stream() - .map(McpServer.Builder::build) - .collect(toImmutableList())); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder mcpServers(Optional> mcpServers); - - /** Clears the value of mcpServers field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearMcpServers() { - return mcpServers(Optional.empty()); - } - - /** - * Setter for exaAiSearch. + * Setter for fileSearch. * - *

exaAiSearch: Optional. Uses Exa.ai to search for information to answer user queries. The - * search results will be grounded on Exa.ai and presented to the model for response generation. - * This field is not supported in Gemini API. + *

fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic + * Retrieval corpora. This field is not supported in Vertex AI. */ - @JsonProperty("exaAiSearch") - public abstract Builder exaAiSearch(ToolExaAiSearch exaAiSearch); + @JsonProperty("fileSearch") + public abstract Builder fileSearch(FileSearch fileSearch); /** - * Setter for exaAiSearch builder. + * Setter for fileSearch builder. * - *

exaAiSearch: Optional. Uses Exa.ai to search for information to answer user queries. The - * search results will be grounded on Exa.ai and presented to the model for response generation. - * This field is not supported in Gemini API. + *

fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic + * Retrieval corpora. This field is not supported in Vertex AI. */ @CanIgnoreReturnValue - public Builder exaAiSearch(ToolExaAiSearch.Builder exaAiSearchBuilder) { - return exaAiSearch(exaAiSearchBuilder.build()); + public Builder fileSearch(FileSearch.Builder fileSearchBuilder) { + return fileSearch(fileSearchBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder exaAiSearch(Optional exaAiSearch); + abstract Builder fileSearch(Optional fileSearch); - /** Clears the value of exaAiSearch field. */ + /** Clears the value of fileSearch field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearExaAiSearch() { - return exaAiSearch(Optional.empty()); + public Builder clearFileSearch() { + return fileSearch(Optional.empty()); } public abstract Tool build(); diff --git a/src/main/java/com/google/genai/types/ToolConfig.java b/src/main/java/com/google/genai/types/ToolConfig.java index 59e2766cf75..f32a3cdeda2 100644 --- a/src/main/java/com/google/genai/types/ToolConfig.java +++ b/src/main/java/com/google/genai/types/ToolConfig.java @@ -30,14 +30,14 @@ @AutoValue @JsonDeserialize(builder = ToolConfig.Builder.class) public abstract class ToolConfig extends JsonSerializable { - /** Optional. Retrieval config. */ - @JsonProperty("retrievalConfig") - public abstract Optional retrievalConfig(); - /** Optional. Function calling config. */ @JsonProperty("functionCallingConfig") public abstract Optional functionCallingConfig(); + /** Optional. Retrieval config. */ + @JsonProperty("retrievalConfig") + public abstract Optional retrievalConfig(); + /** * 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. @@ -65,60 +65,60 @@ private static Builder create() { } /** - * Setter for retrievalConfig. + * Setter for functionCallingConfig. * - *

retrievalConfig: Optional. Retrieval config. + *

functionCallingConfig: Optional. Function calling config. */ - @JsonProperty("retrievalConfig") - public abstract Builder retrievalConfig(RetrievalConfig retrievalConfig); + @JsonProperty("functionCallingConfig") + public abstract Builder functionCallingConfig(FunctionCallingConfig functionCallingConfig); /** - * Setter for retrievalConfig builder. + * Setter for functionCallingConfig builder. * - *

retrievalConfig: Optional. Retrieval config. + *

functionCallingConfig: Optional. Function calling config. */ @CanIgnoreReturnValue - public Builder retrievalConfig(RetrievalConfig.Builder retrievalConfigBuilder) { - return retrievalConfig(retrievalConfigBuilder.build()); + public Builder functionCallingConfig( + FunctionCallingConfig.Builder functionCallingConfigBuilder) { + return functionCallingConfig(functionCallingConfigBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder retrievalConfig(Optional retrievalConfig); + abstract Builder functionCallingConfig(Optional functionCallingConfig); - /** Clears the value of retrievalConfig field. */ + /** Clears the value of functionCallingConfig field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearRetrievalConfig() { - return retrievalConfig(Optional.empty()); + public Builder clearFunctionCallingConfig() { + return functionCallingConfig(Optional.empty()); } /** - * Setter for functionCallingConfig. + * Setter for retrievalConfig. * - *

functionCallingConfig: Optional. Function calling config. + *

retrievalConfig: Optional. Retrieval config. */ - @JsonProperty("functionCallingConfig") - public abstract Builder functionCallingConfig(FunctionCallingConfig functionCallingConfig); + @JsonProperty("retrievalConfig") + public abstract Builder retrievalConfig(RetrievalConfig retrievalConfig); /** - * Setter for functionCallingConfig builder. + * Setter for retrievalConfig builder. * - *

functionCallingConfig: Optional. Function calling config. + *

retrievalConfig: Optional. Retrieval config. */ @CanIgnoreReturnValue - public Builder functionCallingConfig( - FunctionCallingConfig.Builder functionCallingConfigBuilder) { - return functionCallingConfig(functionCallingConfigBuilder.build()); + public Builder retrievalConfig(RetrievalConfig.Builder retrievalConfigBuilder) { + return retrievalConfig(retrievalConfigBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder functionCallingConfig(Optional functionCallingConfig); + abstract Builder retrievalConfig(Optional retrievalConfig); - /** Clears the value of functionCallingConfig field. */ + /** Clears the value of retrievalConfig field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearFunctionCallingConfig() { - return functionCallingConfig(Optional.empty()); + public Builder clearRetrievalConfig() { + return retrievalConfig(Optional.empty()); } /** diff --git a/src/main/java/com/google/genai/types/Transcription.java b/src/main/java/com/google/genai/types/Transcription.java index 9d276000015..48be456279f 100644 --- a/src/main/java/com/google/genai/types/Transcription.java +++ b/src/main/java/com/google/genai/types/Transcription.java @@ -18,12 +18,16 @@ package com.google.genai.types; +import static com.google.common.collect.ImmutableList.toImmutableList; + 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.Arrays; +import java.util.List; import java.util.Optional; /** Audio transcription in Server Content. */ @@ -42,6 +46,14 @@ public abstract class Transcription extends JsonSerializable { @JsonProperty("languageCode") public abstract Optional languageCode(); + /** A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). */ + @JsonProperty("speakerLabel") + public abstract Optional speakerLabel(); + + /** Detailed word-level transcriptions and timing details. */ + @JsonProperty("words") + public abstract Optional> words(); + /** Instantiates a builder for Transcription. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -114,6 +126,66 @@ public Builder clearLanguageCode() { return languageCode(Optional.empty()); } + /** + * Setter for speakerLabel. + * + *

speakerLabel: A label identifying the speaker of this audio segment (e.g. "spk_1", + * "spk_2"). + */ + @JsonProperty("speakerLabel") + public abstract Builder speakerLabel(String speakerLabel); + + @ExcludeFromGeneratedCoverageReport + abstract Builder speakerLabel(Optional speakerLabel); + + /** Clears the value of speakerLabel field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpeakerLabel() { + return speakerLabel(Optional.empty()); + } + + /** + * Setter for words. + * + *

words: Detailed word-level transcriptions and timing details. + */ + @JsonProperty("words") + public abstract Builder words(List words); + + /** + * Setter for words. + * + *

words: Detailed word-level transcriptions and timing details. + */ + @CanIgnoreReturnValue + public Builder words(WordInfo... words) { + return words(Arrays.asList(words)); + } + + /** + * Setter for words builder. + * + *

words: Detailed word-level transcriptions and timing details. + */ + @CanIgnoreReturnValue + public Builder words(WordInfo.Builder... wordsBuilders) { + return words( + Arrays.asList(wordsBuilders).stream() + .map(WordInfo.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder words(Optional> words); + + /** Clears the value of words field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWords() { + return words(Optional.empty()); + } + public abstract Transcription build(); } diff --git a/src/main/java/com/google/genai/types/TuningDataStats.java b/src/main/java/com/google/genai/types/TuningDataStats.java index c1c3edd0385..c970d7efc0b 100644 --- a/src/main/java/com/google/genai/types/TuningDataStats.java +++ b/src/main/java/com/google/genai/types/TuningDataStats.java @@ -43,14 +43,14 @@ public abstract class TuningDataStats extends JsonSerializable { @JsonProperty("preferenceOptimizationDataStats") public abstract Optional preferenceOptimizationDataStats(); - /** The SFT Tuning data stats. */ - @JsonProperty("supervisedTuningDataStats") - public abstract Optional supervisedTuningDataStats(); - /** Output only. Statistics for reinforcement tuning. */ @JsonProperty("reinforcementTuningDataStats") public abstract Optional reinforcementTuningDataStats(); + /** The SFT Tuning data stats. */ + @JsonProperty("supervisedTuningDataStats") + public abstract Optional supervisedTuningDataStats(); + /** Instantiates a builder for TuningDataStats. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -132,64 +132,64 @@ public Builder clearPreferenceOptimizationDataStats() { } /** - * Setter for supervisedTuningDataStats. + * Setter for reinforcementTuningDataStats. * - *

supervisedTuningDataStats: The SFT Tuning data stats. + *

reinforcementTuningDataStats: Output only. Statistics for reinforcement tuning. */ - @JsonProperty("supervisedTuningDataStats") - public abstract Builder supervisedTuningDataStats( - SupervisedTuningDataStats supervisedTuningDataStats); + @JsonProperty("reinforcementTuningDataStats") + public abstract Builder reinforcementTuningDataStats(DatasetStats reinforcementTuningDataStats); /** - * Setter for supervisedTuningDataStats builder. + * Setter for reinforcementTuningDataStats builder. * - *

supervisedTuningDataStats: The SFT Tuning data stats. + *

reinforcementTuningDataStats: Output only. Statistics for reinforcement tuning. */ @CanIgnoreReturnValue - public Builder supervisedTuningDataStats( - SupervisedTuningDataStats.Builder supervisedTuningDataStatsBuilder) { - return supervisedTuningDataStats(supervisedTuningDataStatsBuilder.build()); + public Builder reinforcementTuningDataStats( + DatasetStats.Builder reinforcementTuningDataStatsBuilder) { + return reinforcementTuningDataStats(reinforcementTuningDataStatsBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder supervisedTuningDataStats( - Optional supervisedTuningDataStats); + abstract Builder reinforcementTuningDataStats( + Optional reinforcementTuningDataStats); - /** Clears the value of supervisedTuningDataStats field. */ + /** Clears the value of reinforcementTuningDataStats field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearSupervisedTuningDataStats() { - return supervisedTuningDataStats(Optional.empty()); + public Builder clearReinforcementTuningDataStats() { + return reinforcementTuningDataStats(Optional.empty()); } /** - * Setter for reinforcementTuningDataStats. + * Setter for supervisedTuningDataStats. * - *

reinforcementTuningDataStats: Output only. Statistics for reinforcement tuning. + *

supervisedTuningDataStats: The SFT Tuning data stats. */ - @JsonProperty("reinforcementTuningDataStats") - public abstract Builder reinforcementTuningDataStats(DatasetStats reinforcementTuningDataStats); + @JsonProperty("supervisedTuningDataStats") + public abstract Builder supervisedTuningDataStats( + SupervisedTuningDataStats supervisedTuningDataStats); /** - * Setter for reinforcementTuningDataStats builder. + * Setter for supervisedTuningDataStats builder. * - *

reinforcementTuningDataStats: Output only. Statistics for reinforcement tuning. + *

supervisedTuningDataStats: The SFT Tuning data stats. */ @CanIgnoreReturnValue - public Builder reinforcementTuningDataStats( - DatasetStats.Builder reinforcementTuningDataStatsBuilder) { - return reinforcementTuningDataStats(reinforcementTuningDataStatsBuilder.build()); + public Builder supervisedTuningDataStats( + SupervisedTuningDataStats.Builder supervisedTuningDataStatsBuilder) { + return supervisedTuningDataStats(supervisedTuningDataStatsBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder reinforcementTuningDataStats( - Optional reinforcementTuningDataStats); + abstract Builder supervisedTuningDataStats( + Optional supervisedTuningDataStats); - /** Clears the value of reinforcementTuningDataStats field. */ + /** Clears the value of supervisedTuningDataStats field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearReinforcementTuningDataStats() { - return reinforcementTuningDataStats(Optional.empty()); + public Builder clearSupervisedTuningDataStats() { + return supervisedTuningDataStats(Optional.empty()); } public abstract TuningDataStats build(); diff --git a/src/main/java/com/google/genai/types/TuningJob.java b/src/main/java/com/google/genai/types/TuningJob.java index 709982b84e2..65f4d6898c4 100644 --- a/src/main/java/com/google/genai/types/TuningJob.java +++ b/src/main/java/com/google/genai/types/TuningJob.java @@ -105,6 +105,10 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("preferenceOptimizationSpec") public abstract Optional preferenceOptimizationSpec(); + /** */ + @JsonProperty("distillationSamplingSpec") + public abstract Optional distillationSamplingSpec(); + /** Tuning Spec for Distillation. */ @JsonProperty("distillationSpec") public abstract Optional distillationSpec(); @@ -197,25 +201,21 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("tunedModelDisplayName") public abstract Optional tunedModelDisplayName(); - /** Output only. The detail state of the tuning job (while the overall `JobState` is running). */ - @JsonProperty("tuningJobState") - public abstract Optional tuningJobState(); - - /** Tuning Spec for Veo Tuning. */ - @JsonProperty("veoTuningSpec") - public abstract Optional veoTuningSpec(); - /** Output only. Tuning Job metadata. */ @JsonProperty("tuningJobMetadata") public abstract Optional tuningJobMetadata(); + /** Output only. The detail state of the tuning job (while the overall `JobState` is running). */ + @JsonProperty("tuningJobState") + public abstract Optional tuningJobState(); + /** Tuning Spec for Veo LoRA Tuning. */ @JsonProperty("veoLoraTuningSpec") public abstract Optional veoLoraTuningSpec(); - /** */ - @JsonProperty("distillationSamplingSpec") - public abstract Optional distillationSamplingSpec(); + /** Tuning Spec for Veo Tuning. */ + @JsonProperty("veoTuningSpec") + public abstract Optional veoTuningSpec(); /** Instantiates a builder for TuningJob. */ @ExcludeFromGeneratedCoverageReport @@ -576,6 +576,37 @@ public Builder clearPreferenceOptimizationSpec() { return preferenceOptimizationSpec(Optional.empty()); } + /** + * Setter for distillationSamplingSpec. + * + *

distillationSamplingSpec: + */ + @JsonProperty("distillationSamplingSpec") + public abstract Builder distillationSamplingSpec( + DistillationSamplingSpec distillationSamplingSpec); + + /** + * Setter for distillationSamplingSpec builder. + * + *

distillationSamplingSpec: + */ + @CanIgnoreReturnValue + public Builder distillationSamplingSpec( + DistillationSamplingSpec.Builder distillationSamplingSpecBuilder) { + return distillationSamplingSpec(distillationSamplingSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder distillationSamplingSpec( + Optional distillationSamplingSpec); + + /** Clears the value of distillationSamplingSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDistillationSamplingSpec() { + return distillationSamplingSpec(Optional.empty()); + } + /** * Setter for distillationSpec. * @@ -966,6 +997,34 @@ public Builder clearTunedModelDisplayName() { return tunedModelDisplayName(Optional.empty()); } + /** + * Setter for tuningJobMetadata. + * + *

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

tuningJobMetadata: Output only. Tuning Job metadata. + */ + @CanIgnoreReturnValue + public Builder tuningJobMetadata(TuningJobMetadata.Builder tuningJobMetadataBuilder) { + return tuningJobMetadata(tuningJobMetadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tuningJobMetadata(Optional tuningJobMetadata); + + /** Clears the value of tuningJobMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTuningJobMetadata() { + return tuningJobMetadata(Optional.empty()); + } + /** * Setter for tuningJobState. * @@ -1007,62 +1066,6 @@ public Builder tuningJobState(String tuningJobState) { return tuningJobState(new TuningJobState(tuningJobState)); } - /** - * Setter for veoTuningSpec. - * - *

veoTuningSpec: Tuning Spec for Veo Tuning. - */ - @JsonProperty("veoTuningSpec") - public abstract Builder veoTuningSpec(VeoTuningSpec veoTuningSpec); - - /** - * Setter for veoTuningSpec builder. - * - *

veoTuningSpec: Tuning Spec for Veo Tuning. - */ - @CanIgnoreReturnValue - public Builder veoTuningSpec(VeoTuningSpec.Builder veoTuningSpecBuilder) { - return veoTuningSpec(veoTuningSpecBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder veoTuningSpec(Optional veoTuningSpec); - - /** Clears the value of veoTuningSpec field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearVeoTuningSpec() { - return veoTuningSpec(Optional.empty()); - } - - /** - * Setter for tuningJobMetadata. - * - *

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

tuningJobMetadata: Output only. Tuning Job metadata. - */ - @CanIgnoreReturnValue - public Builder tuningJobMetadata(TuningJobMetadata.Builder tuningJobMetadataBuilder) { - return tuningJobMetadata(tuningJobMetadataBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder tuningJobMetadata(Optional tuningJobMetadata); - - /** Clears the value of tuningJobMetadata field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearTuningJobMetadata() { - return tuningJobMetadata(Optional.empty()); - } - /** * Setter for veoLoraTuningSpec. * @@ -1092,34 +1095,31 @@ public Builder clearVeoLoraTuningSpec() { } /** - * Setter for distillationSamplingSpec. + * Setter for veoTuningSpec. * - *

distillationSamplingSpec: + *

veoTuningSpec: Tuning Spec for Veo Tuning. */ - @JsonProperty("distillationSamplingSpec") - public abstract Builder distillationSamplingSpec( - DistillationSamplingSpec distillationSamplingSpec); + @JsonProperty("veoTuningSpec") + public abstract Builder veoTuningSpec(VeoTuningSpec veoTuningSpec); /** - * Setter for distillationSamplingSpec builder. + * Setter for veoTuningSpec builder. * - *

distillationSamplingSpec: + *

veoTuningSpec: Tuning Spec for Veo Tuning. */ @CanIgnoreReturnValue - public Builder distillationSamplingSpec( - DistillationSamplingSpec.Builder distillationSamplingSpecBuilder) { - return distillationSamplingSpec(distillationSamplingSpecBuilder.build()); + public Builder veoTuningSpec(VeoTuningSpec.Builder veoTuningSpecBuilder) { + return veoTuningSpec(veoTuningSpecBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder distillationSamplingSpec( - Optional distillationSamplingSpec); + abstract Builder veoTuningSpec(Optional veoTuningSpec); - /** Clears the value of distillationSamplingSpec field. */ + /** Clears the value of veoTuningSpec field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearDistillationSamplingSpec() { - return distillationSamplingSpec(Optional.empty()); + public Builder clearVeoTuningSpec() { + return veoTuningSpec(Optional.empty()); } public abstract TuningJob build(); diff --git a/src/main/java/com/google/genai/types/UsageMetadata.java b/src/main/java/com/google/genai/types/UsageMetadata.java index 9ca3736c80e..52ef4e13800 100644 --- a/src/main/java/com/google/genai/types/UsageMetadata.java +++ b/src/main/java/com/google/genai/types/UsageMetadata.java @@ -34,28 +34,35 @@ @AutoValue @JsonDeserialize(builder = UsageMetadata.Builder.class) public abstract class UsageMetadata extends JsonSerializable { + /** Total number of tokens across all the generated response candidates. */ + @JsonProperty("responseTokenCount") + public abstract Optional responseTokenCount(); + + /** List of modalities that were returned in the response. */ + @JsonProperty("responseTokensDetails") + public abstract Optional> responseTokensDetails(); + /** - * The total number of tokens in the prompt. This includes any text, images, or other media - * provided in the request. When `cached_content` is set, this also includes the number of tokens - * in the cached content. + * Output only. A detailed breakdown of the token count for each modality in the cached content. */ - @JsonProperty("promptTokenCount") - public abstract Optional promptTokenCount(); + @JsonProperty("cacheTokensDetails") + public abstract Optional> cacheTokensDetails(); /** Output only. The number of tokens in the cached content that was used for this request. */ @JsonProperty("cachedContentTokenCount") public abstract Optional cachedContentTokenCount(); - /** Total number of tokens across all the generated response candidates. */ - @JsonProperty("responseTokenCount") - public abstract Optional responseTokenCount(); - /** - * Output only. The number of tokens in the results from tool executions, which are provided back - * to the model as input, if applicable. + * The total number of tokens in the prompt. This includes any text, images, or other media + * provided in the request. When `cached_content` is set, this also includes the number of tokens + * in the cached content. */ - @JsonProperty("toolUsePromptTokenCount") - public abstract Optional toolUsePromptTokenCount(); + @JsonProperty("promptTokenCount") + public abstract Optional promptTokenCount(); + + /** Output only. A detailed breakdown of the token count for each modality in the prompt. */ + @JsonProperty("promptTokensDetails") + public abstract Optional> promptTokensDetails(); /** * Output only. The number of tokens that were part of the model's generated "thoughts" output, if @@ -65,25 +72,11 @@ public abstract class UsageMetadata extends JsonSerializable { public abstract Optional thoughtsTokenCount(); /** - * The total number of tokens for the entire request. This is the sum of `prompt_token_count`, - * `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`. - */ - @JsonProperty("totalTokenCount") - public abstract Optional totalTokenCount(); - - /** Output only. A detailed breakdown of the token count for each modality in the prompt. */ - @JsonProperty("promptTokensDetails") - public abstract Optional> promptTokensDetails(); - - /** - * Output only. A detailed breakdown of the token count for each modality in the cached content. + * Output only. The number of tokens in the results from tool executions, which are provided back + * to the model as input, if applicable. */ - @JsonProperty("cacheTokensDetails") - public abstract Optional> cacheTokensDetails(); - - /** List of modalities that were returned in the response. */ - @JsonProperty("responseTokensDetails") - public abstract Optional> responseTokensDetails(); + @JsonProperty("toolUsePromptTokenCount") + public abstract Optional toolUsePromptTokenCount(); /** * Output only. A detailed breakdown by modality of the token counts from the results of tool @@ -92,6 +85,13 @@ public abstract class UsageMetadata extends JsonSerializable { @JsonProperty("toolUsePromptTokensDetails") public abstract Optional> toolUsePromptTokensDetails(); + /** + * The total number of tokens for the entire request. This is the sum of `prompt_token_count`, + * `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`. + */ + @JsonProperty("totalTokenCount") + public abstract Optional totalTokenCount(); + /** Output only. The traffic type for this request. This field is not supported in Gemini API. */ @JsonProperty("trafficType") public abstract Optional trafficType(); @@ -119,118 +119,147 @@ private static Builder create() { } /** - * Setter for promptTokenCount. + * Setter for responseTokenCount. * - *

promptTokenCount: The total number of tokens in the prompt. This includes any text, - * images, or other media provided in the request. When `cached_content` is set, this also - * includes the number of tokens in the cached content. + *

responseTokenCount: Total number of tokens across all the generated response candidates. */ - @JsonProperty("promptTokenCount") - public abstract Builder promptTokenCount(Integer promptTokenCount); + @JsonProperty("responseTokenCount") + public abstract Builder responseTokenCount(Integer responseTokenCount); @ExcludeFromGeneratedCoverageReport - abstract Builder promptTokenCount(Optional promptTokenCount); + abstract Builder responseTokenCount(Optional responseTokenCount); - /** Clears the value of promptTokenCount field. */ + /** Clears the value of responseTokenCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearPromptTokenCount() { - return promptTokenCount(Optional.empty()); + public Builder clearResponseTokenCount() { + return responseTokenCount(Optional.empty()); } /** - * Setter for cachedContentTokenCount. + * Setter for responseTokensDetails. * - *

cachedContentTokenCount: Output only. The number of tokens in the cached content that was - * used for this request. + *

responseTokensDetails: List of modalities that were returned in the response. */ - @JsonProperty("cachedContentTokenCount") - public abstract Builder cachedContentTokenCount(Integer cachedContentTokenCount); - - @ExcludeFromGeneratedCoverageReport - abstract Builder cachedContentTokenCount(Optional cachedContentTokenCount); + @JsonProperty("responseTokensDetails") + public abstract Builder responseTokensDetails(List responseTokensDetails); - /** Clears the value of cachedContentTokenCount field. */ - @ExcludeFromGeneratedCoverageReport + /** + * Setter for responseTokensDetails. + * + *

responseTokensDetails: List of modalities that were returned in the response. + */ @CanIgnoreReturnValue - public Builder clearCachedContentTokenCount() { - return cachedContentTokenCount(Optional.empty()); + public Builder responseTokensDetails(ModalityTokenCount... responseTokensDetails) { + return responseTokensDetails(Arrays.asList(responseTokensDetails)); } /** - * Setter for responseTokenCount. + * Setter for responseTokensDetails builder. * - *

responseTokenCount: Total number of tokens across all the generated response candidates. + *

responseTokensDetails: List of modalities that were returned in the response. */ - @JsonProperty("responseTokenCount") - public abstract Builder responseTokenCount(Integer responseTokenCount); + @CanIgnoreReturnValue + public Builder responseTokensDetails( + ModalityTokenCount.Builder... responseTokensDetailsBuilders) { + return responseTokensDetails( + Arrays.asList(responseTokensDetailsBuilders).stream() + .map(ModalityTokenCount.Builder::build) + .collect(toImmutableList())); + } @ExcludeFromGeneratedCoverageReport - abstract Builder responseTokenCount(Optional responseTokenCount); + abstract Builder responseTokensDetails( + Optional> responseTokensDetails); - /** Clears the value of responseTokenCount field. */ + /** Clears the value of responseTokensDetails field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearResponseTokenCount() { - return responseTokenCount(Optional.empty()); + public Builder clearResponseTokensDetails() { + return responseTokensDetails(Optional.empty()); } /** - * Setter for toolUsePromptTokenCount. + * Setter for cacheTokensDetails. * - *

toolUsePromptTokenCount: Output only. The number of tokens in the results from tool - * executions, which are provided back to the model as input, if applicable. + *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality + * in the cached content. */ - @JsonProperty("toolUsePromptTokenCount") - public abstract Builder toolUsePromptTokenCount(Integer toolUsePromptTokenCount); + @JsonProperty("cacheTokensDetails") + public abstract Builder cacheTokensDetails(List cacheTokensDetails); + + /** + * Setter for cacheTokensDetails. + * + *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality + * in the cached content. + */ + @CanIgnoreReturnValue + public Builder cacheTokensDetails(ModalityTokenCount... cacheTokensDetails) { + return cacheTokensDetails(Arrays.asList(cacheTokensDetails)); + } + + /** + * Setter for cacheTokensDetails builder. + * + *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality + * in the cached content. + */ + @CanIgnoreReturnValue + public Builder cacheTokensDetails(ModalityTokenCount.Builder... cacheTokensDetailsBuilders) { + return cacheTokensDetails( + Arrays.asList(cacheTokensDetailsBuilders).stream() + .map(ModalityTokenCount.Builder::build) + .collect(toImmutableList())); + } @ExcludeFromGeneratedCoverageReport - abstract Builder toolUsePromptTokenCount(Optional toolUsePromptTokenCount); + abstract Builder cacheTokensDetails(Optional> cacheTokensDetails); - /** Clears the value of toolUsePromptTokenCount field. */ + /** Clears the value of cacheTokensDetails field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearToolUsePromptTokenCount() { - return toolUsePromptTokenCount(Optional.empty()); + public Builder clearCacheTokensDetails() { + return cacheTokensDetails(Optional.empty()); } /** - * Setter for thoughtsTokenCount. + * Setter for cachedContentTokenCount. * - *

thoughtsTokenCount: Output only. The number of tokens that were part of the model's - * generated "thoughts" output, if applicable. + *

cachedContentTokenCount: Output only. The number of tokens in the cached content that was + * used for this request. */ - @JsonProperty("thoughtsTokenCount") - public abstract Builder thoughtsTokenCount(Integer thoughtsTokenCount); + @JsonProperty("cachedContentTokenCount") + public abstract Builder cachedContentTokenCount(Integer cachedContentTokenCount); @ExcludeFromGeneratedCoverageReport - abstract Builder thoughtsTokenCount(Optional thoughtsTokenCount); + abstract Builder cachedContentTokenCount(Optional cachedContentTokenCount); - /** Clears the value of thoughtsTokenCount field. */ + /** Clears the value of cachedContentTokenCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearThoughtsTokenCount() { - return thoughtsTokenCount(Optional.empty()); + public Builder clearCachedContentTokenCount() { + return cachedContentTokenCount(Optional.empty()); } /** - * Setter for totalTokenCount. + * Setter for promptTokenCount. * - *

totalTokenCount: The total number of tokens for the entire request. This is the sum of - * `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and - * `thoughts_token_count`. + *

promptTokenCount: The total number of tokens in the prompt. This includes any text, + * images, or other media provided in the request. When `cached_content` is set, this also + * includes the number of tokens in the cached content. */ - @JsonProperty("totalTokenCount") - public abstract Builder totalTokenCount(Integer totalTokenCount); + @JsonProperty("promptTokenCount") + public abstract Builder promptTokenCount(Integer promptTokenCount); @ExcludeFromGeneratedCoverageReport - abstract Builder totalTokenCount(Optional totalTokenCount); + abstract Builder promptTokenCount(Optional promptTokenCount); - /** Clears the value of totalTokenCount field. */ + /** Clears the value of promptTokenCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearTotalTokenCount() { - return totalTokenCount(Optional.empty()); + public Builder clearPromptTokenCount() { + return promptTokenCount(Optional.empty()); } /** @@ -278,90 +307,41 @@ public Builder clearPromptTokensDetails() { } /** - * Setter for cacheTokensDetails. - * - *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality - * in the cached content. - */ - @JsonProperty("cacheTokensDetails") - public abstract Builder cacheTokensDetails(List cacheTokensDetails); - - /** - * Setter for cacheTokensDetails. - * - *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality - * in the cached content. - */ - @CanIgnoreReturnValue - public Builder cacheTokensDetails(ModalityTokenCount... cacheTokensDetails) { - return cacheTokensDetails(Arrays.asList(cacheTokensDetails)); - } - - /** - * Setter for cacheTokensDetails builder. + * Setter for thoughtsTokenCount. * - *

cacheTokensDetails: Output only. A detailed breakdown of the token count for each modality - * in the cached content. + *

thoughtsTokenCount: Output only. The number of tokens that were part of the model's + * generated "thoughts" output, if applicable. */ - @CanIgnoreReturnValue - public Builder cacheTokensDetails(ModalityTokenCount.Builder... cacheTokensDetailsBuilders) { - return cacheTokensDetails( - Arrays.asList(cacheTokensDetailsBuilders).stream() - .map(ModalityTokenCount.Builder::build) - .collect(toImmutableList())); - } + @JsonProperty("thoughtsTokenCount") + public abstract Builder thoughtsTokenCount(Integer thoughtsTokenCount); @ExcludeFromGeneratedCoverageReport - abstract Builder cacheTokensDetails(Optional> cacheTokensDetails); + abstract Builder thoughtsTokenCount(Optional thoughtsTokenCount); - /** Clears the value of cacheTokensDetails field. */ + /** Clears the value of thoughtsTokenCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearCacheTokensDetails() { - return cacheTokensDetails(Optional.empty()); - } - - /** - * Setter for responseTokensDetails. - * - *

responseTokensDetails: List of modalities that were returned in the response. - */ - @JsonProperty("responseTokensDetails") - public abstract Builder responseTokensDetails(List responseTokensDetails); - - /** - * Setter for responseTokensDetails. - * - *

responseTokensDetails: List of modalities that were returned in the response. - */ - @CanIgnoreReturnValue - public Builder responseTokensDetails(ModalityTokenCount... responseTokensDetails) { - return responseTokensDetails(Arrays.asList(responseTokensDetails)); + public Builder clearThoughtsTokenCount() { + return thoughtsTokenCount(Optional.empty()); } /** - * Setter for responseTokensDetails builder. + * Setter for toolUsePromptTokenCount. * - *

responseTokensDetails: List of modalities that were returned in the response. + *

toolUsePromptTokenCount: Output only. The number of tokens in the results from tool + * executions, which are provided back to the model as input, if applicable. */ - @CanIgnoreReturnValue - public Builder responseTokensDetails( - ModalityTokenCount.Builder... responseTokensDetailsBuilders) { - return responseTokensDetails( - Arrays.asList(responseTokensDetailsBuilders).stream() - .map(ModalityTokenCount.Builder::build) - .collect(toImmutableList())); - } + @JsonProperty("toolUsePromptTokenCount") + public abstract Builder toolUsePromptTokenCount(Integer toolUsePromptTokenCount); @ExcludeFromGeneratedCoverageReport - abstract Builder responseTokensDetails( - Optional> responseTokensDetails); + abstract Builder toolUsePromptTokenCount(Optional toolUsePromptTokenCount); - /** Clears the value of responseTokensDetails field. */ + /** Clears the value of toolUsePromptTokenCount field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearResponseTokensDetails() { - return responseTokensDetails(Optional.empty()); + public Builder clearToolUsePromptTokenCount() { + return toolUsePromptTokenCount(Optional.empty()); } /** @@ -411,6 +391,26 @@ public Builder clearToolUsePromptTokensDetails() { return toolUsePromptTokensDetails(Optional.empty()); } + /** + * Setter for totalTokenCount. + * + *

totalTokenCount: The total number of tokens for the entire request. This is the sum of + * `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and + * `thoughts_token_count`. + */ + @JsonProperty("totalTokenCount") + public abstract Builder totalTokenCount(Integer totalTokenCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder totalTokenCount(Optional totalTokenCount); + + /** Clears the value of totalTokenCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTotalTokenCount() { + return totalTokenCount(Optional.empty()); + } + /** * Setter for trafficType. * diff --git a/src/main/java/com/google/genai/types/VeoHyperParameters.java b/src/main/java/com/google/genai/types/VeoHyperParameters.java index 1ed27411094..64efada1e4e 100644 --- a/src/main/java/com/google/genai/types/VeoHyperParameters.java +++ b/src/main/java/com/google/genai/types/VeoHyperParameters.java @@ -32,6 +32,10 @@ @InternalApi @JsonDeserialize(builder = VeoHyperParameters.Builder.class) public abstract class VeoHyperParameters extends JsonSerializable { + /** Optional. The adapter size for LoRA tuning. */ + @JsonProperty("adapterSize") + public abstract Optional adapterSize(); + /** * Optional. Number of complete passes the model makes over the entire training dataset during * training. @@ -43,6 +47,10 @@ public abstract class VeoHyperParameters extends JsonSerializable { @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); + /** The speed of the tuning job. Only supported for Veo 3.0 models. */ + @JsonProperty("tuningSpeed") + public abstract Optional tuningSpeed(); + /** The tuning task for Veo. */ @JsonProperty("tuningTask") public abstract Optional tuningTask(); @@ -55,14 +63,6 @@ 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() { @@ -81,6 +81,44 @@ private static Builder create() { return new AutoValue_VeoHyperParameters.Builder(); } + /** + * 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 epochCount. * @@ -118,6 +156,44 @@ public Builder clearLearningRateMultiplier() { return learningRateMultiplier(Optional.empty()); } + /** + * 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)); + } + /** * Setter for tuningTask. * @@ -176,82 +252,6 @@ 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/WordInfo.java b/src/main/java/com/google/genai/types/WordInfo.java new file mode 100644 index 00000000000..b3916c96767 --- /dev/null +++ b/src/main/java/com/google/genai/types/WordInfo.java @@ -0,0 +1,125 @@ +/* + * 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; + +/** Information about a single recognized word. */ +@AutoValue +@JsonDeserialize(builder = WordInfo.Builder.class) +public abstract class WordInfo extends JsonSerializable { + /** Transcript of the word. */ + @JsonProperty("word") + public abstract Optional word(); + + /** Start offset in time of the word relative to the start of the audio. */ + @JsonProperty("startOffset") + public abstract Optional startOffset(); + + /** End offset in time of the word relative to the start of the audio. */ + @JsonProperty("endOffset") + public abstract Optional endOffset(); + + /** Instantiates a builder for WordInfo. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_WordInfo.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for WordInfo. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `WordInfo.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_WordInfo.Builder(); + } + + /** + * Setter for word. + * + *

word: Transcript of the word. + */ + @JsonProperty("word") + public abstract Builder word(String word); + + @ExcludeFromGeneratedCoverageReport + abstract Builder word(Optional word); + + /** Clears the value of word field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWord() { + return word(Optional.empty()); + } + + /** + * Setter for startOffset. + * + *

startOffset: Start offset in time of the word relative to the start of the audio. + */ + @JsonProperty("startOffset") + public abstract Builder startOffset(String startOffset); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startOffset(Optional startOffset); + + /** Clears the value of startOffset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartOffset() { + return startOffset(Optional.empty()); + } + + /** + * Setter for endOffset. + * + *

endOffset: End offset in time of the word relative to the start of the audio. + */ + @JsonProperty("endOffset") + public abstract Builder endOffset(String endOffset); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endOffset(Optional endOffset); + + /** Clears the value of endOffset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndOffset() { + return endOffset(Optional.empty()); + } + + public abstract WordInfo build(); + } + + /** Deserializes a JSON string to a WordInfo object. */ + @ExcludeFromGeneratedCoverageReport + public static WordInfo fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, WordInfo.class); + } +}