diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index 192faa17f65..95b17844bea 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -64,6 +64,46 @@ public Batches(ApiClient apiClient) { this.apiClient = apiClient; } + @ExcludeFromGeneratedCoverageReport + ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"apiKey"}, + Common.getValueByPath(fromObject, new String[] {"apiKey"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) { + throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) { + throw new IllegalArgumentException("authType parameter is not supported in Gemini API."); + } + + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) { + throw new IllegalArgumentException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) { + throw new IllegalArgumentException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) { + throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) { + throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode batchJobDestinationFromMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -527,18 +567,18 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"finishReason"})); } - if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) { Common.setValueByPath( toObject, - new String[] {"avgLogprobs"}, - Common.getValueByPath(fromObject, new String[] {"avgLogprobs"})); + new String[] {"groundingMetadata"}, + Common.getValueByPath(fromObject, new String[] {"groundingMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) { Common.setValueByPath( toObject, - new String[] {"groundingMetadata"}, - Common.getValueByPath(fromObject, new String[] {"groundingMetadata"})); + new String[] {"avgLogprobs"}, + Common.getValueByPath(fromObject, new String[] {"avgLogprobs"})); } if (Common.getValueByPath(fromObject, new String[] {"index"}) != null) { @@ -1346,8 +1386,14 @@ ObjectNode getBatchJobParametersToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { - throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"authConfig"}, + authConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"authConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) { @@ -1363,14 +1409,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( - "excludeDomains parameter is not supported in Gemini API."); + "blockingConfidence parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( - "blockingConfidence parameter is not supported in Gemini API."); + "excludeDomains parameter is not supported in Gemini API."); } if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { @@ -1416,6 +1462,11 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { "outputCompressionQuality parameter is not supported in Gemini API."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"}))) { + throw new IllegalArgumentException( + "imageOutputOptions parameter is not supported in Gemini API."); + } + return toObject; } @@ -1726,6 +1777,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } + if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"partMetadata"}, + Common.getValueByPath(fromObject, new String[] {"partMetadata"})); + } + return toObject; } @@ -1797,6 +1855,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + googleMapsToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleMaps"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -1816,16 +1884,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - googleMapsToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -1843,6 +1901,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}))) { + throw new IllegalArgumentException( + "parallelAiSearch parameter is not supported in Gemini API."); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -1850,6 +1913,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + return toObject; } diff --git a/src/main/java/com/google/genai/Caches.java b/src/main/java/com/google/genai/Caches.java index ebaca35a322..10eff623ff2 100644 --- a/src/main/java/com/google/genai/Caches.java +++ b/src/main/java/com/google/genai/Caches.java @@ -59,6 +59,46 @@ public Caches(ApiClient apiClient) { this.apiClient = apiClient; } + @ExcludeFromGeneratedCoverageReport + ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"apiKey"}, + Common.getValueByPath(fromObject, new String[] {"apiKey"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) { + throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) { + throw new IllegalArgumentException("authType parameter is not supported in Gemini API."); + } + + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) { + throw new IllegalArgumentException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) { + throw new IllegalArgumentException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) { + throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) { + throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -107,6 +147,30 @@ ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"parts"}) != null) { + ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"parts"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(partToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"parts"}, result); + } + + if (Common.getValueByPath(fromObject, new String[] {"role"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"role"}, + Common.getValueByPath(fromObject, new String[] {"role"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode createCachedContentConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -210,18 +274,27 @@ ObjectNode createCachedContentConfigToVertex(JsonNode fromObject, ObjectNode par } if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"contents"}, - Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"}))); + ArrayNode keyArray = + (ArrayNode) + Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"})); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(contentToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(parentObject, new String[] {"contents"}, result); } if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { Common.setValueByPath( parentObject, new String[] {"systemInstruction"}, - Transformers.tContent( - Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))); + contentToVertex( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"tools"}) != null) { @@ -522,8 +595,14 @@ ObjectNode getCachedContentParametersToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { - throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"authConfig"}, + authConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"authConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) { @@ -539,14 +618,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( - "excludeDomains parameter is not supported in Gemini API."); + "blockingConfidence parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( - "blockingConfidence parameter is not supported in Gemini API."); + "excludeDomains parameter is not supported in Gemini API."); } if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { @@ -772,6 +851,100 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } + if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"partMetadata"}, + Common.getValueByPath(fromObject, new String[] {"partMetadata"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"mediaResolution"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mediaResolution"}, + Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"codeExecutionResult"}, + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"executableCode"}, + Common.getValueByPath(fromObject, new String[] {"executableCode"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fileData"}, + Common.getValueByPath(fromObject, new String[] {"fileData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionCall"}, + Common.getValueByPath(fromObject, new String[] {"functionCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionResponse"}, + Common.getValueByPath(fromObject, new String[] {"functionResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inlineData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inlineData"}, + Common.getValueByPath(fromObject, new String[] {"inlineData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"text"}, + Common.getValueByPath(fromObject, new String[] {"text"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thought"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thought"}, + Common.getValueByPath(fromObject, new String[] {"thought"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thoughtSignature"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thoughtSignature"}, + Common.getValueByPath(fromObject, new String[] {"thoughtSignature"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"videoMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"videoMetadata"}, + Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { + throw new IllegalArgumentException("partMetadata parameter is not supported in Vertex AI."); + } + return toObject; } @@ -819,6 +992,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + googleMapsToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleMaps"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -838,16 +1021,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - googleMapsToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -865,6 +1038,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}))) { + throw new IllegalArgumentException( + "parallelAiSearch parameter is not supported in Gemini API."); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -872,6 +1050,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + return toObject; } @@ -896,6 +1081,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { throw new IllegalArgumentException("fileSearch parameter is not supported in Vertex AI."); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -922,13 +1114,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath(toObject, new String[] {"functionDeclarations"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -943,6 +1128,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"parallelAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -950,6 +1142,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"mcpServers"}))) { + throw new IllegalArgumentException("mcpServers parameter is not supported in Vertex AI."); + } + return toObject; } diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 9e31bb32129..7972f11e59e 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.common.collect.ImmutableSet; /** Internal SDK converter functions. */ final class LiveConverters { @@ -31,6 +32,55 @@ public LiveConverters(ApiClient apiClient) { this.apiClient = apiClient; } + @ExcludeFromGeneratedCoverageReport + void thinkingLevelVertexEnumValidate(Object enumValue) { + ImmutableSet invalidEnumValues = ImmutableSet.of("MINIMAL", "MEDIUM"); + if (invalidEnumValues.contains(enumValue.toString().replace("\"", ""))) { + throw new IllegalArgumentException( + String.format("%s enum value is not supported in Vertex AI.", enumValue)); + } + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"apiKey"}, + Common.getValueByPath(fromObject, new String[] {"apiKey"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) { + throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) { + throw new IllegalArgumentException("authType parameter is not supported in Gemini API."); + } + + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) { + throw new IllegalArgumentException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) { + throw new IllegalArgumentException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) { + throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) { + throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -79,6 +129,30 @@ ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"parts"}) != null) { + ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"parts"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(partToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"parts"}, result); + } + + if (Common.getValueByPath(fromObject, new String[] {"role"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"role"}, + Common.getValueByPath(fromObject, new String[] {"role"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -328,7 +402,10 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.setValueByPath( toObject, new String[] {"thinkingConfig"}, - Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); + thinkingConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"topK"}) != null) { @@ -357,8 +434,14 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject @ExcludeFromGeneratedCoverageReport ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { - throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"authConfig"}, + authConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"authConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) { @@ -374,14 +457,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( - "excludeDomains parameter is not supported in Gemini API."); + "blockingConfidence parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( - "blockingConfidence parameter is not supported in Gemini API."); + "excludeDomains parameter is not supported in Gemini API."); } if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { @@ -418,6 +501,30 @@ ObjectNode liveClientContentToMldev(JsonNode fromObject, ObjectNode parentObject return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode liveClientContentToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"turns"}) != null) { + ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"turns"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(contentToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"turns"}, result); + } + + if (Common.getValueByPath(fromObject, new String[] {"turnComplete"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"turnComplete"}, + Common.getValueByPath(fromObject, new String[] {"turnComplete"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode liveClientMessageToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -488,7 +595,10 @@ ObjectNode liveClientMessageToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( toObject, new String[] {"clientContent"}, - Common.getValueByPath(fromObject, new String[] {"clientContent"})); + liveClientContentToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"clientContent"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"realtimeInput"}) != null) { @@ -757,8 +867,11 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject) Common.setValueByPath( toObject, new String[] {"systemInstruction"}, - Transformers.tContent( - Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))); + contentToVertex( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"tools"}) != null) { @@ -1043,7 +1156,10 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( parentObject, new String[] {"setup", "generationConfig", "thinkingConfig"}, - Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); + thinkingConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableAffectiveDialog"}) != null) { @@ -1057,8 +1173,11 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( parentObject, new String[] {"setup", "systemInstruction"}, - Transformers.tContent( - Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))); + contentToVertex( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"tools"}) != null) { @@ -1454,6 +1573,100 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } + if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"partMetadata"}, + Common.getValueByPath(fromObject, new String[] {"partMetadata"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"mediaResolution"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mediaResolution"}, + Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"codeExecutionResult"}, + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"executableCode"}, + Common.getValueByPath(fromObject, new String[] {"executableCode"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fileData"}, + Common.getValueByPath(fromObject, new String[] {"fileData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionCall"}, + Common.getValueByPath(fromObject, new String[] {"functionCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionResponse"}, + Common.getValueByPath(fromObject, new String[] {"functionResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inlineData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inlineData"}, + Common.getValueByPath(fromObject, new String[] {"inlineData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"text"}, + Common.getValueByPath(fromObject, new String[] {"text"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thought"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thought"}, + Common.getValueByPath(fromObject, new String[] {"thought"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thoughtSignature"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thoughtSignature"}, + Common.getValueByPath(fromObject, new String[] {"thoughtSignature"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"videoMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"videoMetadata"}, + Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { + throw new IllegalArgumentException("partMetadata parameter is not supported in Vertex AI."); + } + return toObject; } @@ -1474,6 +1687,35 @@ ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parent return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode thinkingConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"includeThoughts"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"includeThoughts"}, + Common.getValueByPath(fromObject, new String[] {"includeThoughts"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thinkingBudget"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thinkingBudget"}, + Common.getValueByPath(fromObject, new String[] {"thinkingBudget"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thinkingLevel"}) != null) { + thinkingLevelVertexEnumValidate( + Common.getValueByPath(fromObject, new String[] {"thinkingLevel"})); + Common.setValueByPath( + toObject, + new String[] {"thinkingLevel"}, + Common.getValueByPath(fromObject, new String[] {"thinkingLevel"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1495,6 +1737,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + googleMapsToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleMaps"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -1514,16 +1766,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - googleMapsToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -1541,6 +1783,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}))) { + throw new IllegalArgumentException( + "parallelAiSearch parameter is not supported in Gemini API."); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -1548,6 +1795,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + return toObject; } @@ -1572,6 +1826,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { throw new IllegalArgumentException("fileSearch parameter is not supported in Vertex AI."); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -1598,13 +1859,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath(toObject, new String[] {"functionDeclarations"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -1619,6 +1873,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"parallelAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -1626,6 +1887,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"mcpServers"}))) { + throw new IllegalArgumentException("mcpServers parameter is not supported in Vertex AI."); + } + return toObject; } diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 156c48e8891..397569232f1 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -125,6 +125,15 @@ void safetyFilterLevelMldevEnumValidate(Object enumValue) { } } + @ExcludeFromGeneratedCoverageReport + void thinkingLevelVertexEnumValidate(Object enumValue) { + ImmutableSet invalidEnumValues = ImmutableSet.of("MINIMAL", "MEDIUM"); + if (invalidEnumValues.contains(enumValue.toString().replace("\"", ""))) { + throw new IllegalArgumentException( + String.format("%s enum value is not supported in Vertex AI.", enumValue)); + } + } + @ExcludeFromGeneratedCoverageReport void videoGenerationReferenceTypeMldevEnumValidate(Object enumValue) { ImmutableSet invalidEnumValues = ImmutableSet.of("STYLE"); @@ -134,6 +143,46 @@ void videoGenerationReferenceTypeMldevEnumValidate(Object enumValue) { } } + @ExcludeFromGeneratedCoverageReport + ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"apiKey"}, + Common.getValueByPath(fromObject, new String[] {"apiKey"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) { + throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) { + throw new IllegalArgumentException("authType parameter is not supported in Gemini API."); + } + + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) { + throw new IllegalArgumentException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) { + throw new IllegalArgumentException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) { + throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) { + throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -192,18 +241,18 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"finishReason"})); } - if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) { Common.setValueByPath( toObject, - new String[] {"avgLogprobs"}, - Common.getValueByPath(fromObject, new String[] {"avgLogprobs"})); + new String[] {"groundingMetadata"}, + Common.getValueByPath(fromObject, new String[] {"groundingMetadata"})); } - if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) { + if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) { Common.setValueByPath( toObject, - new String[] {"groundingMetadata"}, - Common.getValueByPath(fromObject, new String[] {"groundingMetadata"})); + new String[] {"avgLogprobs"}, + Common.getValueByPath(fromObject, new String[] {"avgLogprobs"})); } if (Common.getValueByPath(fromObject, new String[] {"index"}) != null) { @@ -263,10 +312,16 @@ ObjectNode computeTokensParametersToVertex( } if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"contents"}, - Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"}))); + ArrayNode keyArray = + (ArrayNode) + Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"})); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(contentToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"contents"}, result); } return toObject; @@ -359,6 +414,30 @@ ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"parts"}) != null) { + ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"parts"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(partToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"parts"}, result); + } + + if (Common.getValueByPath(fromObject, new String[] {"role"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"role"}, + Common.getValueByPath(fromObject, new String[] {"role"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode controlReferenceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -408,8 +487,11 @@ ObjectNode countTokensConfigToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( parentObject, new String[] {"systemInstruction"}, - Transformers.tContent( - Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))); + contentToVertex( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"tools"}) != null) { @@ -485,10 +567,16 @@ ObjectNode countTokensParametersToVertex( } if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"contents"}, - Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"}))); + ArrayNode keyArray = + (ArrayNode) + Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"})); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(contentToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"contents"}, result); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -1391,8 +1479,11 @@ ObjectNode generateContentConfigToVertex( Common.setValueByPath( parentObject, new String[] {"systemInstruction"}, - Transformers.tContent( - Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))); + contentToVertex( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"temperature"}) != null) { @@ -1582,7 +1673,10 @@ ObjectNode generateContentConfigToVertex( Common.setValueByPath( toObject, new String[] {"thinkingConfig"}, - Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); + thinkingConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"imageConfig"}) != null) { @@ -1656,10 +1750,16 @@ ObjectNode generateContentParametersToVertex( } if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"contents"}, - Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"}))); + ArrayNode keyArray = + (ArrayNode) + Transformers.tContents(Common.getValueByPath(fromObject, new String[] {"contents"})); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(contentToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"contents"}, result); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -2998,7 +3098,10 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.setValueByPath( toObject, new String[] {"thinkingConfig"}, - Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})); + thinkingConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"thinkingConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"topK"}) != null) { @@ -3057,8 +3160,14 @@ ObjectNode getModelParametersToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { - throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"authConfig"}, + authConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"authConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) { @@ -3074,14 +3183,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( - "excludeDomains parameter is not supported in Gemini API."); + "blockingConfidence parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( - "blockingConfidence parameter is not supported in Gemini API."); + "excludeDomains parameter is not supported in Gemini API."); } if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { @@ -3127,6 +3236,11 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { "outputCompressionQuality parameter is not supported in Gemini API."); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"}))) { + throw new IllegalArgumentException( + "imageOutputOptions parameter is not supported in Gemini API."); + } + return toObject; } @@ -3168,6 +3282,13 @@ ObjectNode imageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"outputCompressionQuality"})); } + if (Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"imageOutputOptions"}, + Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"})); + } + return toObject; } @@ -3736,6 +3857,100 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } + if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"partMetadata"}, + Common.getValueByPath(fromObject, new String[] {"partMetadata"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"mediaResolution"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mediaResolution"}, + Common.getValueByPath(fromObject, new String[] {"mediaResolution"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"codeExecutionResult"}, + Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"executableCode"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"executableCode"}, + Common.getValueByPath(fromObject, new String[] {"executableCode"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fileData"}, + Common.getValueByPath(fromObject, new String[] {"fileData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionCall"}, + Common.getValueByPath(fromObject, new String[] {"functionCall"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"functionResponse"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"functionResponse"}, + Common.getValueByPath(fromObject, new String[] {"functionResponse"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inlineData"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inlineData"}, + Common.getValueByPath(fromObject, new String[] {"inlineData"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"text"}, + Common.getValueByPath(fromObject, new String[] {"text"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thought"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thought"}, + Common.getValueByPath(fromObject, new String[] {"thought"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thoughtSignature"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thoughtSignature"}, + Common.getValueByPath(fromObject, new String[] {"thoughtSignature"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"videoMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"videoMetadata"}, + Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partMetadata"}))) { + throw new IllegalArgumentException("partMetadata parameter is not supported in Vertex AI."); + } + return toObject; } @@ -4214,6 +4429,35 @@ ObjectNode segmentImageSourceToVertex(JsonNode fromObject, ObjectNode parentObje return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode thinkingConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"includeThoughts"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"includeThoughts"}, + Common.getValueByPath(fromObject, new String[] {"includeThoughts"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thinkingBudget"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"thinkingBudget"}, + Common.getValueByPath(fromObject, new String[] {"thinkingBudget"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"thinkingLevel"}) != null) { + thinkingLevelVertexEnumValidate( + Common.getValueByPath(fromObject, new String[] {"thinkingLevel"})); + Common.setValueByPath( + toObject, + new String[] {"thinkingLevel"}, + Common.getValueByPath(fromObject, new String[] {"thinkingLevel"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -4258,6 +4502,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + googleMapsToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleMaps"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -4277,16 +4531,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - googleMapsToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -4304,6 +4548,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}))) { + throw new IllegalArgumentException( + "parallelAiSearch parameter is not supported in Gemini API."); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -4311,6 +4560,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + return toObject; } @@ -4335,6 +4591,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { throw new IllegalArgumentException("fileSearch parameter is not supported in Vertex AI."); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + Common.getValueByPath(fromObject, new String[] {"googleMaps"})); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -4361,13 +4624,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.setValueByPath(toObject, new String[] {"functionDeclarations"}, result); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - Common.getValueByPath(fromObject, new String[] {"googleMaps"})); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -4382,6 +4638,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"parallelAiSearch"}, + Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"})); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -4389,6 +4652,10 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"mcpServers"}))) { + throw new IllegalArgumentException("mcpServers parameter is not supported in Vertex AI."); + } + return toObject; } diff --git a/src/main/java/com/google/genai/TokensConverters.java b/src/main/java/com/google/genai/TokensConverters.java index a3fca5225b7..f916130b060 100644 --- a/src/main/java/com/google/genai/TokensConverters.java +++ b/src/main/java/com/google/genai/TokensConverters.java @@ -31,6 +31,46 @@ public TokensConverters(ApiClient apiClient) { this.apiClient = apiClient; } + @ExcludeFromGeneratedCoverageReport + ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"apiKey"}, + Common.getValueByPath(fromObject, new String[] {"apiKey"})); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) { + throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) { + throw new IllegalArgumentException("authType parameter is not supported in Gemini API."); + } + + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) { + throw new IllegalArgumentException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) { + throw new IllegalArgumentException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) { + throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) { + throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -214,8 +254,14 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { - throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"authConfig"}, + authConfigToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"authConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) { @@ -231,14 +277,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { throw new IllegalArgumentException( - "excludeDomains parameter is not supported in Gemini API."); + "blockingConfidence parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) { + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( - "blockingConfidence parameter is not supported in Gemini API."); + "excludeDomains parameter is not supported in Gemini API."); } if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) { @@ -517,6 +563,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"videoMetadata"})); } + if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"partMetadata"}, + Common.getValueByPath(fromObject, new String[] {"partMetadata"})); + } + return toObject; } @@ -558,6 +611,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"fileSearch"})); } + if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"googleMaps"}, + googleMapsToMldev( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"googleMaps"})), + toObject)); + } + if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) { Common.setValueByPath( toObject, @@ -577,16 +640,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"functionDeclarations"})); } - if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"googleMaps"}, - googleMapsToMldev( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); - } - if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { Common.setValueByPath( toObject, @@ -604,6 +657,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"})); } + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"parallelAiSearch"}))) { + throw new IllegalArgumentException( + "parallelAiSearch parameter is not supported in Gemini API."); + } + if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { Common.setValueByPath( toObject, @@ -611,6 +669,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"urlContext"})); } + if (Common.getValueByPath(fromObject, new String[] {"mcpServers"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"mcpServers"}, + Common.getValueByPath(fromObject, new String[] {"mcpServers"})); + } + return toObject; } } diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index 25384775eb3..49df16de946 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -1012,6 +1012,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"customBaseModel"})); } + if (Common.getValueByPath(fromObject, new String[] {"evaluateDatasetRuns"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluateDatasetRuns"}, + Common.getValueByPath(fromObject, new String[] {"evaluateDatasetRuns"})); + } + if (Common.getValueByPath(fromObject, new String[] {"experiment"}) != null) { Common.setValueByPath( toObject, @@ -1019,6 +1026,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"experiment"})); } + if (Common.getValueByPath(fromObject, new String[] {"fullFineTuningSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fullFineTuningSpec"}, + Common.getValueByPath(fromObject, new String[] {"fullFineTuningSpec"})); + } + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { Common.setValueByPath( toObject, @@ -1054,6 +1068,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { 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) { Common.setValueByPath( toObject, diff --git a/src/main/java/com/google/genai/types/AggregationMetric.java b/src/main/java/com/google/genai/types/AggregationMetric.java new file mode 100644 index 00000000000..f9e156e4aab --- /dev/null +++ b/src/main/java/com/google/genai/types/AggregationMetric.java @@ -0,0 +1,135 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Aggregation metric. This enum is not supported in Gemini API. */ +public class AggregationMetric { + + /** Enum representing the known values for AggregationMetric. */ + public enum Known { + /** Unspecified aggregation metric. */ + AGGREGATION_METRIC_UNSPECIFIED, + + /** Average aggregation metric. Not supported for Pairwise metric. */ + AVERAGE, + + /** Mode aggregation metric. */ + MODE, + + /** Standard deviation aggregation metric. Not supported for pairwise metric. */ + STANDARD_DEVIATION, + + /** Variance aggregation metric. Not supported for pairwise metric. */ + VARIANCE, + + /** Minimum aggregation metric. Not supported for pairwise metric. */ + MINIMUM, + + /** Maximum aggregation metric. Not supported for pairwise metric. */ + MAXIMUM, + + /** Median aggregation metric. Not supported for pairwise metric. */ + MEDIAN, + + /** 90th percentile aggregation metric. Not supported for pairwise metric. */ + PERCENTILE_P90, + + /** 95th percentile aggregation metric. Not supported for pairwise metric. */ + PERCENTILE_P95, + + /** 99th percentile aggregation metric. Not supported for pairwise metric. */ + PERCENTILE_P99 + } + + private Known aggregationMetricEnum; + private final String value; + + @JsonCreator + public AggregationMetric(String value) { + this.value = value; + for (Known aggregationMetricEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(aggregationMetricEnum.toString(), value)) { + this.aggregationMetricEnum = aggregationMetricEnum; + break; + } + } + if (this.aggregationMetricEnum == null) { + this.aggregationMetricEnum = Known.AGGREGATION_METRIC_UNSPECIFIED; + } + } + + public AggregationMetric(Known knownValue) { + this.aggregationMetricEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof AggregationMetric)) { + return false; + } + + AggregationMetric other = (AggregationMetric) o; + + if (this.aggregationMetricEnum != Known.AGGREGATION_METRIC_UNSPECIFIED + && other.aggregationMetricEnum != Known.AGGREGATION_METRIC_UNSPECIFIED) { + return this.aggregationMetricEnum == other.aggregationMetricEnum; + } else if (this.aggregationMetricEnum == Known.AGGREGATION_METRIC_UNSPECIFIED + && other.aggregationMetricEnum == Known.AGGREGATION_METRIC_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.aggregationMetricEnum != Known.AGGREGATION_METRIC_UNSPECIFIED) { + return this.aggregationMetricEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.aggregationMetricEnum; + } +} diff --git a/src/main/java/com/google/genai/types/AggregationOutput.java b/src/main/java/com/google/genai/types/AggregationOutput.java new file mode 100644 index 00000000000..2d042663fbc --- /dev/null +++ b/src/main/java/com/google/genai/types/AggregationOutput.java @@ -0,0 +1,143 @@ +/* + * 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 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; + +/** + * The aggregation result for the entire dataset and all metrics. This data type is not supported in + * Gemini API. + */ +@AutoValue +@JsonDeserialize(builder = AggregationOutput.Builder.class) +public abstract class AggregationOutput extends JsonSerializable { + /** One AggregationResult per metric. */ + @JsonProperty("aggregationResults") + public abstract Optional> aggregationResults(); + + /** The dataset used for evaluation & aggregation. */ + @JsonProperty("dataset") + public abstract Optional dataset(); + + /** Instantiates a builder for AggregationOutput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AggregationOutput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AggregationOutput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AggregationOutput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AggregationOutput.Builder(); + } + + /** + * Setter for aggregationResults. + * + *

aggregationResults: One AggregationResult per metric. + */ + @JsonProperty("aggregationResults") + public abstract Builder aggregationResults(List aggregationResults); + + /** + * Setter for aggregationResults. + * + *

aggregationResults: One AggregationResult per metric. + */ + @CanIgnoreReturnValue + public Builder aggregationResults(AggregationResult... aggregationResults) { + return aggregationResults(Arrays.asList(aggregationResults)); + } + + /** + * Setter for aggregationResults builder. + * + *

aggregationResults: One AggregationResult per metric. + */ + @CanIgnoreReturnValue + public Builder aggregationResults(AggregationResult.Builder... aggregationResultsBuilders) { + return aggregationResults( + Arrays.asList(aggregationResultsBuilders).stream() + .map(AggregationResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder aggregationResults(Optional> aggregationResults); + + /** Clears the value of aggregationResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAggregationResults() { + return aggregationResults(Optional.empty()); + } + + /** + * Setter for dataset. + * + *

dataset: The dataset used for evaluation & aggregation. + */ + @JsonProperty("dataset") + public abstract Builder dataset(EvaluationDataset dataset); + + /** + * Setter for dataset builder. + * + *

dataset: The dataset used for evaluation & aggregation. + */ + @CanIgnoreReturnValue + public Builder dataset(EvaluationDataset.Builder datasetBuilder) { + return dataset(datasetBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder dataset(Optional dataset); + + /** Clears the value of dataset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDataset() { + return dataset(Optional.empty()); + } + + public abstract AggregationOutput build(); + } + + /** Deserializes a JSON string to a AggregationOutput object. */ + @ExcludeFromGeneratedCoverageReport + public static AggregationOutput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AggregationOutput.class); + } +} diff --git a/src/main/java/com/google/genai/types/AggregationResult.java b/src/main/java/com/google/genai/types/AggregationResult.java new file mode 100644 index 00000000000..92b6b0f4f40 --- /dev/null +++ b/src/main/java/com/google/genai/types/AggregationResult.java @@ -0,0 +1,298 @@ +/* + * 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; + +/** The aggregation result for a single metric. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = AggregationResult.Builder.class) +public abstract class AggregationResult extends JsonSerializable { + /** Aggregation metric. */ + @JsonProperty("aggregationMetric") + public abstract Optional aggregationMetric(); + + /** Results for bleu metric. */ + @JsonProperty("bleuMetricValue") + public abstract Optional bleuMetricValue(); + + /** Result for code execution metric. */ + @JsonProperty("customCodeExecutionResult") + public abstract Optional customCodeExecutionResult(); + + /** Results for exact match metric. */ + @JsonProperty("exactMatchMetricValue") + public abstract Optional exactMatchMetricValue(); + + /** Result for pairwise metric. */ + @JsonProperty("pairwiseMetricResult") + public abstract Optional pairwiseMetricResult(); + + /** Result for pointwise metric. */ + @JsonProperty("pointwiseMetricResult") + public abstract Optional pointwiseMetricResult(); + + /** Results for rouge metric. */ + @JsonProperty("rougeMetricValue") + public abstract Optional rougeMetricValue(); + + /** Instantiates a builder for AggregationResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AggregationResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AggregationResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AggregationResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AggregationResult.Builder(); + } + + /** + * Setter for aggregationMetric. + * + *

aggregationMetric: Aggregation metric. + */ + @JsonProperty("aggregationMetric") + public abstract Builder aggregationMetric(AggregationMetric aggregationMetric); + + @ExcludeFromGeneratedCoverageReport + abstract Builder aggregationMetric(Optional aggregationMetric); + + /** Clears the value of aggregationMetric field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAggregationMetric() { + return aggregationMetric(Optional.empty()); + } + + /** + * Setter for aggregationMetric given a known enum. + * + *

aggregationMetric: Aggregation metric. + */ + @CanIgnoreReturnValue + public Builder aggregationMetric(AggregationMetric.Known knownType) { + return aggregationMetric(new AggregationMetric(knownType)); + } + + /** + * Setter for aggregationMetric given a string. + * + *

aggregationMetric: Aggregation metric. + */ + @CanIgnoreReturnValue + public Builder aggregationMetric(String aggregationMetric) { + return aggregationMetric(new AggregationMetric(aggregationMetric)); + } + + /** + * Setter for bleuMetricValue. + * + *

bleuMetricValue: Results for bleu metric. + */ + @JsonProperty("bleuMetricValue") + public abstract Builder bleuMetricValue(BleuMetricValue bleuMetricValue); + + /** + * Setter for bleuMetricValue builder. + * + *

bleuMetricValue: Results for bleu metric. + */ + @CanIgnoreReturnValue + public Builder bleuMetricValue(BleuMetricValue.Builder bleuMetricValueBuilder) { + return bleuMetricValue(bleuMetricValueBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bleuMetricValue(Optional bleuMetricValue); + + /** Clears the value of bleuMetricValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBleuMetricValue() { + return bleuMetricValue(Optional.empty()); + } + + /** + * Setter for customCodeExecutionResult. + * + *

customCodeExecutionResult: Result for code execution metric. + */ + @JsonProperty("customCodeExecutionResult") + public abstract Builder customCodeExecutionResult( + CustomCodeExecutionResult customCodeExecutionResult); + + /** + * Setter for customCodeExecutionResult builder. + * + *

customCodeExecutionResult: Result for code execution metric. + */ + @CanIgnoreReturnValue + public Builder customCodeExecutionResult( + CustomCodeExecutionResult.Builder customCodeExecutionResultBuilder) { + return customCodeExecutionResult(customCodeExecutionResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customCodeExecutionResult( + Optional customCodeExecutionResult); + + /** Clears the value of customCodeExecutionResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomCodeExecutionResult() { + return customCodeExecutionResult(Optional.empty()); + } + + /** + * Setter for exactMatchMetricValue. + * + *

exactMatchMetricValue: Results for exact match metric. + */ + @JsonProperty("exactMatchMetricValue") + public abstract Builder exactMatchMetricValue(ExactMatchMetricValue exactMatchMetricValue); + + /** + * Setter for exactMatchMetricValue builder. + * + *

exactMatchMetricValue: Results for exact match metric. + */ + @CanIgnoreReturnValue + public Builder exactMatchMetricValue( + ExactMatchMetricValue.Builder exactMatchMetricValueBuilder) { + return exactMatchMetricValue(exactMatchMetricValueBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exactMatchMetricValue(Optional exactMatchMetricValue); + + /** Clears the value of exactMatchMetricValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExactMatchMetricValue() { + return exactMatchMetricValue(Optional.empty()); + } + + /** + * Setter for pairwiseMetricResult. + * + *

pairwiseMetricResult: Result for pairwise metric. + */ + @JsonProperty("pairwiseMetricResult") + public abstract Builder pairwiseMetricResult(PairwiseMetricResult pairwiseMetricResult); + + /** + * Setter for pairwiseMetricResult builder. + * + *

pairwiseMetricResult: Result for pairwise metric. + */ + @CanIgnoreReturnValue + public Builder pairwiseMetricResult(PairwiseMetricResult.Builder pairwiseMetricResultBuilder) { + return pairwiseMetricResult(pairwiseMetricResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pairwiseMetricResult(Optional pairwiseMetricResult); + + /** Clears the value of pairwiseMetricResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPairwiseMetricResult() { + return pairwiseMetricResult(Optional.empty()); + } + + /** + * Setter for pointwiseMetricResult. + * + *

pointwiseMetricResult: Result for pointwise metric. + */ + @JsonProperty("pointwiseMetricResult") + public abstract Builder pointwiseMetricResult(PointwiseMetricResult pointwiseMetricResult); + + /** + * Setter for pointwiseMetricResult builder. + * + *

pointwiseMetricResult: Result for pointwise metric. + */ + @CanIgnoreReturnValue + public Builder pointwiseMetricResult( + PointwiseMetricResult.Builder pointwiseMetricResultBuilder) { + return pointwiseMetricResult(pointwiseMetricResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pointwiseMetricResult(Optional pointwiseMetricResult); + + /** Clears the value of pointwiseMetricResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPointwiseMetricResult() { + return pointwiseMetricResult(Optional.empty()); + } + + /** + * Setter for rougeMetricValue. + * + *

rougeMetricValue: Results for rouge metric. + */ + @JsonProperty("rougeMetricValue") + public abstract Builder rougeMetricValue(RougeMetricValue rougeMetricValue); + + /** + * Setter for rougeMetricValue builder. + * + *

rougeMetricValue: Results for rouge metric. + */ + @CanIgnoreReturnValue + public Builder rougeMetricValue(RougeMetricValue.Builder rougeMetricValueBuilder) { + return rougeMetricValue(rougeMetricValueBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rougeMetricValue(Optional rougeMetricValue); + + /** Clears the value of rougeMetricValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRougeMetricValue() { + return rougeMetricValue(Optional.empty()); + } + + public abstract AggregationResult build(); + } + + /** Deserializes a JSON string to a AggregationResult object. */ + @ExcludeFromGeneratedCoverageReport + public static AggregationResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AggregationResult.class); + } +} diff --git a/src/main/java/com/google/genai/types/AuthConfig.java b/src/main/java/com/google/genai/types/AuthConfig.java index 828a84267cb..82c66ea34e2 100644 --- a/src/main/java/com/google/genai/types/AuthConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfig.java @@ -26,10 +26,17 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Auth configuration to run the extension. This data type is not supported in Gemini API. */ +/** The authentication config to access the API. */ @AutoValue @JsonDeserialize(builder = AuthConfig.Builder.class) public abstract class AuthConfig extends JsonSerializable { + /** + * The authentication config to access the API. Only API key is supported. This field is not + * supported in Gemini API. + */ + @JsonProperty("apiKey") + public abstract Optional apiKey(); + /** Config for API key auth. */ @JsonProperty("apiKeyConfig") public abstract Optional apiKeyConfig(); @@ -72,6 +79,25 @@ private static Builder create() { return new AutoValue_AuthConfig.Builder(); } + /** + * Setter for apiKey. + * + *

apiKey: The authentication config to access the API. Only API key is supported. This field + * is not supported in Gemini API. + */ + @JsonProperty("apiKey") + public abstract Builder apiKey(String apiKey); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiKey(Optional apiKey); + + /** Clears the value of apiKey field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiKey() { + return apiKey(Optional.empty()); + } + /** * Setter for apiKeyConfig. * diff --git a/src/main/java/com/google/genai/types/BigQuerySource.java b/src/main/java/com/google/genai/types/BigQuerySource.java new file mode 100644 index 00000000000..06eb95f7702 --- /dev/null +++ b/src/main/java/com/google/genai/types/BigQuerySource.java @@ -0,0 +1,85 @@ +/* + * 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; + +/** The BigQuery location for the input content. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = BigQuerySource.Builder.class) +public abstract class BigQuerySource extends JsonSerializable { + /** + * Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. + * For example: `bq://projectId.bqDatasetId.bqTableId`. + */ + @JsonProperty("inputUri") + public abstract Optional inputUri(); + + /** Instantiates a builder for BigQuerySource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BigQuerySource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BigQuerySource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BigQuerySource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BigQuerySource.Builder(); + } + + /** + * Setter for inputUri. + * + *

inputUri: Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * + * BigQuery path. For example: `bq://projectId.bqDatasetId.bqTableId`. + */ + @JsonProperty("inputUri") + public abstract Builder inputUri(String inputUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputUri(Optional inputUri); + + /** Clears the value of inputUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputUri() { + return inputUri(Optional.empty()); + } + + public abstract BigQuerySource build(); + } + + /** Deserializes a JSON string to a BigQuerySource object. */ + @ExcludeFromGeneratedCoverageReport + public static BigQuerySource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BigQuerySource.class); + } +} diff --git a/src/main/java/com/google/genai/types/BleuMetricValue.java b/src/main/java/com/google/genai/types/BleuMetricValue.java new file mode 100644 index 00000000000..695092bb30b --- /dev/null +++ b/src/main/java/com/google/genai/types/BleuMetricValue.java @@ -0,0 +1,81 @@ +/* + * 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; + +/** Bleu metric value for an instance. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = BleuMetricValue.Builder.class) +public abstract class BleuMetricValue extends JsonSerializable { + /** Output only. Bleu score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for BleuMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BleuMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BleuMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BleuMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BleuMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Bleu score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract BleuMetricValue build(); + } + + /** Deserializes a JSON string to a BleuMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static BleuMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BleuMetricValue.class); + } +} diff --git a/src/main/java/com/google/genai/types/Blob.java b/src/main/java/com/google/genai/types/Blob.java index 6baa096c8bb..c8fbbd16aa2 100644 --- a/src/main/java/com/google/genai/types/Blob.java +++ b/src/main/java/com/google/genai/types/Blob.java @@ -26,19 +26,22 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Content blob. */ +/** + * A content blob. A Blob contains data of a specific media type. It is used to represent images, + * audio, and video. + */ @AutoValue @JsonDeserialize(builder = Blob.Builder.class) public abstract class Blob extends JsonSerializable { - /** Required. Raw bytes. */ + /** Required. The raw bytes of the data. */ @JsonProperty("data") public abstract Optional data(); /** - * Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. - * This field is only returned in PromptMessage for prompt management. It is currently used in the - * Gemini GenerateContent calls only when server side tools (code_execution, google_search, and - * url_context) are enabled. This field is not supported in Gemini API. + * Optional. The display name of the blob. Used to provide a label or filename to distinguish + * blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the + * Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) + * are enabled. This field is not supported in Gemini API. */ @JsonProperty("displayName") public abstract Optional displayName(); @@ -68,7 +71,7 @@ private static Builder create() { /** * Setter for data. * - *

data: Required. Raw bytes. + *

data: Required. The raw bytes of the data. */ @JsonProperty("data") public abstract Builder data(byte[] data); @@ -86,11 +89,10 @@ public Builder clearData() { /** * Setter for displayName. * - *

displayName: Optional. Display name of the blob. Used to provide a label or filename to - * distinguish blobs. This field is only returned in PromptMessage for prompt management. It is - * currently used in the Gemini GenerateContent calls only when server side tools - * (code_execution, google_search, and url_context) are enabled. This field is not supported in - * Gemini API. + *

displayName: Optional. The display name of the blob. Used to provide a label or filename + * to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. + * It is used in the Gemini calls only when server-side tools (`code_execution`, + * `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API. */ @JsonProperty("displayName") public abstract Builder displayName(String displayName); diff --git a/src/main/java/com/google/genai/types/Candidate.java b/src/main/java/com/google/genai/types/Candidate.java index 63c0ee71bd0..c62033a3165 100644 --- a/src/main/java/com/google/genai/types/Candidate.java +++ b/src/main/java/com/google/genai/types/Candidate.java @@ -57,30 +57,48 @@ public abstract class Candidate extends JsonSerializable { @JsonProperty("finishReason") public abstract Optional finishReason(); - /** Output only. Average log probability score of the candidate. */ - @JsonProperty("avgLogprobs") - public abstract Optional avgLogprobs(); - - /** Output only. Metadata specifies sources used to ground generated content. */ + /** + * Output only. Grounding metadata for the candidate. + * + *

This field is populated for `GenerateContent` calls. + */ @JsonProperty("groundingMetadata") public abstract Optional groundingMetadata(); - /** Output only. Index of the candidate. */ + /** + * Output only. The average log probability of the tokens in this candidate. This is a + * length-normalized score that can be used to compare the quality of candidates of different + * lengths. A higher average log probability suggests a more confident and coherent response. + */ + @JsonProperty("avgLogprobs") + public abstract Optional avgLogprobs(); + + /** + * Output only. The 0-based index of this candidate in the list of generated responses. This is + * useful for distinguishing between multiple candidates when `candidate_count` > 1. + */ @JsonProperty("index") public abstract Optional index(); - /** Output only. Log-likelihood scores for the response tokens and top tokens */ + /** + * Output only. The detailed log probability information for the tokens in this candidate. This is + * useful for debugging, understanding model uncertainty, and identifying potential + * "hallucinations". + */ @JsonProperty("logprobsResult") public abstract Optional logprobsResult(); /** - * Output only. List of ratings for the safety of a response candidate. There is at most one + * Output only. A list of ratings for the safety of a response candidate. There is at most one * rating per category. */ @JsonProperty("safetyRatings") public abstract Optional> safetyRatings(); - /** Output only. Metadata related to url context retrieval tool. */ + /** + * Output only. Metadata returned when the model uses the `url_context` tool to get information + * from a user-provided URL. + */ @JsonProperty("urlContextMetadata") public abstract Optional urlContextMetadata(); @@ -235,29 +253,12 @@ public Builder finishReason(String finishReason) { return finishReason(new FinishReason(finishReason)); } - /** - * Setter for avgLogprobs. - * - *

avgLogprobs: Output only. Average log probability score of the candidate. - */ - @JsonProperty("avgLogprobs") - public abstract Builder avgLogprobs(Double avgLogprobs); - - @ExcludeFromGeneratedCoverageReport - abstract Builder avgLogprobs(Optional avgLogprobs); - - /** Clears the value of avgLogprobs field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearAvgLogprobs() { - return avgLogprobs(Optional.empty()); - } - /** * Setter for groundingMetadata. * - *

groundingMetadata: Output only. Metadata specifies sources used to ground generated - * content. + *

groundingMetadata: Output only. Grounding metadata for the candidate. + * + *

This field is populated for `GenerateContent` calls. */ @JsonProperty("groundingMetadata") public abstract Builder groundingMetadata(GroundingMetadata groundingMetadata); @@ -265,8 +266,9 @@ public Builder clearAvgLogprobs() { /** * Setter for groundingMetadata builder. * - *

groundingMetadata: Output only. Metadata specifies sources used to ground generated - * content. + *

groundingMetadata: Output only. Grounding metadata for the candidate. + * + *

This field is populated for `GenerateContent` calls. */ @CanIgnoreReturnValue public Builder groundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder) { @@ -283,10 +285,33 @@ public Builder clearGroundingMetadata() { return groundingMetadata(Optional.empty()); } + /** + * Setter for avgLogprobs. + * + *

avgLogprobs: Output only. The average log probability of the tokens in this candidate. + * This is a length-normalized score that can be used to compare the quality of candidates of + * different lengths. A higher average log probability suggests a more confident and coherent + * response. + */ + @JsonProperty("avgLogprobs") + public abstract Builder avgLogprobs(Double avgLogprobs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder avgLogprobs(Optional avgLogprobs); + + /** Clears the value of avgLogprobs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAvgLogprobs() { + return avgLogprobs(Optional.empty()); + } + /** * Setter for index. * - *

index: Output only. Index of the candidate. + *

index: Output only. The 0-based index of this candidate in the list of generated + * responses. This is useful for distinguishing between multiple candidates when + * `candidate_count` > 1. */ @JsonProperty("index") public abstract Builder index(Integer index); @@ -304,7 +329,9 @@ public Builder clearIndex() { /** * Setter for logprobsResult. * - *

logprobsResult: Output only. Log-likelihood scores for the response tokens and top tokens + *

logprobsResult: Output only. The detailed log probability information for the tokens in + * this candidate. This is useful for debugging, understanding model uncertainty, and + * identifying potential "hallucinations". */ @JsonProperty("logprobsResult") public abstract Builder logprobsResult(LogprobsResult logprobsResult); @@ -312,7 +339,9 @@ public Builder clearIndex() { /** * Setter for logprobsResult builder. * - *

logprobsResult: Output only. Log-likelihood scores for the response tokens and top tokens + *

logprobsResult: Output only. The detailed log probability information for the tokens in + * this candidate. This is useful for debugging, understanding model uncertainty, and + * identifying potential "hallucinations". */ @CanIgnoreReturnValue public Builder logprobsResult(LogprobsResult.Builder logprobsResultBuilder) { @@ -332,8 +361,8 @@ public Builder clearLogprobsResult() { /** * Setter for safetyRatings. * - *

safetyRatings: Output only. List of ratings for the safety of a response candidate. There - * is at most one rating per category. + *

safetyRatings: Output only. A list of ratings for the safety of a response candidate. + * There is at most one rating per category. */ @JsonProperty("safetyRatings") public abstract Builder safetyRatings(List safetyRatings); @@ -341,8 +370,8 @@ public Builder clearLogprobsResult() { /** * Setter for safetyRatings. * - *

safetyRatings: Output only. List of ratings for the safety of a response candidate. There - * is at most one rating per category. + *

safetyRatings: Output only. A list of ratings for the safety of a response candidate. + * There is at most one rating per category. */ @CanIgnoreReturnValue public Builder safetyRatings(SafetyRating... safetyRatings) { @@ -352,8 +381,8 @@ public Builder safetyRatings(SafetyRating... safetyRatings) { /** * Setter for safetyRatings builder. * - *

safetyRatings: Output only. List of ratings for the safety of a response candidate. There - * is at most one rating per category. + *

safetyRatings: Output only. A list of ratings for the safety of a response candidate. + * There is at most one rating per category. */ @CanIgnoreReturnValue public Builder safetyRatings(SafetyRating.Builder... safetyRatingsBuilders) { @@ -376,7 +405,8 @@ public Builder clearSafetyRatings() { /** * Setter for urlContextMetadata. * - *

urlContextMetadata: Output only. Metadata related to url context retrieval tool. + *

urlContextMetadata: Output only. Metadata returned when the model uses the `url_context` + * tool to get information from a user-provided URL. */ @JsonProperty("urlContextMetadata") public abstract Builder urlContextMetadata(UrlContextMetadata urlContextMetadata); @@ -384,7 +414,8 @@ public Builder clearSafetyRatings() { /** * Setter for urlContextMetadata builder. * - *

urlContextMetadata: Output only. Metadata related to url context retrieval tool. + *

urlContextMetadata: Output only. Metadata returned when the model uses the `url_context` + * tool to get information from a user-provided URL. */ @CanIgnoreReturnValue public Builder urlContextMetadata(UrlContextMetadata.Builder urlContextMetadataBuilder) { diff --git a/src/main/java/com/google/genai/types/Citation.java b/src/main/java/com/google/genai/types/Citation.java index 4c2877a5c1c..38175b0b581 100644 --- a/src/main/java/com/google/genai/types/Citation.java +++ b/src/main/java/com/google/genai/types/Citation.java @@ -26,31 +26,31 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Source attributions for content. This data type is not supported in Gemini API. */ +/** A citation for a piece of generatedcontent. This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = Citation.Builder.class) public abstract class Citation extends JsonSerializable { - /** Output only. End index into the content. */ + /** Output only. The end index of the citation in the content. */ @JsonProperty("endIndex") public abstract Optional endIndex(); - /** Output only. License of the attribution. */ + /** Output only. The license of the source of the citation. */ @JsonProperty("license") public abstract Optional license(); - /** Output only. Publication date of the attribution. */ + /** Output only. The publication date of the source of the citation. */ @JsonProperty("publicationDate") public abstract Optional publicationDate(); - /** Output only. Start index into the content. */ + /** Output only. The start index of the citation in the content. */ @JsonProperty("startIndex") public abstract Optional startIndex(); - /** Output only. Title of the attribution. */ + /** Output only. The title of the source of the citation. */ @JsonProperty("title") public abstract Optional title(); - /** Output only. Url reference of the attribution. */ + /** Output only. The URI of the source of the citation. */ @JsonProperty("uri") public abstract Optional uri(); @@ -75,7 +75,7 @@ private static Builder create() { /** * Setter for endIndex. * - *

endIndex: Output only. End index into the content. + *

endIndex: Output only. The end index of the citation in the content. */ @JsonProperty("endIndex") public abstract Builder endIndex(Integer endIndex); @@ -93,7 +93,7 @@ public Builder clearEndIndex() { /** * Setter for license. * - *

license: Output only. License of the attribution. + *

license: Output only. The license of the source of the citation. */ @JsonProperty("license") public abstract Builder license(String license); @@ -111,7 +111,7 @@ public Builder clearLicense() { /** * Setter for publicationDate. * - *

publicationDate: Output only. Publication date of the attribution. + *

publicationDate: Output only. The publication date of the source of the citation. */ @JsonProperty("publicationDate") public abstract Builder publicationDate(GoogleTypeDate publicationDate); @@ -119,7 +119,7 @@ public Builder clearLicense() { /** * Setter for publicationDate builder. * - *

publicationDate: Output only. Publication date of the attribution. + *

publicationDate: Output only. The publication date of the source of the citation. */ @CanIgnoreReturnValue public Builder publicationDate(GoogleTypeDate.Builder publicationDateBuilder) { @@ -139,7 +139,7 @@ public Builder clearPublicationDate() { /** * Setter for startIndex. * - *

startIndex: Output only. Start index into the content. + *

startIndex: Output only. The start index of the citation in the content. */ @JsonProperty("startIndex") public abstract Builder startIndex(Integer startIndex); @@ -157,7 +157,7 @@ public Builder clearStartIndex() { /** * Setter for title. * - *

title: Output only. Title of the attribution. + *

title: Output only. The title of the source of the citation. */ @JsonProperty("title") public abstract Builder title(String title); @@ -175,7 +175,7 @@ public Builder clearTitle() { /** * Setter for uri. * - *

uri: Output only. Url reference of the attribution. + *

uri: Output only. The URI of the source of the citation. */ @JsonProperty("uri") public abstract Builder uri(String uri); diff --git a/src/main/java/com/google/genai/types/Content.java b/src/main/java/com/google/genai/types/Content.java index e8fa5d92919..3107d7a9e08 100644 --- a/src/main/java/com/google/genai/types/Content.java +++ b/src/main/java/com/google/genai/types/Content.java @@ -44,8 +44,8 @@ public abstract class Content extends JsonSerializable { public abstract Optional> parts(); /** - * Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for - * multi-turn conversations, otherwise can be left blank or unset. + * Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the + * service will default to 'user'. */ @JsonProperty("role") public abstract Optional role(); @@ -115,8 +115,8 @@ public Builder clearParts() { /** * Setter for role. * - *

role: Optional. The producer of the content. Must be either 'user' or 'model'. Useful to - * set for multi-turn conversations, otherwise can be left blank or unset. + *

role: Optional. The producer of the content. Must be either 'user' or 'model'. If not set, + * the service will default to 'user'. */ @JsonProperty("role") public abstract Builder role(String role); diff --git a/src/main/java/com/google/genai/types/CustomCodeExecutionResult.java b/src/main/java/com/google/genai/types/CustomCodeExecutionResult.java new file mode 100644 index 00000000000..f3a740e13e5 --- /dev/null +++ b/src/main/java/com/google/genai/types/CustomCodeExecutionResult.java @@ -0,0 +1,81 @@ +/* + * 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; + +/** Result for custom code execution metric. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = CustomCodeExecutionResult.Builder.class) +public abstract class CustomCodeExecutionResult extends JsonSerializable { + /** Output only. Custom code execution score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for CustomCodeExecutionResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomCodeExecutionResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomCodeExecutionResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomCodeExecutionResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomCodeExecutionResult.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Custom code execution score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract CustomCodeExecutionResult build(); + } + + /** Deserializes a JSON string to a CustomCodeExecutionResult object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomCodeExecutionResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomCodeExecutionResult.class); + } +} diff --git a/src/main/java/com/google/genai/types/CustomOutput.java b/src/main/java/com/google/genai/types/CustomOutput.java new file mode 100644 index 00000000000..6ab960e0dc9 --- /dev/null +++ b/src/main/java/com/google/genai/types/CustomOutput.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for custom output. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = CustomOutput.Builder.class) +public abstract class CustomOutput extends JsonSerializable { + /** Output only. List of raw output strings. */ + @JsonProperty("rawOutputs") + public abstract Optional rawOutputs(); + + /** Instantiates a builder for CustomOutput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomOutput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomOutput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomOutput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomOutput.Builder(); + } + + /** + * Setter for rawOutputs. + * + *

rawOutputs: Output only. List of raw output strings. + */ + @JsonProperty("rawOutputs") + public abstract Builder rawOutputs(RawOutput rawOutputs); + + /** + * Setter for rawOutputs builder. + * + *

rawOutputs: Output only. List of raw output strings. + */ + @CanIgnoreReturnValue + public Builder rawOutputs(RawOutput.Builder rawOutputsBuilder) { + return rawOutputs(rawOutputsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawOutputs(Optional rawOutputs); + + /** Clears the value of rawOutputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawOutputs() { + return rawOutputs(Optional.empty()); + } + + public abstract CustomOutput build(); + } + + /** Deserializes a JSON string to a CustomOutput object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomOutput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomOutput.class); + } +} diff --git a/src/main/java/com/google/genai/types/DatasetStats.java b/src/main/java/com/google/genai/types/DatasetStats.java index 5c55d877c8e..2affb7e1f9f 100644 --- a/src/main/java/com/google/genai/types/DatasetStats.java +++ b/src/main/java/com/google/genai/types/DatasetStats.java @@ -34,6 +34,17 @@ @AutoValue @JsonDeserialize(builder = DatasetStats.Builder.class) public abstract class DatasetStats extends JsonSerializable { + /** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */ + @JsonProperty("droppedExampleIndices") + public abstract Optional> droppedExampleIndices(); + + /** + * Output only. For each index in `dropped_example_indices`, the user-facing reason why the + * example was dropped. + */ + @JsonProperty("droppedExampleReasons") + public abstract Optional> droppedExampleReasons(); + /** Output only. Number of billable characters in the tuning dataset. */ @JsonProperty("totalBillableCharacterCount") public abstract Optional totalBillableCharacterCount(); @@ -84,6 +95,66 @@ private static Builder create() { return new AutoValue_DatasetStats.Builder(); } + /** + * Setter for droppedExampleIndices. + * + *

droppedExampleIndices: Output only. A partial sample of the indices (starting from 1) of + * the dropped examples. + */ + @JsonProperty("droppedExampleIndices") + public abstract Builder droppedExampleIndices(List droppedExampleIndices); + + /** + * Setter for droppedExampleIndices. + * + *

droppedExampleIndices: Output only. A partial sample of the indices (starting from 1) of + * the dropped examples. + */ + @CanIgnoreReturnValue + public Builder droppedExampleIndices(Long... droppedExampleIndices) { + return droppedExampleIndices(Arrays.asList(droppedExampleIndices)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder droppedExampleIndices(Optional> droppedExampleIndices); + + /** Clears the value of droppedExampleIndices field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDroppedExampleIndices() { + return droppedExampleIndices(Optional.empty()); + } + + /** + * Setter for droppedExampleReasons. + * + *

droppedExampleReasons: Output only. For each index in `dropped_example_indices`, the + * user-facing reason why the example was dropped. + */ + @JsonProperty("droppedExampleReasons") + public abstract Builder droppedExampleReasons(List droppedExampleReasons); + + /** + * Setter for droppedExampleReasons. + * + *

droppedExampleReasons: Output only. For each index in `dropped_example_indices`, the + * user-facing reason why the example was dropped. + */ + @CanIgnoreReturnValue + public Builder droppedExampleReasons(String... droppedExampleReasons) { + return droppedExampleReasons(Arrays.asList(droppedExampleReasons)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder droppedExampleReasons(Optional> droppedExampleReasons); + + /** Clears the value of droppedExampleReasons field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDroppedExampleReasons() { + return droppedExampleReasons(Optional.empty()); + } + /** * Setter for totalBillableCharacterCount. * diff --git a/src/main/java/com/google/genai/types/DistillationDataStats.java b/src/main/java/com/google/genai/types/DistillationDataStats.java index 613fbb7cb79..719a491e653 100644 --- a/src/main/java/com/google/genai/types/DistillationDataStats.java +++ b/src/main/java/com/google/genai/types/DistillationDataStats.java @@ -27,8 +27,8 @@ import java.util.Optional; /** - * Statistics computed for datasets used for distillation. This data type is not supported in Gemini - * API. + * Statistics for distillation prompt dataset. These statistics do not include the responses sampled + * from the teacher model. This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = DistillationDataStats.Builder.class) diff --git a/src/main/java/com/google/genai/types/EncryptionSpec.java b/src/main/java/com/google/genai/types/EncryptionSpec.java index 062e48b318d..947f7b26303 100644 --- a/src/main/java/com/google/genai/types/EncryptionSpec.java +++ b/src/main/java/com/google/genai/types/EncryptionSpec.java @@ -27,17 +27,16 @@ import java.util.Optional; /** - * Represents a customer-managed encryption key spec that can be applied to a top-level resource. - * This data type is not supported in Gemini API. + * Represents a customer-managed encryption key specification that can be applied to a Vertex AI + * resource. This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = EncryptionSpec.Builder.class) public abstract class EncryptionSpec extends JsonSerializable { /** - * Required. The Cloud KMS resource identifier of the customer managed encryption key used to - * protect a resource. Has the form: - * `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. The key needs to be - * in the same region as where the compute resource is created. + * Required. Resource name of the Cloud KMS key used to protect the resource. The Cloud KMS key + * must be in the same region as the resource. It must have the format + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. */ @JsonProperty("kmsKeyName") public abstract Optional kmsKeyName(); @@ -63,10 +62,9 @@ private static Builder create() { /** * Setter for kmsKeyName. * - *

kmsKeyName: Required. The Cloud KMS resource identifier of the customer managed encryption - * key used to protect a resource. Has the form: - * `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. The key needs to - * be in the same region as where the compute resource is created. + *

kmsKeyName: Required. Resource name of the Cloud KMS key used to protect the resource. The + * Cloud KMS key must be in the same region as the resource. It must have the format + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. */ @JsonProperty("kmsKeyName") public abstract Builder kmsKeyName(String kmsKeyName); diff --git a/src/main/java/com/google/genai/types/EnterpriseWebSearch.java b/src/main/java/com/google/genai/types/EnterpriseWebSearch.java index 4cb884ba065..d198d0703c7 100644 --- a/src/main/java/com/google/genai/types/EnterpriseWebSearch.java +++ b/src/main/java/com/google/genai/types/EnterpriseWebSearch.java @@ -35,13 +35,6 @@ @AutoValue @JsonDeserialize(builder = EnterpriseWebSearch.Builder.class) public abstract class EnterpriseWebSearch extends JsonSerializable { - /** - * Optional. List of domains to be excluded from the search results. The default limit is 2000 - * domains. - */ - @JsonProperty("excludeDomains") - public abstract Optional> excludeDomains(); - /** * Optional. Sites with confidence level chosen & above this value will be blocked from the search * results. @@ -49,6 +42,13 @@ public abstract class EnterpriseWebSearch extends JsonSerializable { @JsonProperty("blockingConfidence") public abstract Optional blockingConfidence(); + /** + * Optional. List of domains to be excluded from the search results. The default limit is 2000 + * domains. + */ + @JsonProperty("excludeDomains") + public abstract Optional> excludeDomains(); + /** Instantiates a builder for EnterpriseWebSearch. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -67,36 +67,6 @@ private static Builder create() { return new AutoValue_EnterpriseWebSearch.Builder(); } - /** - * Setter for excludeDomains. - * - *

excludeDomains: Optional. List of domains to be excluded from the search results. The - * default limit is 2000 domains. - */ - @JsonProperty("excludeDomains") - public abstract Builder excludeDomains(List excludeDomains); - - /** - * Setter for excludeDomains. - * - *

excludeDomains: Optional. List of domains to be excluded from the search results. The - * default limit is 2000 domains. - */ - @CanIgnoreReturnValue - public Builder excludeDomains(String... excludeDomains) { - return excludeDomains(Arrays.asList(excludeDomains)); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder excludeDomains(Optional> excludeDomains); - - /** Clears the value of excludeDomains field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearExcludeDomains() { - return excludeDomains(Optional.empty()); - } - /** * Setter for blockingConfidence. * @@ -138,6 +108,36 @@ public Builder blockingConfidence(String blockingConfidence) { return blockingConfidence(new PhishBlockThreshold(blockingConfidence)); } + /** + * Setter for excludeDomains. + * + *

excludeDomains: Optional. List of domains to be excluded from the search results. The + * default limit is 2000 domains. + */ + @JsonProperty("excludeDomains") + public abstract Builder excludeDomains(List excludeDomains); + + /** + * Setter for excludeDomains. + * + *

excludeDomains: Optional. List of domains to be excluded from the search results. The + * default limit is 2000 domains. + */ + @CanIgnoreReturnValue + public Builder excludeDomains(String... excludeDomains) { + return excludeDomains(Arrays.asList(excludeDomains)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder excludeDomains(Optional> excludeDomains); + + /** Clears the value of excludeDomains field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExcludeDomains() { + return excludeDomains(Optional.empty()); + } + public abstract EnterpriseWebSearch build(); } diff --git a/src/main/java/com/google/genai/types/EvaluateDatasetResponse.java b/src/main/java/com/google/genai/types/EvaluateDatasetResponse.java new file mode 100644 index 00000000000..038902391bc --- /dev/null +++ b/src/main/java/com/google/genai/types/EvaluateDatasetResponse.java @@ -0,0 +1,130 @@ +/* + * 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; + +/** + * Response in LRO for EvaluationService.EvaluateDataset. This data type is not supported in Gemini + * API. + */ +@AutoValue +@JsonDeserialize(builder = EvaluateDatasetResponse.Builder.class) +public abstract class EvaluateDatasetResponse extends JsonSerializable { + /** + * Output only. Aggregation statistics derived from results of EvaluationService.EvaluateDataset. + */ + @JsonProperty("aggregationOutput") + public abstract Optional aggregationOutput(); + + /** Output only. Output info for EvaluationService.EvaluateDataset. */ + @JsonProperty("outputInfo") + public abstract Optional outputInfo(); + + /** Instantiates a builder for EvaluateDatasetResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateDatasetResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateDatasetResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateDatasetResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateDatasetResponse.Builder(); + } + + /** + * Setter for aggregationOutput. + * + *

aggregationOutput: Output only. Aggregation statistics derived from results of + * EvaluationService.EvaluateDataset. + */ + @JsonProperty("aggregationOutput") + public abstract Builder aggregationOutput(AggregationOutput aggregationOutput); + + /** + * Setter for aggregationOutput builder. + * + *

aggregationOutput: Output only. Aggregation statistics derived from results of + * EvaluationService.EvaluateDataset. + */ + @CanIgnoreReturnValue + public Builder aggregationOutput(AggregationOutput.Builder aggregationOutputBuilder) { + return aggregationOutput(aggregationOutputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder aggregationOutput(Optional aggregationOutput); + + /** Clears the value of aggregationOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAggregationOutput() { + return aggregationOutput(Optional.empty()); + } + + /** + * Setter for outputInfo. + * + *

outputInfo: Output only. Output info for EvaluationService.EvaluateDataset. + */ + @JsonProperty("outputInfo") + public abstract Builder outputInfo(OutputInfo outputInfo); + + /** + * Setter for outputInfo builder. + * + *

outputInfo: Output only. Output info for EvaluationService.EvaluateDataset. + */ + @CanIgnoreReturnValue + public Builder outputInfo(OutputInfo.Builder outputInfoBuilder) { + return outputInfo(outputInfoBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputInfo(Optional outputInfo); + + /** Clears the value of outputInfo field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputInfo() { + return outputInfo(Optional.empty()); + } + + public abstract EvaluateDatasetResponse build(); + } + + /** Deserializes a JSON string to a EvaluateDatasetResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateDatasetResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateDatasetResponse.class); + } +} diff --git a/src/main/java/com/google/genai/types/EvaluateDatasetRun.java b/src/main/java/com/google/genai/types/EvaluateDatasetRun.java new file mode 100644 index 00000000000..abda156b550 --- /dev/null +++ b/src/main/java/com/google/genai/types/EvaluateDatasetRun.java @@ -0,0 +1,178 @@ +/* + * 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; + +/** Evaluate Dataset Run Result for Tuning Job. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = EvaluateDatasetRun.Builder.class) +public abstract class EvaluateDatasetRun extends JsonSerializable { + /** + * Output only. The checkpoint id used in the evaluation run. Only populated when evaluating + * checkpoints. + */ + @JsonProperty("checkpointId") + public abstract Optional checkpointId(); + + /** Output only. The error of the evaluation run if any. */ + @JsonProperty("error") + public abstract Optional error(); + + /** Output only. Results for EvaluationService.EvaluateDataset. */ + @JsonProperty("evaluateDatasetResponse") + public abstract Optional evaluateDatasetResponse(); + + /** + * Output only. The operation ID of the evaluation run. Format: + * `projects/{project}/locations/{location}/operations/{operation_id}`. + */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Instantiates a builder for EvaluateDatasetRun. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateDatasetRun.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateDatasetRun. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateDatasetRun.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateDatasetRun.Builder(); + } + + /** + * Setter for checkpointId. + * + *

checkpointId: Output only. The checkpoint id used in the evaluation run. Only populated + * when evaluating checkpoints. + */ + @JsonProperty("checkpointId") + public abstract Builder checkpointId(String checkpointId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder checkpointId(Optional checkpointId); + + /** Clears the value of checkpointId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCheckpointId() { + return checkpointId(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: Output only. The error of the evaluation run if any. + */ + @JsonProperty("error") + public abstract Builder error(GoogleRpcStatus error); + + /** + * Setter for error builder. + * + *

error: Output only. The error of the evaluation run if any. + */ + @CanIgnoreReturnValue + public Builder error(GoogleRpcStatus.Builder errorBuilder) { + return error(errorBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for evaluateDatasetResponse. + * + *

evaluateDatasetResponse: Output only. Results for EvaluationService.EvaluateDataset. + */ + @JsonProperty("evaluateDatasetResponse") + public abstract Builder evaluateDatasetResponse( + EvaluateDatasetResponse evaluateDatasetResponse); + + /** + * Setter for evaluateDatasetResponse builder. + * + *

evaluateDatasetResponse: Output only. Results for EvaluationService.EvaluateDataset. + */ + @CanIgnoreReturnValue + public Builder evaluateDatasetResponse( + EvaluateDatasetResponse.Builder evaluateDatasetResponseBuilder) { + return evaluateDatasetResponse(evaluateDatasetResponseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluateDatasetResponse( + Optional evaluateDatasetResponse); + + /** Clears the value of evaluateDatasetResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluateDatasetResponse() { + return evaluateDatasetResponse(Optional.empty()); + } + + /** + * Setter for operationName. + * + *

operationName: Output only. The operation ID of the evaluation run. Format: + * `projects/{project}/locations/{location}/operations/{operation_id}`. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + public abstract EvaluateDatasetRun build(); + } + + /** Deserializes a JSON string to a EvaluateDatasetRun object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateDatasetRun fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateDatasetRun.class); + } +} diff --git a/src/main/java/com/google/genai/types/EvaluationDataset.java b/src/main/java/com/google/genai/types/EvaluationDataset.java new file mode 100644 index 00000000000..4d9cf7d35a6 --- /dev/null +++ b/src/main/java/com/google/genai/types/EvaluationDataset.java @@ -0,0 +1,128 @@ +/* + * 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; + +/** The dataset used for evaluation. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = EvaluationDataset.Builder.class) +public abstract class EvaluationDataset extends JsonSerializable { + /** BigQuery source holds the dataset. */ + @JsonProperty("bigquerySource") + public abstract Optional bigquerySource(); + + /** + * Cloud storage source holds the dataset. Currently only one Cloud Storage file path is + * supported. + */ + @JsonProperty("gcsSource") + public abstract Optional gcsSource(); + + /** Instantiates a builder for EvaluationDataset. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationDataset.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationDataset. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationDataset.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationDataset.Builder(); + } + + /** + * Setter for bigquerySource. + * + *

bigquerySource: BigQuery source holds the dataset. + */ + @JsonProperty("bigquerySource") + public abstract Builder bigquerySource(BigQuerySource bigquerySource); + + /** + * Setter for bigquerySource builder. + * + *

bigquerySource: BigQuery source holds the dataset. + */ + @CanIgnoreReturnValue + public Builder bigquerySource(BigQuerySource.Builder bigquerySourceBuilder) { + return bigquerySource(bigquerySourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigquerySource(Optional bigquerySource); + + /** Clears the value of bigquerySource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigquerySource() { + return bigquerySource(Optional.empty()); + } + + /** + * Setter for gcsSource. + * + *

gcsSource: Cloud storage source holds the dataset. Currently only one Cloud Storage file + * path is supported. + */ + @JsonProperty("gcsSource") + public abstract Builder gcsSource(GcsSource gcsSource); + + /** + * Setter for gcsSource builder. + * + *

gcsSource: Cloud storage source holds the dataset. Currently only one Cloud Storage file + * path is supported. + */ + @CanIgnoreReturnValue + public Builder gcsSource(GcsSource.Builder gcsSourceBuilder) { + return gcsSource(gcsSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsSource(Optional gcsSource); + + /** Clears the value of gcsSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsSource() { + return gcsSource(Optional.empty()); + } + + public abstract EvaluationDataset build(); + } + + /** Deserializes a JSON string to a EvaluationDataset object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationDataset fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationDataset.class); + } +} diff --git a/src/main/java/com/google/genai/types/ExactMatchMetricValue.java b/src/main/java/com/google/genai/types/ExactMatchMetricValue.java new file mode 100644 index 00000000000..7a241f2ba46 --- /dev/null +++ b/src/main/java/com/google/genai/types/ExactMatchMetricValue.java @@ -0,0 +1,81 @@ +/* + * 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; + +/** Exact match metric value for an instance. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = ExactMatchMetricValue.Builder.class) +public abstract class ExactMatchMetricValue extends JsonSerializable { + /** Output only. Exact match score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ExactMatchMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Exact match score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ExactMatchMetricValue build(); + } + + /** Deserializes a JSON string to a ExactMatchMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchMetricValue.class); + } +} diff --git a/src/main/java/com/google/genai/types/FileData.java b/src/main/java/com/google/genai/types/FileData.java index 1c559a5840c..afb386ac60f 100644 --- a/src/main/java/com/google/genai/types/FileData.java +++ b/src/main/java/com/google/genai/types/FileData.java @@ -26,20 +26,23 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** URI based data. */ +/** + * URI-based data. A FileData message contains a URI pointing to data of a specific media type. It + * is used to represent images, audio, and video stored in Google Cloud Storage. + */ @AutoValue @JsonDeserialize(builder = FileData.Builder.class) public abstract class FileData extends JsonSerializable { /** - * 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. This field is not supported in Gemini API. + * Optional. The display name of the file. Used to provide a label or filename to distinguish + * files. This field is only returned in `PromptMessage` for prompt management. It is used in the + * Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) + * are enabled. This field is not supported in Gemini API. */ @JsonProperty("displayName") public abstract Optional displayName(); - /** Required. URI. */ + /** Required. The URI of the file in Google Cloud Storage. */ @JsonProperty("fileUri") public abstract Optional fileUri(); @@ -68,11 +71,10 @@ private static Builder create() { /** * 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. This field is not - * supported in Gemini API. + *

displayName: Optional. The display name of the file. Used to provide a label or filename + * to distinguish files. This field is only returned in `PromptMessage` for prompt management. + * It is used in the Gemini calls only when server side tools (`code_execution`, + * `google_search`, and `url_context`) are enabled. This field is not supported in Gemini API. */ @JsonProperty("displayName") public abstract Builder displayName(String displayName); @@ -90,7 +92,7 @@ public Builder clearDisplayName() { /** * Setter for fileUri. * - *

fileUri: Required. URI. + *

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

hyperParameters: Optional. Hyperparameters for Full Fine Tuning. + */ + @JsonProperty("hyperParameters") + public abstract Builder hyperParameters(SupervisedHyperParameters hyperParameters); + + /** + * Setter for hyperParameters builder. + * + *

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

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

validationDatasetUri: Optional. Validation dataset used for tuning. The dataset can be + * specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex + * Multimodal Dataset. + */ + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder validationDatasetUri(Optional validationDatasetUri); + + /** Clears the value of validationDatasetUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValidationDatasetUri() { + return validationDatasetUri(Optional.empty()); + } + + public abstract FullFineTuningSpec build(); + } + + /** Deserializes a JSON string to a FullFineTuningSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static FullFineTuningSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, FullFineTuningSpec.class); + } +} diff --git a/src/main/java/com/google/genai/types/FunctionDeclaration.java b/src/main/java/com/google/genai/types/FunctionDeclaration.java index 02a4ad7a766..23d33ecea61 100644 --- a/src/main/java/com/google/genai/types/FunctionDeclaration.java +++ b/src/main/java/com/google/genai/types/FunctionDeclaration.java @@ -54,7 +54,7 @@ public abstract class FunctionDeclaration extends JsonSerializable { /** * Required. The name of the function to call. Must start with a letter or an underscore. Must be - * a-z, A-Z, 0-9, or contain underscores, dots and dashes, with a maximum length of 64. + * a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 64. */ @JsonProperty("name") public abstract Optional name(); @@ -144,8 +144,8 @@ public Builder clearDescription() { * Setter for name. * *

name: Required. The name of the function to call. Must start with a letter or an - * underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots and dashes, with a maximum - * length of 64. + * underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a + * maximum length of 64. */ @JsonProperty("name") public abstract Builder name(String name); diff --git a/src/main/java/com/google/genai/types/GcsSource.java b/src/main/java/com/google/genai/types/GcsSource.java new file mode 100644 index 00000000000..818d548b6c5 --- /dev/null +++ b/src/main/java/com/google/genai/types/GcsSource.java @@ -0,0 +1,101 @@ +/* + * 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.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * The Google Cloud Storage location for the input content. This data type is not supported in + * Gemini API. + */ +@AutoValue +@JsonDeserialize(builder = GcsSource.Builder.class) +public abstract class GcsSource extends JsonSerializable { + /** + * Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more + * information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @JsonProperty("uris") + public abstract Optional> uris(); + + /** Instantiates a builder for GcsSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GcsSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GcsSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GcsSource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GcsSource.Builder(); + } + + /** + * Setter for uris. + * + *

uris: Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. + * For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @JsonProperty("uris") + public abstract Builder uris(List uris); + + /** + * Setter for uris. + * + *

uris: Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. + * For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @CanIgnoreReturnValue + public Builder uris(String... uris) { + return uris(Arrays.asList(uris)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder uris(Optional> uris); + + /** Clears the value of uris field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUris() { + return uris(Optional.empty()); + } + + public abstract GcsSource build(); + } + + /** Deserializes a JSON string to a GcsSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GcsSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GcsSource.class); + } +} diff --git a/src/main/java/com/google/genai/types/GenerationConfig.java b/src/main/java/com/google/genai/types/GenerationConfig.java index f5468420b11..39d45fd4cd3 100644 --- a/src/main/java/com/google/genai/types/GenerationConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfig.java @@ -47,66 +47,102 @@ public abstract class GenerationConfig extends JsonSerializable { public abstract Optional responseJsonSchema(); /** - * Optional. If enabled, audio timestamp will be included in the request to the model. This field - * is not supported in Gemini API. + * 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 + * supported in Gemini API. */ @JsonProperty("audioTimestamp") public abstract Optional audioTimestamp(); - /** Optional. Number of candidates to generate. */ + /** + * Optional. The number of candidate responses to generate. A higher `candidate_count` can provide + * more options to choose from, but it also consumes more resources. This can be useful for + * generating a variety of responses and selecting the best one. + */ @JsonProperty("candidateCount") public abstract Optional candidateCount(); /** - * Optional. If enabled, the model will detect emotions and adapt its responses accordingly. This - * field is not supported in Gemini API. + * Optional. If enabled, the model will detect emotions and adapt its responses accordingly. For + * example, if the model detects that the user is frustrated, it may provide a more empathetic + * response. This field is not supported in Gemini API. */ @JsonProperty("enableAffectiveDialog") public abstract Optional enableAffectiveDialog(); - /** Optional. Frequency penalties. */ + /** + * Optional. Penalizes tokens based on their frequency in the generated text. A positive value + * helps to reduce the repetition of words and phrases. Valid values can range from [-2.0, 2.0]. + */ @JsonProperty("frequencyPenalty") public abstract Optional frequencyPenalty(); - /** Optional. Logit probabilities. */ + /** + * Optional. The number of top log probabilities to return for each token. This can be used to see + * which other tokens were considered likely candidates for a given position. A higher value will + * return more options, but it will also increase the size of the response. + */ @JsonProperty("logprobs") public abstract Optional logprobs(); - /** Optional. The maximum number of output tokens to generate per message. */ + /** + * Optional. The maximum number of tokens to generate in the response. A token is approximately + * four characters. The default value varies by model. This parameter can be used to control the + * length of the generated text and prevent overly long responses. + */ @JsonProperty("maxOutputTokens") public abstract Optional maxOutputTokens(); - /** Optional. If specified, the media resolution specified will be used. */ + /** + * Optional. The token resolution at which input media content is sampled. This is used to control + * the trade-off between the quality of the response and the number of tokens used to represent + * the media. A higher resolution allows the model to perceive more detail, which can lead to a + * more nuanced response, but it will also use more tokens. This does not affect the image + * dimensions sent to the model. + */ @JsonProperty("mediaResolution") public abstract Optional mediaResolution(); - /** Optional. Positive penalties. */ + /** + * Optional. Penalizes tokens that have already appeared in the generated text. A positive value + * encourages the model to generate more diverse and less repetitive text. Valid values can range + * from [-2.0, 2.0]. + */ @JsonProperty("presencePenalty") public abstract Optional presencePenalty(); - /** Optional. If true, export the logprobs results in response. */ + /** + * 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 + * log probability means the token is more likely to be generated. This can be useful for + * analyzing the model's confidence in its own output and for debugging. + */ @JsonProperty("responseLogprobs") public abstract Optional responseLogprobs(); /** - * Optional. Output response mimetype of the generated candidate text. Supported mimetype: - - * `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The - * model needs to be prompted to output the appropriate response type, otherwise the behavior is - * undefined. This is a preview feature. + * Optional. The IANA standard MIME type of the response. The model will generate output that + * conforms to this MIME type. Supported values include 'text/plain' (default) and + * 'application/json'. The model needs to be prompted to output the appropriate response type, + * otherwise the behavior is undefined. This is a preview feature. */ @JsonProperty("responseMimeType") public abstract Optional responseMimeType(); - /** Optional. The modalities of the response. */ + /** + * Optional. The modalities of the response. The model will generate a response that includes all + * the specified modalities. For example, if this is set to `[TEXT, IMAGE]`, the response will + * include both text and an image. + */ @JsonProperty("responseModalities") public abstract Optional> responseModalities(); /** - * Optional. The `Schema` object allows the definition of input and output data types. These types - * can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 - * schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible - * response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON - * response. + * Optional. Lets you to specify a schema for the model's response, ensuring that the output + * conforms to a particular structure. This is useful for generating structured data such as JSON. + * The schema is a subset of the [OpenAPI 3.0 schema + * object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must + * also set the `response_mime_type` to `application/json`. */ @JsonProperty("responseSchema") public abstract Optional responseSchema(); @@ -115,7 +151,14 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("routingConfig") public abstract Optional routingConfig(); - /** Optional. Seed. */ + /** + * Optional. A seed for the random number generator. By setting a seed, you can make the model's + * output mostly deterministic. For a given prompt and parameters (like temperature, top_p, etc.), + * the model will produce the same response every time. However, it's not a guaranteed absolute + * deterministic behavior. This is different from parameters like `temperature`, which control the + * *level* of randomness. `seed` ensures that the "random" choices the model makes are the same on + * every run, making it essential for testing and ensuring reproducible results. + */ @JsonProperty("seed") public abstract Optional seed(); @@ -123,26 +166,46 @@ public abstract class GenerationConfig extends JsonSerializable { @JsonProperty("speechConfig") public abstract Optional speechConfig(); - /** Optional. Stop sequences. */ + /** + * Optional. A list of character sequences that will stop the model from generating further + * tokens. If a stop sequence is generated, the output will end at that point. This is useful for + * controlling the length and structure of the output. For example, you can use ["\n", "###"] to + * stop generation at a new line or a specific marker. + */ @JsonProperty("stopSequences") public abstract Optional> stopSequences(); - /** Optional. Controls the randomness of predictions. */ + /** + * Optional. Controls the randomness of the output. A higher temperature results in more creative + * and diverse responses, while a lower temperature makes the output more predictable and focused. + * The valid range is (0.0, 2.0]. + */ @JsonProperty("temperature") public abstract Optional temperature(); /** - * Optional. Config for thinking features. An error will be returned if this field is set for - * models that don't support thinking. + * Optional. Configuration for thinking features. An error will be returned if this field is set + * for models that don't support thinking. */ @JsonProperty("thinkingConfig") public abstract Optional thinkingConfig(); - /** Optional. If specified, top-k sampling will be used. */ + /** + * Optional. Specifies the top-k sampling threshold. The model considers only the top k most + * probable tokens for the next token. This can be useful for generating more coherent and less + * random text. For example, a `top_k` of 40 means the model will choose the next word from the 40 + * most likely words. + */ @JsonProperty("topK") public abstract Optional topK(); - /** Optional. If specified, nucleus sampling will be used. */ + /** + * Optional. Specifies the nucleus sampling threshold. The model considers only the smallest set + * of tokens whose cumulative probability is at least `top_p`. This helps generate more diverse + * and less repetitive responses. For example, a `top_p` of 0.9 means the model considers tokens + * until the cumulative probability of the tokens to select from reaches 0.9. It's recommended to + * adjust either temperature or `top_p`, but not both. + */ @JsonProperty("topP") public abstract Optional topP(); @@ -221,8 +284,9 @@ public Builder clearResponseJsonSchema() { /** * Setter for audioTimestamp. * - *

audioTimestamp: Optional. If enabled, audio timestamp will be included in the request to - * the model. This field is not supported in Gemini API. + *

audioTimestamp: 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 supported in Gemini API. */ @JsonProperty("audioTimestamp") public abstract Builder audioTimestamp(boolean audioTimestamp); @@ -240,7 +304,10 @@ public Builder clearAudioTimestamp() { /** * Setter for candidateCount. * - *

candidateCount: Optional. Number of candidates to generate. + *

candidateCount: Optional. The number of candidate responses to generate. A higher + * `candidate_count` can provide more options to choose from, but it also consumes more + * resources. This can be useful for generating a variety of responses and selecting the best + * one. */ @JsonProperty("candidateCount") public abstract Builder candidateCount(Integer candidateCount); @@ -259,7 +326,8 @@ public Builder clearCandidateCount() { * Setter for enableAffectiveDialog. * *

enableAffectiveDialog: Optional. If enabled, the model will detect emotions and adapt its - * responses accordingly. This field is not supported in Gemini API. + * responses accordingly. For example, if the model detects that the user is frustrated, it may + * provide a more empathetic response. This field is not supported in Gemini API. */ @JsonProperty("enableAffectiveDialog") public abstract Builder enableAffectiveDialog(boolean enableAffectiveDialog); @@ -277,7 +345,9 @@ public Builder clearEnableAffectiveDialog() { /** * Setter for frequencyPenalty. * - *

frequencyPenalty: Optional. Frequency penalties. + *

frequencyPenalty: Optional. Penalizes tokens based on their frequency in the generated + * text. A positive value helps to reduce the repetition of words and phrases. Valid values can + * range from [-2.0, 2.0]. */ @JsonProperty("frequencyPenalty") public abstract Builder frequencyPenalty(Float frequencyPenalty); @@ -295,7 +365,9 @@ public Builder clearFrequencyPenalty() { /** * Setter for logprobs. * - *

logprobs: Optional. Logit probabilities. + *

logprobs: Optional. The number of top log probabilities to return for each token. This can + * be used to see which other tokens were considered likely candidates for a given position. A + * higher value will return more options, but it will also increase the size of the response. */ @JsonProperty("logprobs") public abstract Builder logprobs(Integer logprobs); @@ -313,7 +385,9 @@ public Builder clearLogprobs() { /** * Setter for maxOutputTokens. * - *

maxOutputTokens: Optional. The maximum number of output tokens to generate per message. + *

maxOutputTokens: Optional. The maximum number of tokens to generate in the response. A + * token is approximately four characters. The default value varies by model. This parameter can + * be used to control the length of the generated text and prevent overly long responses. */ @JsonProperty("maxOutputTokens") public abstract Builder maxOutputTokens(Integer maxOutputTokens); @@ -331,7 +405,11 @@ public Builder clearMaxOutputTokens() { /** * Setter for mediaResolution. * - *

mediaResolution: Optional. If specified, the media resolution specified will be used. + *

mediaResolution: Optional. The token resolution at which input media content is sampled. + * This is used to control the trade-off between the quality of the response and the number of + * tokens used to represent the media. A higher resolution allows the model to perceive more + * detail, which can lead to a more nuanced response, but it will also use more tokens. This + * does not affect the image dimensions sent to the model. */ @JsonProperty("mediaResolution") public abstract Builder mediaResolution(MediaResolution mediaResolution); @@ -349,7 +427,11 @@ public Builder clearMediaResolution() { /** * Setter for mediaResolution given a known enum. * - *

mediaResolution: Optional. If specified, the media resolution specified will be used. + *

mediaResolution: Optional. The token resolution at which input media content is sampled. + * This is used to control the trade-off between the quality of the response and the number of + * tokens used to represent the media. A higher resolution allows the model to perceive more + * detail, which can lead to a more nuanced response, but it will also use more tokens. This + * does not affect the image dimensions sent to the model. */ @CanIgnoreReturnValue public Builder mediaResolution(MediaResolution.Known knownType) { @@ -359,7 +441,11 @@ public Builder mediaResolution(MediaResolution.Known knownType) { /** * Setter for mediaResolution given a string. * - *

mediaResolution: Optional. If specified, the media resolution specified will be used. + *

mediaResolution: Optional. The token resolution at which input media content is sampled. + * This is used to control the trade-off between the quality of the response and the number of + * tokens used to represent the media. A higher resolution allows the model to perceive more + * detail, which can lead to a more nuanced response, but it will also use more tokens. This + * does not affect the image dimensions sent to the model. */ @CanIgnoreReturnValue public Builder mediaResolution(String mediaResolution) { @@ -369,7 +455,9 @@ public Builder mediaResolution(String mediaResolution) { /** * Setter for presencePenalty. * - *

presencePenalty: Optional. Positive penalties. + *

presencePenalty: Optional. Penalizes tokens that have already appeared in the generated + * text. A positive value encourages the model to generate more diverse and less repetitive + * text. Valid values can range from [-2.0, 2.0]. */ @JsonProperty("presencePenalty") public abstract Builder presencePenalty(Float presencePenalty); @@ -387,7 +475,10 @@ public Builder clearPresencePenalty() { /** * Setter for responseLogprobs. * - *

responseLogprobs: Optional. If true, export the logprobs results in response. + *

responseLogprobs: 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 log probability means the token is more likely to be generated. This can be + * useful for analyzing the model's confidence in its own output and for debugging. */ @JsonProperty("responseLogprobs") public abstract Builder responseLogprobs(boolean responseLogprobs); @@ -405,10 +496,10 @@ public Builder clearResponseLogprobs() { /** * Setter for responseMimeType. * - *

responseMimeType: Optional. Output response mimetype of the generated candidate text. - * Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON - * response in the candidates. The model needs to be prompted to output the appropriate response - * type, otherwise the behavior is undefined. This is a preview feature. + *

responseMimeType: Optional. The IANA standard MIME type of the response. The model will + * generate output that conforms to this MIME type. Supported values include 'text/plain' + * (default) and 'application/json'. The model needs to be prompted to output the appropriate + * response type, otherwise the behavior is undefined. This is a preview feature. */ @JsonProperty("responseMimeType") public abstract Builder responseMimeType(String responseMimeType); @@ -426,7 +517,9 @@ public Builder clearResponseMimeType() { /** * Setter for responseModalities. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @JsonProperty("responseModalities") public abstract Builder responseModalities(List responseModalities); @@ -434,7 +527,9 @@ public Builder clearResponseMimeType() { /** * Setter for responseModalities. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @CanIgnoreReturnValue public Builder responseModalities(Modality... responseModalities) { @@ -454,7 +549,9 @@ public Builder clearResponseModalities() { /** * Setter for responseModalities given a varargs of strings. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @CanIgnoreReturnValue public Builder responseModalities(String... responseModalities) { @@ -464,7 +561,9 @@ public Builder responseModalities(String... responseModalities) { /** * Setter for responseModalities given a varargs of known enums. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @CanIgnoreReturnValue public Builder responseModalities(Modality.Known... knownTypes) { @@ -474,7 +573,9 @@ public Builder responseModalities(Modality.Known... knownTypes) { /** * Setter for responseModalities given a list of known enums. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @CanIgnoreReturnValue public Builder responseModalitiesFromKnown(List knownTypes) { @@ -486,7 +587,9 @@ public Builder responseModalitiesFromKnown(List knownTypes) { /** * Setter for responseModalities given a list of strings. * - *

responseModalities: Optional. The modalities of the response. + *

responseModalities: Optional. The modalities of the response. The model will generate a + * response that includes all the specified modalities. For example, if this is set to `[TEXT, + * IMAGE]`, the response will include both text and an image. */ @CanIgnoreReturnValue public Builder responseModalitiesFromString(List responseModalities) { @@ -498,11 +601,11 @@ public Builder responseModalitiesFromString(List responseModalities) { /** * Setter for responseSchema. * - *

responseSchema: Optional. The `Schema` object allows the definition of input and output - * data types. These types can be objects, but also primitives and arrays. Represents a select - * subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If - * set, a compatible response_mime_type must also be set. Compatible mimetypes: - * `application/json`: Schema for JSON response. + *

responseSchema: Optional. Lets you to specify a schema for the model's response, ensuring + * that the output conforms to a particular structure. This is useful for generating structured + * data such as JSON. The schema is a subset of the [OpenAPI 3.0 schema + * object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must + * also set the `response_mime_type` to `application/json`. */ @JsonProperty("responseSchema") public abstract Builder responseSchema(Schema responseSchema); @@ -510,11 +613,11 @@ public Builder responseModalitiesFromString(List responseModalities) { /** * Setter for responseSchema builder. * - *

responseSchema: Optional. The `Schema` object allows the definition of input and output - * data types. These types can be objects, but also primitives and arrays. Represents a select - * subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If - * set, a compatible response_mime_type must also be set. Compatible mimetypes: - * `application/json`: Schema for JSON response. + *

responseSchema: Optional. Lets you to specify a schema for the model's response, ensuring + * that the output conforms to a particular structure. This is useful for generating structured + * data such as JSON. The schema is a subset of the [OpenAPI 3.0 schema + * object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must + * also set the `response_mime_type` to `application/json`. */ @CanIgnoreReturnValue public Builder responseSchema(Schema.Builder responseSchemaBuilder) { @@ -562,7 +665,13 @@ public Builder clearRoutingConfig() { /** * Setter for seed. * - *

seed: Optional. Seed. + *

seed: Optional. A seed for the random number generator. By setting a seed, you can make + * the model's output mostly deterministic. For a given prompt and parameters (like temperature, + * top_p, etc.), the model will produce the same response every time. However, it's not a + * guaranteed absolute deterministic behavior. This is different from parameters like + * `temperature`, which control the *level* of randomness. `seed` ensures that the "random" + * choices the model makes are the same on every run, making it essential for testing and + * ensuring reproducible results. */ @JsonProperty("seed") public abstract Builder seed(Integer seed); @@ -608,7 +717,10 @@ public Builder clearSpeechConfig() { /** * Setter for stopSequences. * - *

stopSequences: Optional. Stop sequences. + *

stopSequences: Optional. A list of character sequences that will stop the model from + * generating further tokens. If a stop sequence is generated, the output will end at that + * point. This is useful for controlling the length and structure of the output. For example, + * you can use ["\n", "###"] to stop generation at a new line or a specific marker. */ @JsonProperty("stopSequences") public abstract Builder stopSequences(List stopSequences); @@ -616,7 +728,10 @@ public Builder clearSpeechConfig() { /** * Setter for stopSequences. * - *

stopSequences: Optional. Stop sequences. + *

stopSequences: Optional. A list of character sequences that will stop the model from + * generating further tokens. If a stop sequence is generated, the output will end at that + * point. This is useful for controlling the length and structure of the output. For example, + * you can use ["\n", "###"] to stop generation at a new line or a specific marker. */ @CanIgnoreReturnValue public Builder stopSequences(String... stopSequences) { @@ -636,7 +751,9 @@ public Builder clearStopSequences() { /** * Setter for temperature. * - *

temperature: Optional. Controls the randomness of predictions. + *

temperature: Optional. Controls the randomness of the output. A higher temperature results + * in more creative and diverse responses, while a lower temperature makes the output more + * predictable and focused. The valid range is (0.0, 2.0]. */ @JsonProperty("temperature") public abstract Builder temperature(Float temperature); @@ -654,8 +771,8 @@ public Builder clearTemperature() { /** * Setter for thinkingConfig. * - *

thinkingConfig: Optional. Config for thinking features. An error will be returned if this - * field is set for models that don't support thinking. + *

thinkingConfig: Optional. Configuration for thinking features. An error will be returned + * if this field is set for models that don't support thinking. */ @JsonProperty("thinkingConfig") public abstract Builder thinkingConfig(ThinkingConfig thinkingConfig); @@ -663,8 +780,8 @@ public Builder clearTemperature() { /** * Setter for thinkingConfig builder. * - *

thinkingConfig: Optional. Config for thinking features. An error will be returned if this - * field is set for models that don't support thinking. + *

thinkingConfig: Optional. Configuration for thinking features. An error will be returned + * if this field is set for models that don't support thinking. */ @CanIgnoreReturnValue public Builder thinkingConfig(ThinkingConfig.Builder thinkingConfigBuilder) { @@ -684,7 +801,10 @@ public Builder clearThinkingConfig() { /** * Setter for topK. * - *

topK: Optional. If specified, top-k sampling will be used. + *

topK: Optional. Specifies the top-k sampling threshold. The model considers only the top k + * most probable tokens for the next token. This can be useful for generating more coherent and + * less random text. For example, a `top_k` of 40 means the model will choose the next word from + * the 40 most likely words. */ @JsonProperty("topK") public abstract Builder topK(Float topK); @@ -702,7 +822,11 @@ public Builder clearTopK() { /** * Setter for topP. * - *

topP: Optional. If specified, nucleus sampling will be used. + *

topP: Optional. Specifies the nucleus sampling threshold. The model considers only the + * smallest set of tokens whose cumulative probability is at least `top_p`. This helps generate + * more diverse and less repetitive responses. For example, a `top_p` of 0.9 means the model + * considers tokens until the cumulative probability of the tokens to select from reaches 0.9. + * It's recommended to adjust either temperature or `top_p`, but not both. */ @JsonProperty("topP") public abstract Builder topP(Float topP); diff --git a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfig.java b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfig.java index c6fd52509a9..7a093df5126 100644 --- a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfig.java @@ -27,17 +27,18 @@ import java.util.Optional; /** - * The configuration for routing the request to a specific model. This data type is not supported in - * Gemini API. + * The configuration for routing the request to a specific model. This can be used to control which + * model is used for the generation, either automatically or by specifying a model name. This data + * type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = GenerationConfigRoutingConfig.Builder.class) public abstract class GenerationConfigRoutingConfig extends JsonSerializable { - /** Automated routing. */ + /** In this mode, the model is selected automatically based on the content of the request. */ @JsonProperty("autoMode") public abstract Optional autoMode(); - /** Manual routing. */ + /** In this mode, the model is specified manually. */ @JsonProperty("manualMode") public abstract Optional manualMode(); @@ -64,7 +65,8 @@ private static Builder create() { /** * Setter for autoMode. * - *

autoMode: Automated routing. + *

autoMode: In this mode, the model is selected automatically based on the content of the + * request. */ @JsonProperty("autoMode") public abstract Builder autoMode(GenerationConfigRoutingConfigAutoRoutingMode autoMode); @@ -72,7 +74,8 @@ private static Builder create() { /** * Setter for autoMode builder. * - *

autoMode: Automated routing. + *

autoMode: In this mode, the model is selected automatically based on the content of the + * request. */ @CanIgnoreReturnValue public Builder autoMode(GenerationConfigRoutingConfigAutoRoutingMode.Builder autoModeBuilder) { @@ -92,7 +95,7 @@ public Builder clearAutoMode() { /** * Setter for manualMode. * - *

manualMode: Manual routing. + *

manualMode: In this mode, the model is specified manually. */ @JsonProperty("manualMode") public abstract Builder manualMode(GenerationConfigRoutingConfigManualRoutingMode manualMode); @@ -100,7 +103,7 @@ public Builder clearAutoMode() { /** * Setter for manualMode builder. * - *

manualMode: Manual routing. + *

manualMode: In this mode, the model is specified manually. */ @CanIgnoreReturnValue public Builder manualMode( diff --git a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigAutoRoutingMode.java b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigAutoRoutingMode.java index 8299c6b5350..f705a757dc2 100644 --- a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigAutoRoutingMode.java +++ b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigAutoRoutingMode.java @@ -27,9 +27,9 @@ import java.util.Optional; /** - * When automated routing is specified, the routing will be determined by the pretrained routing - * model and customer provided model routing preference. This data type is not supported in Gemini - * API. + * The configuration for automated routing. When automated routing is specified, the routing will be + * determined by the pretrained routing model and customer provided model routing preference. This + * data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = GenerationConfigRoutingConfigAutoRoutingMode.Builder.class) diff --git a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigManualRoutingMode.java b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigManualRoutingMode.java index 15cb3918a94..f897bfd8d97 100644 --- a/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigManualRoutingMode.java +++ b/src/main/java/com/google/genai/types/GenerationConfigRoutingConfigManualRoutingMode.java @@ -27,16 +27,13 @@ import java.util.Optional; /** - * When manual routing is set, the specified model will be used directly. This data type is not - * supported in Gemini API. + * The configuration for manual routing. When manual routing is specified, the model will be + * selected based on the model name provided. This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = GenerationConfigRoutingConfigManualRoutingMode.Builder.class) public abstract class GenerationConfigRoutingConfigManualRoutingMode extends JsonSerializable { - /** - * The model name to use. Only the public LLM models are accepted. See [Supported - * models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). - */ + /** The name of the model to use. Only public LLM models are accepted. */ @JsonProperty("modelName") public abstract Optional modelName(); @@ -64,8 +61,7 @@ private static Builder create() { /** * Setter for modelName. * - *

modelName: The model name to use. Only the public LLM models are accepted. See [Supported - * models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). + *

modelName: The name of the model to use. Only public LLM models are accepted. */ @JsonProperty("modelName") public abstract Builder modelName(String modelName); diff --git a/src/main/java/com/google/genai/types/GoogleMaps.java b/src/main/java/com/google/genai/types/GoogleMaps.java index 9f6c3df3777..58755dc43e8 100644 --- a/src/main/java/com/google/genai/types/GoogleMaps.java +++ b/src/main/java/com/google/genai/types/GoogleMaps.java @@ -26,7 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Tool to retrieve public maps data for grounding, powered by Google. */ +/** Tool to retrieve knowledge from Google Maps. */ @AutoValue @JsonDeserialize(builder = GoogleMaps.Builder.class) public abstract class GoogleMaps extends JsonSerializable { @@ -37,7 +37,11 @@ public abstract class GoogleMaps extends JsonSerializable { @JsonProperty("authConfig") public abstract Optional authConfig(); - /** Optional. If true, include the widget context token in the response. */ + /** + * Optional. Whether to return a widget context token in the GroundingMetadata of the response. + * Developers can use the widget context token to render a Google Maps widget with geospatial + * context related to the places that the model references in the response. + */ @JsonProperty("enableWidget") public abstract Optional enableWidget(); @@ -92,7 +96,9 @@ public Builder clearAuthConfig() { /** * Setter for enableWidget. * - *

enableWidget: Optional. If true, include the widget context token in the response. + *

enableWidget: Optional. Whether to return a widget context token in the GroundingMetadata + * of the response. Developers can use the widget context token to render a Google Maps widget + * with geospatial context related to the places that the model references in the response. */ @JsonProperty("enableWidget") public abstract Builder enableWidget(boolean enableWidget); diff --git a/src/main/java/com/google/genai/types/GoogleSearch.java b/src/main/java/com/google/genai/types/GoogleSearch.java index 0427e957229..5445271d794 100644 --- a/src/main/java/com/google/genai/types/GoogleSearch.java +++ b/src/main/java/com/google/genai/types/GoogleSearch.java @@ -32,13 +32,6 @@ @AutoValue @JsonDeserialize(builder = GoogleSearch.Builder.class) public abstract class GoogleSearch extends JsonSerializable { - /** - * Optional. List of domains to be excluded from the search results. The default limit is 2000 - * domains. Example: ["amazon.com", "facebook.com"]. This field is not supported in Gemini API. - */ - @JsonProperty("excludeDomains") - public abstract Optional> excludeDomains(); - /** * Optional. Sites with confidence level chosen & above this value will be blocked from the search * results. This field is not supported in Gemini API. @@ -46,6 +39,13 @@ public abstract class GoogleSearch extends JsonSerializable { @JsonProperty("blockingConfidence") public abstract Optional blockingConfidence(); + /** + * Optional. List of domains to be excluded from the search results. The default limit is 2000 + * domains. Example: ["amazon.com", "facebook.com"]. This field is not supported in Gemini API. + */ + @JsonProperty("excludeDomains") + public abstract Optional> excludeDomains(); + /** * 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. @@ -71,38 +71,6 @@ private static Builder create() { return new AutoValue_GoogleSearch.Builder(); } - /** - * Setter for excludeDomains. - * - *

excludeDomains: Optional. List of domains to be excluded from the search results. The - * default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. This field is not - * supported in Gemini API. - */ - @JsonProperty("excludeDomains") - public abstract Builder excludeDomains(List excludeDomains); - - /** - * Setter for excludeDomains. - * - *

excludeDomains: Optional. List of domains to be excluded from the search results. The - * default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. This field is not - * supported in Gemini API. - */ - @CanIgnoreReturnValue - public Builder excludeDomains(String... excludeDomains) { - return excludeDomains(Arrays.asList(excludeDomains)); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder excludeDomains(Optional> excludeDomains); - - /** Clears the value of excludeDomains field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearExcludeDomains() { - return excludeDomains(Optional.empty()); - } - /** * Setter for blockingConfidence. * @@ -144,6 +112,38 @@ public Builder blockingConfidence(String blockingConfidence) { return blockingConfidence(new PhishBlockThreshold(blockingConfidence)); } + /** + * Setter for excludeDomains. + * + *

excludeDomains: Optional. List of domains to be excluded from the search results. The + * default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. This field is not + * supported in Gemini API. + */ + @JsonProperty("excludeDomains") + public abstract Builder excludeDomains(List excludeDomains); + + /** + * Setter for excludeDomains. + * + *

excludeDomains: Optional. List of domains to be excluded from the search results. The + * default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. This field is not + * supported in Gemini API. + */ + @CanIgnoreReturnValue + public Builder excludeDomains(String... excludeDomains) { + return excludeDomains(Arrays.asList(excludeDomains)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder excludeDomains(Optional> excludeDomains); + + /** Clears the value of excludeDomains field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExcludeDomains() { + return excludeDomains(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 d9a8ed0121e..827a8e3e06d 100644 --- a/src/main/java/com/google/genai/types/GroundingChunk.java +++ b/src/main/java/com/google/genai/types/GroundingChunk.java @@ -26,22 +26,30 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Grounding chunk. */ +/** A chunk of evidence that was used to generate the response. */ @AutoValue @JsonDeserialize(builder = GroundingChunk.Builder.class) public abstract class GroundingChunk extends JsonSerializable { - /** Grounding chunk from Google Maps. This field is not supported in Gemini API. */ + /** + * A `Maps` chunk is a piece of evidence that comes from Google Maps. + * + *

It contains information about a place, such as its name, address, and reviews. This is used + * to provide the user with rich, location-based information. + */ @JsonProperty("maps") public abstract Optional maps(); /** - * Grounding chunk from context retrieved by the retrieval tools. This field is not supported in - * Gemini API. + * A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. + * See the `RetrievedContext` message for details */ @JsonProperty("retrievedContext") public abstract Optional retrievedContext(); - /** Grounding chunk from the web. */ + /** + * A grounding chunk from a web page, typically from Google Search. See the `Web` message for + * details. + */ @JsonProperty("web") public abstract Optional web(); @@ -66,7 +74,10 @@ private static Builder create() { /** * Setter for maps. * - *

maps: Grounding chunk from Google Maps. This field is not supported in Gemini API. + *

maps: A `Maps` chunk is a piece of evidence that comes from Google Maps. + * + *

It contains information about a place, such as its name, address, and reviews. This is + * used to provide the user with rich, location-based information. */ @JsonProperty("maps") public abstract Builder maps(GroundingChunkMaps maps); @@ -74,7 +85,10 @@ private static Builder create() { /** * Setter for maps builder. * - *

maps: Grounding chunk from Google Maps. This field is not supported in Gemini API. + *

maps: A `Maps` chunk is a piece of evidence that comes from Google Maps. + * + *

It contains information about a place, such as its name, address, and reviews. This is + * used to provide the user with rich, location-based information. */ @CanIgnoreReturnValue public Builder maps(GroundingChunkMaps.Builder mapsBuilder) { @@ -94,8 +108,8 @@ public Builder clearMaps() { /** * Setter for retrievedContext. * - *

retrievedContext: Grounding chunk from context retrieved by the retrieval tools. This - * field is not supported in Gemini API. + *

retrievedContext: A grounding chunk from a data source retrieved by a retrieval tool, such + * as Vertex AI Search. See the `RetrievedContext` message for details */ @JsonProperty("retrievedContext") public abstract Builder retrievedContext(GroundingChunkRetrievedContext retrievedContext); @@ -103,8 +117,8 @@ public Builder clearMaps() { /** * Setter for retrievedContext builder. * - *

retrievedContext: Grounding chunk from context retrieved by the retrieval tools. This - * field is not supported in Gemini API. + *

retrievedContext: A grounding chunk from a data source retrieved by a retrieval tool, such + * as Vertex AI Search. See the `RetrievedContext` message for details */ @CanIgnoreReturnValue public Builder retrievedContext( @@ -125,7 +139,8 @@ public Builder clearRetrievedContext() { /** * Setter for web. * - *

web: Grounding chunk from the web. + *

web: A grounding chunk from a web page, typically from Google Search. See the `Web` + * message for details. */ @JsonProperty("web") public abstract Builder web(GroundingChunkWeb web); @@ -133,7 +148,8 @@ public Builder clearRetrievedContext() { /** * Setter for web builder. * - *

web: Grounding chunk from the web. + *

web: A grounding chunk from a web page, typically from Google Search. See the `Web` + * message for details. */ @CanIgnoreReturnValue public Builder web(GroundingChunkWeb.Builder webBuilder) { diff --git a/src/main/java/com/google/genai/types/GroundingChunkMaps.java b/src/main/java/com/google/genai/types/GroundingChunkMaps.java index 340858796a6..093c16cda99 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkMaps.java +++ b/src/main/java/com/google/genai/types/GroundingChunkMaps.java @@ -26,32 +26,41 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Chunk from Google Maps. This data type is not supported in Gemini API. */ +/** + * A `Maps` chunk is a piece of evidence that comes from Google Maps. + * + *

It contains information about a place, such as its name, address, and reviews. This is used to + * provide the user with rich, location-based information. + */ @AutoValue @JsonDeserialize(builder = GroundingChunkMaps.Builder.class) public abstract class GroundingChunkMaps extends JsonSerializable { /** - * Sources used to generate the place answer. This includes review snippets and photos that were - * used to generate the answer, as well as uris to flag content. + * The sources that were used to generate the place answer. + * + *

This includes review snippets and photos that were used to generate the answer, as well as + * URIs to flag content. */ @JsonProperty("placeAnswerSources") public abstract Optional placeAnswerSources(); /** - * This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place. + * This Place's resource name, in `places/{place_id}` format. + * + *

This can be used to look up the place in the Google Maps API. */ @JsonProperty("placeId") public abstract Optional placeId(); - /** Text of the place answer. */ + /** The text of the place answer. */ @JsonProperty("text") public abstract Optional text(); - /** Title of the place. */ + /** The title of the place. */ @JsonProperty("title") public abstract Optional title(); - /** URI reference of the place. */ + /** The URI of the place. */ @JsonProperty("uri") public abstract Optional uri(); @@ -76,8 +85,10 @@ private static Builder create() { /** * Setter for placeAnswerSources. * - *

placeAnswerSources: Sources used to generate the place answer. This includes review - * snippets and photos that were used to generate the answer, as well as uris to flag content. + *

placeAnswerSources: The sources that were used to generate the place answer. + * + *

This includes review snippets and photos that were used to generate the answer, as well as + * URIs to flag content. */ @JsonProperty("placeAnswerSources") public abstract Builder placeAnswerSources( @@ -86,8 +97,10 @@ public abstract Builder placeAnswerSources( /** * Setter for placeAnswerSources builder. * - *

placeAnswerSources: Sources used to generate the place answer. This includes review - * snippets and photos that were used to generate the answer, as well as uris to flag content. + *

placeAnswerSources: The sources that were used to generate the place answer. + * + *

This includes review snippets and photos that were used to generate the answer, as well as + * URIs to flag content. */ @CanIgnoreReturnValue public Builder placeAnswerSources( @@ -109,8 +122,9 @@ public Builder clearPlaceAnswerSources() { /** * Setter for placeId. * - *

placeId: This Place's resource name, in `places/{place_id}` format. Can be used to look up - * the Place. + *

placeId: This Place's resource name, in `places/{place_id}` format. + * + *

This can be used to look up the place in the Google Maps API. */ @JsonProperty("placeId") public abstract Builder placeId(String placeId); @@ -128,7 +142,7 @@ public Builder clearPlaceId() { /** * Setter for text. * - *

text: Text of the place answer. + *

text: The text of the place answer. */ @JsonProperty("text") public abstract Builder text(String text); @@ -146,7 +160,7 @@ public Builder clearText() { /** * Setter for title. * - *

title: Title of the place. + *

title: The title of the place. */ @JsonProperty("title") public abstract Builder title(String title); @@ -164,7 +178,7 @@ public Builder clearTitle() { /** * Setter for uri. * - *

uri: URI reference of the place. + *

uri: The URI of the place. */ @JsonProperty("uri") public abstract Builder uri(String uri); diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java index 8ac2012054d..971b9dabd7b 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java @@ -30,15 +30,24 @@ import java.util.List; import java.util.Optional; -/** Sources used to generate the place answer. This data type is not supported in Gemini API. */ +/** + * The sources that were used to generate the place answer. + * + *

This includes review snippets and photos that were used to generate the answer, as well as + * URIs to flag content. + */ @AutoValue @JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSources.Builder.class) public abstract class GroundingChunkMapsPlaceAnswerSources extends JsonSerializable { + /** Snippets of reviews that were used to generate the answer. */ + @JsonProperty("reviewSnippet") + public abstract Optional> reviewSnippet(); + /** A link where users can flag a problem with the generated answer. */ @JsonProperty("flagContentUri") public abstract Optional flagContentUri(); - /** Snippets of reviews that are used to generate the answer. */ + /** Snippets of reviews that were used to generate the answer. */ @JsonProperty("reviewSnippets") public abstract Optional> reviewSnippets(); @@ -64,6 +73,51 @@ private static Builder create() { return new AutoValue_GroundingChunkMapsPlaceAnswerSources.Builder(); } + /** + * Setter for reviewSnippet. + * + *

reviewSnippet: Snippets of reviews that were used to generate the answer. + */ + @JsonProperty("reviewSnippet") + public abstract Builder reviewSnippet( + List reviewSnippet); + + /** + * Setter for reviewSnippet. + * + *

reviewSnippet: Snippets of reviews that were used to generate the answer. + */ + @CanIgnoreReturnValue + public Builder reviewSnippet( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet... reviewSnippet) { + return reviewSnippet(Arrays.asList(reviewSnippet)); + } + + /** + * Setter for reviewSnippet builder. + * + *

reviewSnippet: Snippets of reviews that were used to generate the answer. + */ + @CanIgnoreReturnValue + public Builder reviewSnippet( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder... reviewSnippetBuilders) { + return reviewSnippet( + Arrays.asList(reviewSnippetBuilders).stream() + .map(GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reviewSnippet( + Optional> reviewSnippet); + + /** Clears the value of reviewSnippet field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReviewSnippet() { + return reviewSnippet(Optional.empty()); + } + /** * Setter for flagContentUri. * @@ -85,7 +139,7 @@ public Builder clearFlagContentUri() { /** * Setter for reviewSnippets. * - *

reviewSnippets: Snippets of reviews that are used to generate the answer. + *

reviewSnippets: Snippets of reviews that were used to generate the answer. */ @JsonProperty("reviewSnippets") public abstract Builder reviewSnippets( @@ -94,7 +148,7 @@ public abstract Builder reviewSnippets( /** * Setter for reviewSnippets. * - *

reviewSnippets: Snippets of reviews that are used to generate the answer. + *

reviewSnippets: Snippets of reviews that were used to generate the answer. */ @CanIgnoreReturnValue public Builder reviewSnippets( @@ -105,7 +159,7 @@ public Builder reviewSnippets( /** * Setter for reviewSnippets builder. * - *

reviewSnippets: Snippets of reviews that are used to generate the answer. + *

reviewSnippets: Snippets of reviews that were used to generate the answer. */ @CanIgnoreReturnValue public Builder reviewSnippets( diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java index 8a82b187c3d..a090bce1681 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java @@ -26,7 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Author attribution for a photo or review. This data type is not supported in Gemini API. */ +/** Author attribution for a photo or review. */ @AutoValue @JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.Builder.class) public abstract class GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java index 0c3697266c7..a29e3ca7300 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java @@ -26,7 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Encapsulates a review snippet. This data type is not supported in Gemini API. */ +/** Encapsulates a review snippet. */ @AutoValue @JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder.class) public abstract class GroundingChunkMapsPlaceAnswerSourcesReviewSnippet extends JsonSerializable { diff --git a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java index 9c308c69bb3..afb048e4e5a 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java +++ b/src/main/java/com/google/genai/types/GroundingChunkRetrievedContext.java @@ -27,35 +27,47 @@ import java.util.Optional; /** - * Chunk from context retrieved by the retrieval tools. This data type is not supported in Gemini - * API. + * Context retrieved from a data source to ground the model's response. This is used when a + * retrieval tool fetches information from a user-provided corpus or a public dataset. */ @AutoValue @JsonDeserialize(builder = GroundingChunkRetrievedContext.Builder.class) public abstract class GroundingChunkRetrievedContext extends JsonSerializable { - /** Output only. The full document name for the referenced Vertex AI Search document. */ + /** + * Output only. The full resource name of the referenced Vertex AI Search document. This is used + * to identify the specific document that was retrieved. The format is + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. + * This field is not supported in Gemini API. + */ @JsonProperty("documentName") public abstract Optional documentName(); /** - * Additional context for the RAG retrieval result. This is only populated when using the RAG - * retrieval tool. + * Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is + * populated only when the RAG retrieval tool is used. This field is not supported in Gemini API. */ @JsonProperty("ragChunk") public abstract Optional ragChunk(); - /** Text of the attribution. */ + /** The content of the retrieved data source. */ @JsonProperty("text") public abstract Optional text(); - /** Title of the attribution. */ + /** The title of the retrieved data source. */ @JsonProperty("title") public abstract Optional title(); - /** URI reference of the attribution. */ + /** The URI of the retrieved data source. */ @JsonProperty("uri") public abstract Optional uri(); + /** + * Optional. Name of the `FileSearchStore` containing the document. Example: + * `fileSearchStores/123`. This field is not supported in Vertex AI. + */ + @JsonProperty("fileSearchStore") + public abstract Optional fileSearchStore(); + /** Instantiates a builder for GroundingChunkRetrievedContext. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -79,8 +91,10 @@ private static Builder create() { /** * Setter for documentName. * - *

documentName: Output only. The full document name for the referenced Vertex AI Search - * document. + *

documentName: Output only. The full resource name of the referenced Vertex AI Search + * document. This is used to identify the specific document that was retrieved. The format is + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. + * This field is not supported in Gemini API. */ @JsonProperty("documentName") public abstract Builder documentName(String documentName); @@ -98,8 +112,9 @@ public Builder clearDocumentName() { /** * Setter for ragChunk. * - *

ragChunk: Additional context for the RAG retrieval result. This is only populated when - * using the RAG retrieval tool. + *

ragChunk: Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. + * This is populated only when the RAG retrieval tool is used. This field is not supported in + * Gemini API. */ @JsonProperty("ragChunk") public abstract Builder ragChunk(RagChunk ragChunk); @@ -107,8 +122,9 @@ public Builder clearDocumentName() { /** * Setter for ragChunk builder. * - *

ragChunk: Additional context for the RAG retrieval result. This is only populated when - * using the RAG retrieval tool. + *

ragChunk: Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. + * This is populated only when the RAG retrieval tool is used. This field is not supported in + * Gemini API. */ @CanIgnoreReturnValue public Builder ragChunk(RagChunk.Builder ragChunkBuilder) { @@ -128,7 +144,7 @@ public Builder clearRagChunk() { /** * Setter for text. * - *

text: Text of the attribution. + *

text: The content of the retrieved data source. */ @JsonProperty("text") public abstract Builder text(String text); @@ -146,7 +162,7 @@ public Builder clearText() { /** * Setter for title. * - *

title: Title of the attribution. + *

title: The title of the retrieved data source. */ @JsonProperty("title") public abstract Builder title(String title); @@ -164,7 +180,7 @@ public Builder clearTitle() { /** * Setter for uri. * - *

uri: URI reference of the attribution. + *

uri: The URI of the retrieved data source. */ @JsonProperty("uri") public abstract Builder uri(String uri); @@ -179,6 +195,25 @@ public Builder clearUri() { return uri(Optional.empty()); } + /** + * Setter for fileSearchStore. + * + *

fileSearchStore: Optional. Name of the `FileSearchStore` containing the document. Example: + * `fileSearchStores/123`. This field is not supported in Vertex AI. + */ + @JsonProperty("fileSearchStore") + public abstract Builder fileSearchStore(String fileSearchStore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fileSearchStore(Optional fileSearchStore); + + /** Clears the value of fileSearchStore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFileSearchStore() { + return fileSearchStore(Optional.empty()); + } + public abstract GroundingChunkRetrievedContext build(); } diff --git a/src/main/java/com/google/genai/types/GroundingChunkWeb.java b/src/main/java/com/google/genai/types/GroundingChunkWeb.java index ed497edce0c..0aaa647111a 100644 --- a/src/main/java/com/google/genai/types/GroundingChunkWeb.java +++ b/src/main/java/com/google/genai/types/GroundingChunkWeb.java @@ -26,19 +26,26 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Chunk from the web. */ +/** + * A `Web` chunk is a piece of evidence that comes from a web page. It contains the URI of the web + * page, the title of the page, and the domain of the page. This is used to provide the user with a + * link to the source of the information. + */ @AutoValue @JsonDeserialize(builder = GroundingChunkWeb.Builder.class) public abstract class GroundingChunkWeb extends JsonSerializable { - /** Domain of the (original) URI. This field is not supported in Gemini API. */ + /** + * The domain of the web page that contains the evidence. This can be used to filter out + * low-quality sources. This field is not supported in Gemini API. + */ @JsonProperty("domain") public abstract Optional domain(); - /** Title of the chunk. */ + /** The title of the web page that contains the evidence. */ @JsonProperty("title") public abstract Optional title(); - /** URI reference of the chunk. */ + /** The URI of the web page that contains the evidence. */ @JsonProperty("uri") public abstract Optional uri(); @@ -63,7 +70,8 @@ private static Builder create() { /** * Setter for domain. * - *

domain: Domain of the (original) URI. This field is not supported in Gemini API. + *

domain: The domain of the web page that contains the evidence. This can be used to filter + * out low-quality sources. This field is not supported in Gemini API. */ @JsonProperty("domain") public abstract Builder domain(String domain); @@ -81,7 +89,7 @@ public Builder clearDomain() { /** * Setter for title. * - *

title: Title of the chunk. + *

title: The title of the web page that contains the evidence. */ @JsonProperty("title") public abstract Builder title(String title); @@ -99,7 +107,7 @@ public Builder clearTitle() { /** * Setter for uri. * - *

uri: URI reference of the chunk. + *

uri: The URI of the web page that contains the evidence. */ @JsonProperty("uri") public abstract Builder uri(String uri); diff --git a/src/main/java/com/google/genai/types/GroundingMetadata.java b/src/main/java/com/google/genai/types/GroundingMetadata.java index d38ef727cca..c8900b137ce 100644 --- a/src/main/java/com/google/genai/types/GroundingMetadata.java +++ b/src/main/java/com/google/genai/types/GroundingMetadata.java @@ -34,47 +34,49 @@ @AutoValue @JsonDeserialize(builder = GroundingMetadata.Builder.class) public abstract class GroundingMetadata extends JsonSerializable { - /** - * Optional. Output only. Resource name of the Google Maps widget context token to be used with - * the PlacesContextElement widget to render contextual data. This is populated only for Google - * Maps grounding. This field is not supported in Gemini API. - */ - @JsonProperty("googleMapsWidgetContextToken") - public abstract Optional googleMapsWidgetContextToken(); - /** List of supporting references retrieved from specified grounding source. */ @JsonProperty("groundingChunks") public abstract Optional> groundingChunks(); - /** Optional. List of grounding support. */ + /** List of grounding support. */ @JsonProperty("groundingSupports") public abstract Optional> groundingSupports(); - /** Optional. Output only. Retrieval metadata. */ + /** Metadata related to retrieval in the grounding flow. */ @JsonProperty("retrievalMetadata") public abstract Optional retrievalMetadata(); + /** Optional. Google search entry for the following-up web searches. */ + @JsonProperty("searchEntryPoint") + public abstract Optional searchEntryPoint(); + + /** Web search queries for the following-up web search. */ + @JsonProperty("webSearchQueries") + public abstract Optional> webSearchQueries(); + + /** + * Optional. Output only. A token that can be used to render a Google Maps widget with the + * contextual data. This field is populated only when the grounding source is Google Maps. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Optional googleMapsWidgetContextToken(); + /** - * Optional. Queries executed by the retrieval tools. This field is not supported in Gemini API. + * 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 + * supported in Gemini API. */ @JsonProperty("retrievalQueries") public abstract Optional> retrievalQueries(); - /** Optional. Google search entry for the following-up web searches. */ - @JsonProperty("searchEntryPoint") - public abstract Optional searchEntryPoint(); - /** - * Optional. Output only. List of source flagging uris. This is currently populated only for - * Google Maps grounding. This field is not supported in Gemini API. + * Optional. Output only. A list of URIs that can be used to flag a place or review for + * inappropriate content. This field is populated only when the grounding source is Google Maps. + * This field is not supported in Gemini API. */ @JsonProperty("sourceFlaggingUris") public abstract Optional> sourceFlaggingUris(); - /** Optional. Web search queries for the following-up web search. */ - @JsonProperty("webSearchQueries") - public abstract Optional> webSearchQueries(); - /** Instantiates a builder for GroundingMetadata. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -93,27 +95,6 @@ private static Builder create() { return new AutoValue_GroundingMetadata.Builder(); } - /** - * Setter for googleMapsWidgetContextToken. - * - *

googleMapsWidgetContextToken: Optional. Output only. Resource name of the Google Maps - * widget context token to be used with the PlacesContextElement widget to render contextual - * data. This is populated only for Google Maps grounding. This field is not supported in Gemini - * API. - */ - @JsonProperty("googleMapsWidgetContextToken") - public abstract Builder googleMapsWidgetContextToken(String googleMapsWidgetContextToken); - - @ExcludeFromGeneratedCoverageReport - abstract Builder googleMapsWidgetContextToken(Optional googleMapsWidgetContextToken); - - /** Clears the value of googleMapsWidgetContextToken field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearGoogleMapsWidgetContextToken() { - return googleMapsWidgetContextToken(Optional.empty()); - } - /** * Setter for groundingChunks. * @@ -158,7 +139,7 @@ public Builder clearGroundingChunks() { /** * Setter for groundingSupports. * - *

groundingSupports: Optional. List of grounding support. + *

groundingSupports: List of grounding support. */ @JsonProperty("groundingSupports") public abstract Builder groundingSupports(List groundingSupports); @@ -166,7 +147,7 @@ public Builder clearGroundingChunks() { /** * Setter for groundingSupports. * - *

groundingSupports: Optional. List of grounding support. + *

groundingSupports: List of grounding support. */ @CanIgnoreReturnValue public Builder groundingSupports(GroundingSupport... groundingSupports) { @@ -176,7 +157,7 @@ public Builder groundingSupports(GroundingSupport... groundingSupports) { /** * Setter for groundingSupports builder. * - *

groundingSupports: Optional. List of grounding support. + *

groundingSupports: List of grounding support. */ @CanIgnoreReturnValue public Builder groundingSupports(GroundingSupport.Builder... groundingSupportsBuilders) { @@ -199,7 +180,7 @@ public Builder clearGroundingSupports() { /** * Setter for retrievalMetadata. * - *

retrievalMetadata: Optional. Output only. Retrieval metadata. + *

retrievalMetadata: Metadata related to retrieval in the grounding flow. */ @JsonProperty("retrievalMetadata") public abstract Builder retrievalMetadata(RetrievalMetadata retrievalMetadata); @@ -207,7 +188,7 @@ public Builder clearGroundingSupports() { /** * Setter for retrievalMetadata builder. * - *

retrievalMetadata: Optional. Output only. Retrieval metadata. + *

retrievalMetadata: Metadata related to retrieval in the grounding flow. */ @CanIgnoreReturnValue public Builder retrievalMetadata(RetrievalMetadata.Builder retrievalMetadataBuilder) { @@ -225,68 +206,119 @@ public Builder clearRetrievalMetadata() { } /** - * Setter for retrievalQueries. + * Setter for searchEntryPoint. * - *

retrievalQueries: Optional. Queries executed by the retrieval tools. This field is not - * supported in Gemini API. + *

searchEntryPoint: Optional. Google search entry for the following-up web searches. */ - @JsonProperty("retrievalQueries") - public abstract Builder retrievalQueries(List retrievalQueries); + @JsonProperty("searchEntryPoint") + public abstract Builder searchEntryPoint(SearchEntryPoint searchEntryPoint); /** - * Setter for retrievalQueries. + * Setter for searchEntryPoint builder. * - *

retrievalQueries: Optional. Queries executed by the retrieval tools. This field is not - * supported in Gemini API. + *

searchEntryPoint: Optional. Google search entry for the following-up web searches. */ @CanIgnoreReturnValue - public Builder retrievalQueries(String... retrievalQueries) { - return retrievalQueries(Arrays.asList(retrievalQueries)); + public Builder searchEntryPoint(SearchEntryPoint.Builder searchEntryPointBuilder) { + return searchEntryPoint(searchEntryPointBuilder.build()); } @ExcludeFromGeneratedCoverageReport - abstract Builder retrievalQueries(Optional> retrievalQueries); + abstract Builder searchEntryPoint(Optional searchEntryPoint); - /** Clears the value of retrievalQueries field. */ + /** Clears the value of searchEntryPoint field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearRetrievalQueries() { - return retrievalQueries(Optional.empty()); + public Builder clearSearchEntryPoint() { + return searchEntryPoint(Optional.empty()); } /** - * Setter for searchEntryPoint. + * Setter for webSearchQueries. * - *

searchEntryPoint: Optional. Google search entry for the following-up web searches. + *

webSearchQueries: Web search queries for the following-up web search. */ - @JsonProperty("searchEntryPoint") - public abstract Builder searchEntryPoint(SearchEntryPoint searchEntryPoint); + @JsonProperty("webSearchQueries") + public abstract Builder webSearchQueries(List webSearchQueries); /** - * Setter for searchEntryPoint builder. + * Setter for webSearchQueries. * - *

searchEntryPoint: Optional. Google search entry for the following-up web searches. + *

webSearchQueries: Web search queries for the following-up web search. */ @CanIgnoreReturnValue - public Builder searchEntryPoint(SearchEntryPoint.Builder searchEntryPointBuilder) { - return searchEntryPoint(searchEntryPointBuilder.build()); + public Builder webSearchQueries(String... webSearchQueries) { + return webSearchQueries(Arrays.asList(webSearchQueries)); } @ExcludeFromGeneratedCoverageReport - abstract Builder searchEntryPoint(Optional searchEntryPoint); + abstract Builder webSearchQueries(Optional> webSearchQueries); - /** Clears the value of searchEntryPoint field. */ + /** Clears the value of webSearchQueries field. */ @ExcludeFromGeneratedCoverageReport @CanIgnoreReturnValue - public Builder clearSearchEntryPoint() { - return searchEntryPoint(Optional.empty()); + public Builder clearWebSearchQueries() { + return webSearchQueries(Optional.empty()); + } + + /** + * Setter for googleMapsWidgetContextToken. + * + *

googleMapsWidgetContextToken: Optional. Output only. A token that can be used to render a + * Google Maps widget with the contextual data. This field is populated only when the grounding + * source is Google Maps. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Builder googleMapsWidgetContextToken(String googleMapsWidgetContextToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleMapsWidgetContextToken(Optional googleMapsWidgetContextToken); + + /** Clears the value of googleMapsWidgetContextToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleMapsWidgetContextToken() { + return googleMapsWidgetContextToken(Optional.empty()); + } + + /** + * Setter for retrievalQueries. + * + *

retrievalQueries: 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 supported in Gemini API. + */ + @JsonProperty("retrievalQueries") + public abstract Builder retrievalQueries(List retrievalQueries); + + /** + * Setter for retrievalQueries. + * + *

retrievalQueries: 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 supported in Gemini API. + */ + @CanIgnoreReturnValue + public Builder retrievalQueries(String... retrievalQueries) { + return retrievalQueries(Arrays.asList(retrievalQueries)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievalQueries(Optional> retrievalQueries); + + /** Clears the value of retrievalQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievalQueries() { + return retrievalQueries(Optional.empty()); } /** * Setter for sourceFlaggingUris. * - *

sourceFlaggingUris: Optional. Output only. List of source flagging uris. This is currently - * populated only for Google Maps grounding. This field is not supported in Gemini API. + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. This field is not supported in Gemini API. */ @JsonProperty("sourceFlaggingUris") public abstract Builder sourceFlaggingUris( @@ -295,8 +327,9 @@ public abstract Builder sourceFlaggingUris( /** * Setter for sourceFlaggingUris. * - *

sourceFlaggingUris: Optional. Output only. List of source flagging uris. This is currently - * populated only for Google Maps grounding. This field is not supported in Gemini API. + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. This field is not supported in Gemini API. */ @CanIgnoreReturnValue public Builder sourceFlaggingUris(GroundingMetadataSourceFlaggingUri... sourceFlaggingUris) { @@ -306,8 +339,9 @@ public Builder sourceFlaggingUris(GroundingMetadataSourceFlaggingUri... sourceFl /** * Setter for sourceFlaggingUris builder. * - *

sourceFlaggingUris: Optional. Output only. List of source flagging uris. This is currently - * populated only for Google Maps grounding. This field is not supported in Gemini API. + *

sourceFlaggingUris: Optional. Output only. A list of URIs that can be used to flag a place + * or review for inappropriate content. This field is populated only when the grounding source + * is Google Maps. This field is not supported in Gemini API. */ @CanIgnoreReturnValue public Builder sourceFlaggingUris( @@ -329,34 +363,6 @@ public Builder clearSourceFlaggingUris() { return sourceFlaggingUris(Optional.empty()); } - /** - * Setter for webSearchQueries. - * - *

webSearchQueries: Optional. Web search queries for the following-up web search. - */ - @JsonProperty("webSearchQueries") - public abstract Builder webSearchQueries(List webSearchQueries); - - /** - * Setter for webSearchQueries. - * - *

webSearchQueries: Optional. Web search queries for the following-up web search. - */ - @CanIgnoreReturnValue - public Builder webSearchQueries(String... webSearchQueries) { - return webSearchQueries(Arrays.asList(webSearchQueries)); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder webSearchQueries(Optional> webSearchQueries); - - /** Clears the value of webSearchQueries field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearWebSearchQueries() { - return webSearchQueries(Optional.empty()); - } - public abstract GroundingMetadata build(); } diff --git a/src/main/java/com/google/genai/types/GroundingMetadataSourceFlaggingUri.java b/src/main/java/com/google/genai/types/GroundingMetadataSourceFlaggingUri.java index 3502e503f48..e6e89599e60 100644 --- a/src/main/java/com/google/genai/types/GroundingMetadataSourceFlaggingUri.java +++ b/src/main/java/com/google/genai/types/GroundingMetadataSourceFlaggingUri.java @@ -27,17 +27,17 @@ import java.util.Optional; /** - * Source content flagging uri for a place or review. This is currently populated only for Google - * Maps grounding. This data type is not supported in Gemini API. + * A URI that can be used to flag a place or review for inappropriate content. This is populated + * only when the grounding source is Google Maps. This data type is not supported in Gemini API. */ @AutoValue @JsonDeserialize(builder = GroundingMetadataSourceFlaggingUri.Builder.class) public abstract class GroundingMetadataSourceFlaggingUri extends JsonSerializable { - /** A link where users can flag a problem with the source (place or review). */ + /** The URI that can be used to flag the content. */ @JsonProperty("flagContentUri") public abstract Optional flagContentUri(); - /** Id of the place or review. */ + /** The ID of the place or review. */ @JsonProperty("sourceId") public abstract Optional sourceId(); @@ -65,7 +65,7 @@ private static Builder create() { /** * Setter for flagContentUri. * - *

flagContentUri: A link where users can flag a problem with the source (place or review). + *

flagContentUri: The URI that can be used to flag the content. */ @JsonProperty("flagContentUri") public abstract Builder flagContentUri(String flagContentUri); @@ -83,7 +83,7 @@ public Builder clearFlagContentUri() { /** * Setter for sourceId. * - *

sourceId: Id of the place or review. + *

sourceId: The ID of the place or review. */ @JsonProperty("sourceId") public abstract Builder sourceId(String sourceId); diff --git a/src/main/java/com/google/genai/types/GroundingSupport.java b/src/main/java/com/google/genai/types/GroundingSupport.java index 7e81436b70c..4cb365e47e8 100644 --- a/src/main/java/com/google/genai/types/GroundingSupport.java +++ b/src/main/java/com/google/genai/types/GroundingSupport.java @@ -33,9 +33,10 @@ @JsonDeserialize(builder = GroundingSupport.Builder.class) public abstract class GroundingSupport extends JsonSerializable { /** - * Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For - * Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For - * Gemini 2.5 and after, this list will be empty and should be ignored. + * Confidence score of the support references. + * + *

Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the + * grounding_chunk_indices. */ @JsonProperty("confidenceScores") public abstract Optional> confidenceScores(); @@ -73,10 +74,10 @@ private static Builder create() { /** * Setter for confidenceScores. * - *

confidenceScores: Confidence score of the support references. Ranges from 0 to 1. 1 is the - * most confident. For Gemini 2.0 and before, this list must have the same size as the - * grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be - * ignored. + *

confidenceScores: Confidence score of the support references. + * + *

Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the + * grounding_chunk_indices. */ @JsonProperty("confidenceScores") public abstract Builder confidenceScores(List confidenceScores); @@ -84,10 +85,10 @@ private static Builder create() { /** * Setter for confidenceScores. * - *

confidenceScores: Confidence score of the support references. Ranges from 0 to 1. 1 is the - * most confident. For Gemini 2.0 and before, this list must have the same size as the - * grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be - * ignored. + *

confidenceScores: Confidence score of the support references. + * + *

Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the + * grounding_chunk_indices. */ @CanIgnoreReturnValue public Builder confidenceScores(Float... confidenceScores) { diff --git a/src/main/java/com/google/genai/types/HarmBlockMethod.java b/src/main/java/com/google/genai/types/HarmBlockMethod.java index 5e44259b323..04df7d1e70c 100644 --- a/src/main/java/com/google/genai/types/HarmBlockMethod.java +++ b/src/main/java/com/google/genai/types/HarmBlockMethod.java @@ -24,8 +24,8 @@ import java.util.Objects; /** - * Specify if the threshold is used for probability or severity score. If not specified, the - * threshold is used for probability score. This enum is not supported in Gemini API. + * The method for blocking content. If not specified, the default behavior is to use the probability + * score. This enum is not supported in Gemini API. */ public class HarmBlockMethod { diff --git a/src/main/java/com/google/genai/types/HarmBlockThreshold.java b/src/main/java/com/google/genai/types/HarmBlockThreshold.java index 7c7b9f440be..ebd1c2cfe62 100644 --- a/src/main/java/com/google/genai/types/HarmBlockThreshold.java +++ b/src/main/java/com/google/genai/types/HarmBlockThreshold.java @@ -23,27 +23,30 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** The harm block threshold. */ +/** + * The threshold for blocking content. If the harm probability exceeds this threshold, the content + * will be blocked. + */ public class HarmBlockThreshold { /** Enum representing the known values for HarmBlockThreshold. */ public enum Known { - /** Unspecified harm block threshold. */ + /** The harm block threshold is unspecified. */ HARM_BLOCK_THRESHOLD_UNSPECIFIED, - /** Block low threshold and above (i.e. block more). */ + /** Block content with a low harm probability or higher. */ BLOCK_LOW_AND_ABOVE, - /** Block medium threshold and above. */ + /** Block content with a medium harm probability or higher. */ BLOCK_MEDIUM_AND_ABOVE, - /** Block only high threshold (i.e. block less). */ + /** Block content with a high harm probability. */ BLOCK_ONLY_HIGH, - /** Block none. */ + /** Do not block any content, regardless of its harm probability. */ BLOCK_NONE, - /** Turn off the safety filter. */ + /** Turn off the safety filter entirely. */ OFF } diff --git a/src/main/java/com/google/genai/types/HarmCategory.java b/src/main/java/com/google/genai/types/HarmCategory.java index 95a7e942fca..d28271667be 100644 --- a/src/main/java/com/google/genai/types/HarmCategory.java +++ b/src/main/java/com/google/genai/types/HarmCategory.java @@ -23,24 +23,27 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Harm category. */ +/** The harm category to be blocked. */ public class HarmCategory { /** Enum representing the known values for HarmCategory. */ public enum Known { - /** The harm category is unspecified. */ + /** Default value. This value is unused. */ HARM_CATEGORY_UNSPECIFIED, - /** The harm category is harassment. */ + /** Abusive, threatening, or content intended to bully, torment, or ridicule. */ HARM_CATEGORY_HARASSMENT, - /** The harm category is hate speech. */ + /** + * Content that promotes violence or incites hatred against individuals or groups based on + * certain attributes. + */ HARM_CATEGORY_HATE_SPEECH, - /** The harm category is sexually explicit content. */ + /** Content that contains sexually explicit material. */ HARM_CATEGORY_SEXUALLY_EXPLICIT, - /** The harm category is dangerous content. */ + /** Content that promotes, facilitates, or enables dangerous activities. */ HARM_CATEGORY_DANGEROUS_CONTENT, /** @@ -48,25 +51,23 @@ public enum Known { */ HARM_CATEGORY_CIVIC_INTEGRITY, - /** The harm category is image hate. This enum value is not supported in Gemini API. */ + /** Images that contain hate speech. This enum value is not supported in Gemini API. */ HARM_CATEGORY_IMAGE_HATE, - /** - * The harm category is image dangerous content. This enum value is not supported in Gemini API. - */ + /** Images that contain dangerous content. This enum value is not supported in Gemini API. */ HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT, - /** The harm category is image harassment. This enum value is not supported in Gemini API. */ + /** Images that contain harassment. This enum value is not supported in Gemini API. */ HARM_CATEGORY_IMAGE_HARASSMENT, /** - * The harm category is image sexually explicit content. This enum value is not supported in - * Gemini API. + * Images that contain sexually explicit content. This enum value is not supported in Gemini + * API. */ HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT, /** - * The harm category is for jailbreak prompts. This enum value is not supported in Gemini API. + * Prompts designed to bypass safety filters. This enum value is not supported in Gemini API. */ HARM_CATEGORY_JAILBREAK } diff --git a/src/main/java/com/google/genai/types/HarmProbability.java b/src/main/java/com/google/genai/types/HarmProbability.java index b2d94f46a5b..49c85b88a58 100644 --- a/src/main/java/com/google/genai/types/HarmProbability.java +++ b/src/main/java/com/google/genai/types/HarmProbability.java @@ -23,24 +23,24 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Output only. Harm probability levels in the content. */ +/** Output only. The probability of harm for this category. */ public class HarmProbability { /** Enum representing the known values for HarmProbability. */ public enum Known { - /** Harm probability unspecified. */ + /** The harm probability is unspecified. */ HARM_PROBABILITY_UNSPECIFIED, - /** Negligible level of harm. */ + /** The harm probability is negligible. */ NEGLIGIBLE, - /** Low level of harm. */ + /** The harm probability is low. */ LOW, - /** Medium level of harm. */ + /** The harm probability is medium. */ MEDIUM, - /** High level of harm. */ + /** The harm probability is high. */ HIGH } diff --git a/src/main/java/com/google/genai/types/HarmSeverity.java b/src/main/java/com/google/genai/types/HarmSeverity.java index 9dba676bf1a..f8493cb1b5c 100644 --- a/src/main/java/com/google/genai/types/HarmSeverity.java +++ b/src/main/java/com/google/genai/types/HarmSeverity.java @@ -23,24 +23,26 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */ +/** + * Output only. The severity of harm for this category. This enum is not supported in Gemini API. + */ public class HarmSeverity { /** Enum representing the known values for HarmSeverity. */ public enum Known { - /** Harm severity unspecified. */ + /** The harm severity is unspecified. */ HARM_SEVERITY_UNSPECIFIED, - /** Negligible level of harm severity. */ + /** The harm severity is negligible. */ HARM_SEVERITY_NEGLIGIBLE, - /** Low level of harm severity. */ + /** The harm severity is low. */ HARM_SEVERITY_LOW, - /** Medium level of harm severity. */ + /** The harm severity is medium. */ HARM_SEVERITY_MEDIUM, - /** High level of harm severity. */ + /** The harm severity is high. */ HARM_SEVERITY_HIGH } diff --git a/src/main/java/com/google/genai/types/ImageConfig.java b/src/main/java/com/google/genai/types/ImageConfig.java index d11a38a9cf7..ea93b039394 100644 --- a/src/main/java/com/google/genai/types/ImageConfig.java +++ b/src/main/java/com/google/genai/types/ImageConfig.java @@ -61,6 +61,13 @@ public abstract class ImageConfig extends JsonSerializable { @JsonProperty("outputCompressionQuality") public abstract Optional outputCompressionQuality(); + /** + * Optional. The image output format for generated images. This field is not supported in Gemini + * API. + */ + @JsonProperty("imageOutputOptions") + public abstract Optional imageOutputOptions(); + /** Instantiates a builder for ImageConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -174,6 +181,37 @@ public Builder clearOutputCompressionQuality() { return outputCompressionQuality(Optional.empty()); } + /** + * Setter for imageOutputOptions. + * + *

imageOutputOptions: Optional. The image output format for generated images. This field is + * not supported in Gemini API. + */ + @JsonProperty("imageOutputOptions") + public abstract Builder imageOutputOptions(ImageConfigImageOutputOptions imageOutputOptions); + + /** + * Setter for imageOutputOptions builder. + * + *

imageOutputOptions: Optional. The image output format for generated images. This field is + * not supported in Gemini API. + */ + @CanIgnoreReturnValue + public Builder imageOutputOptions( + ImageConfigImageOutputOptions.Builder imageOutputOptionsBuilder) { + return imageOutputOptions(imageOutputOptionsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder imageOutputOptions(Optional imageOutputOptions); + + /** Clears the value of imageOutputOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImageOutputOptions() { + return imageOutputOptions(Optional.empty()); + } + public abstract ImageConfig build(); } diff --git a/src/main/java/com/google/genai/types/ImageConfigImageOutputOptions.java b/src/main/java/com/google/genai/types/ImageConfigImageOutputOptions.java new file mode 100644 index 00000000000..d5e4c544f63 --- /dev/null +++ b/src/main/java/com/google/genai/types/ImageConfigImageOutputOptions.java @@ -0,0 +1,105 @@ +/* + * 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; + +/** The image output format for generated images. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = ImageConfigImageOutputOptions.Builder.class) +public abstract class ImageConfigImageOutputOptions extends JsonSerializable { + /** Optional. The compression quality of the output image. */ + @JsonProperty("compressionQuality") + public abstract Optional compressionQuality(); + + /** Optional. The image format that the output should be saved as. */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + + /** Instantiates a builder for ImageConfigImageOutputOptions. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ImageConfigImageOutputOptions.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ImageConfigImageOutputOptions. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ImageConfigImageOutputOptions.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ImageConfigImageOutputOptions.Builder(); + } + + /** + * Setter for compressionQuality. + * + *

compressionQuality: Optional. The compression quality of the output image. + */ + @JsonProperty("compressionQuality") + public abstract Builder compressionQuality(Integer compressionQuality); + + @ExcludeFromGeneratedCoverageReport + abstract Builder compressionQuality(Optional compressionQuality); + + /** Clears the value of compressionQuality field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCompressionQuality() { + return compressionQuality(Optional.empty()); + } + + /** + * Setter for mimeType. + * + *

mimeType: Optional. The image format that the output should be saved as. + */ + @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 ImageConfigImageOutputOptions build(); + } + + /** Deserializes a JSON string to a ImageConfigImageOutputOptions object. */ + @ExcludeFromGeneratedCoverageReport + public static ImageConfigImageOutputOptions fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ImageConfigImageOutputOptions.class); + } +} diff --git a/src/main/java/com/google/genai/types/InlinedEmbedContentResponse.java b/src/main/java/com/google/genai/types/InlinedEmbedContentResponse.java index 2e2b422674e..aa706a5816c 100644 --- a/src/main/java/com/google/genai/types/InlinedEmbedContentResponse.java +++ b/src/main/java/com/google/genai/types/InlinedEmbedContentResponse.java @@ -24,6 +24,7 @@ import com.google.auto.value.AutoValue; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.genai.JsonSerializable; +import java.util.Map; import java.util.Optional; /** Config for `inlined_embedding_responses` parameter. */ @@ -38,6 +39,10 @@ public abstract class InlinedEmbedContentResponse extends JsonSerializable { @JsonProperty("error") public abstract Optional error(); + /** Output only. The metadata associated with the request. */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + /** Instantiates a builder for InlinedEmbedContentResponse. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -112,6 +117,24 @@ public Builder clearError() { return error(Optional.empty()); } + /** + * Setter for metadata. + * + *

metadata: Output only. The metadata associated with the request. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + public abstract InlinedEmbedContentResponse build(); } diff --git a/src/main/java/com/google/genai/types/ListFileSearchStoresResponse.java b/src/main/java/com/google/genai/types/ListFileSearchStoresResponse.java index d5ac788e9be..e1478d26658 100644 --- a/src/main/java/com/google/genai/types/ListFileSearchStoresResponse.java +++ b/src/main/java/com/google/genai/types/ListFileSearchStoresResponse.java @@ -38,7 +38,10 @@ public abstract class ListFileSearchStoresResponse extends JsonSerializable { @JsonProperty("sdkHttpResponse") public abstract Optional sdkHttpResponse(); - /** */ + /** + * A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, + * there are no more pages. + */ @JsonProperty("nextPageToken") public abstract Optional nextPageToken(); @@ -97,7 +100,8 @@ public Builder clearSdkHttpResponse() { /** * Setter for nextPageToken. * - *

nextPageToken: + *

nextPageToken: A token, which can be sent as `page_token` to retrieve the next page. If + * this field is omitted, there are no more pages. */ @JsonProperty("nextPageToken") public abstract Builder nextPageToken(String nextPageToken); diff --git a/src/main/java/com/google/genai/types/LogprobsResult.java b/src/main/java/com/google/genai/types/LogprobsResult.java index 746b9097c0b..1f28cf76ced 100644 --- a/src/main/java/com/google/genai/types/LogprobsResult.java +++ b/src/main/java/com/google/genai/types/LogprobsResult.java @@ -30,21 +30,35 @@ import java.util.List; import java.util.Optional; -/** Logprobs Result */ +/** + * The log probabilities of the tokens generated by the model. This is useful for understanding the + * model's confidence in its predictions and for debugging. For example, you can use log + * probabilities to identify when the model is making a less confident prediction or to explore + * alternative responses that the model considered. A low log probability can also indicate that the + * model is "hallucinating" or generating factually incorrect information. + */ @AutoValue @JsonDeserialize(builder = LogprobsResult.Builder.class) public abstract class LogprobsResult extends JsonSerializable { /** - * Length = total number of decoding steps. The chosen candidates may or may not be in - * top_candidates. + * A list of the chosen candidate tokens at each decoding step. The length of this list is equal + * to the total number of decoding steps. Note that the chosen candidate might not be in + * `top_candidates`. */ @JsonProperty("chosenCandidates") public abstract Optional> chosenCandidates(); - /** Length = total number of decoding steps. */ + /** + * A list of the top candidate tokens at each decoding step. The length of this list is equal to + * the total number of decoding steps. + */ @JsonProperty("topCandidates") public abstract Optional> topCandidates(); + /** Sum of log probabilities for all tokens. This field is not supported in Vertex AI. */ + @JsonProperty("logProbabilitySum") + public abstract Optional logProbabilitySum(); + /** Instantiates a builder for LogprobsResult. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -66,8 +80,9 @@ private static Builder create() { /** * Setter for chosenCandidates. * - *

chosenCandidates: Length = total number of decoding steps. The chosen candidates may or - * may not be in top_candidates. + *

chosenCandidates: A list of the chosen candidate tokens at each decoding step. The length + * of this list is equal to the total number of decoding steps. Note that the chosen candidate + * might not be in `top_candidates`. */ @JsonProperty("chosenCandidates") public abstract Builder chosenCandidates(List chosenCandidates); @@ -75,8 +90,9 @@ private static Builder create() { /** * Setter for chosenCandidates. * - *

chosenCandidates: Length = total number of decoding steps. The chosen candidates may or - * may not be in top_candidates. + *

chosenCandidates: A list of the chosen candidate tokens at each decoding step. The length + * of this list is equal to the total number of decoding steps. Note that the chosen candidate + * might not be in `top_candidates`. */ @CanIgnoreReturnValue public Builder chosenCandidates(LogprobsResultCandidate... chosenCandidates) { @@ -86,8 +102,9 @@ public Builder chosenCandidates(LogprobsResultCandidate... chosenCandidates) { /** * Setter for chosenCandidates builder. * - *

chosenCandidates: Length = total number of decoding steps. The chosen candidates may or - * may not be in top_candidates. + *

chosenCandidates: A list of the chosen candidate tokens at each decoding step. The length + * of this list is equal to the total number of decoding steps. Note that the chosen candidate + * might not be in `top_candidates`. */ @CanIgnoreReturnValue public Builder chosenCandidates(LogprobsResultCandidate.Builder... chosenCandidatesBuilders) { @@ -110,7 +127,8 @@ public Builder clearChosenCandidates() { /** * Setter for topCandidates. * - *

topCandidates: Length = total number of decoding steps. + *

topCandidates: A list of the top candidate tokens at each decoding step. The length of + * this list is equal to the total number of decoding steps. */ @JsonProperty("topCandidates") public abstract Builder topCandidates(List topCandidates); @@ -118,7 +136,8 @@ public Builder clearChosenCandidates() { /** * Setter for topCandidates. * - *

topCandidates: Length = total number of decoding steps. + *

topCandidates: A list of the top candidate tokens at each decoding step. The length of + * this list is equal to the total number of decoding steps. */ @CanIgnoreReturnValue public Builder topCandidates(LogprobsResultTopCandidates... topCandidates) { @@ -128,7 +147,8 @@ public Builder topCandidates(LogprobsResultTopCandidates... topCandidates) { /** * Setter for topCandidates builder. * - *

topCandidates: Length = total number of decoding steps. + *

topCandidates: A list of the top candidate tokens at each decoding step. The length of + * this list is equal to the total number of decoding steps. */ @CanIgnoreReturnValue public Builder topCandidates(LogprobsResultTopCandidates.Builder... topCandidatesBuilders) { @@ -148,6 +168,25 @@ public Builder clearTopCandidates() { return topCandidates(Optional.empty()); } + /** + * Setter for logProbabilitySum. + * + *

logProbabilitySum: Sum of log probabilities for all tokens. This field is not supported in + * Vertex AI. + */ + @JsonProperty("logProbabilitySum") + public abstract Builder logProbabilitySum(Float logProbabilitySum); + + @ExcludeFromGeneratedCoverageReport + abstract Builder logProbabilitySum(Optional logProbabilitySum); + + /** Clears the value of logProbabilitySum field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLogProbabilitySum() { + return logProbabilitySum(Optional.empty()); + } + public abstract LogprobsResult build(); } diff --git a/src/main/java/com/google/genai/types/LogprobsResultCandidate.java b/src/main/java/com/google/genai/types/LogprobsResultCandidate.java index 1baed4f083d..26795bb5911 100644 --- a/src/main/java/com/google/genai/types/LogprobsResultCandidate.java +++ b/src/main/java/com/google/genai/types/LogprobsResultCandidate.java @@ -26,19 +26,27 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Candidate for the logprobs token and score. */ +/** A single token and its associated log probability. */ @AutoValue @JsonDeserialize(builder = LogprobsResultCandidate.Builder.class) public abstract class LogprobsResultCandidate extends JsonSerializable { - /** The candidate's log probability. */ + /** + * The log probability of this token. A higher value indicates that the model was more confident + * in this token. The log probability can be used to assess the relative likelihood of different + * tokens and to identify when the model is uncertain. + */ @JsonProperty("logProbability") public abstract Optional logProbability(); - /** The candidate's token string value. */ + /** The token's string representation. */ @JsonProperty("token") public abstract Optional token(); - /** The candidate's token id value. */ + /** + * The token's numerical ID. While the `token` field provides the string representation of the + * token, the `token_id` is the numerical representation that the model uses internally. This can + * be useful for developers who want to build custom logic based on the model's vocabulary. + */ @JsonProperty("tokenId") public abstract Optional tokenId(); @@ -63,7 +71,9 @@ private static Builder create() { /** * Setter for logProbability. * - *

logProbability: The candidate's log probability. + *

logProbability: The log probability of this token. A higher value indicates that the model + * was more confident in this token. The log probability can be used to assess the relative + * likelihood of different tokens and to identify when the model is uncertain. */ @JsonProperty("logProbability") public abstract Builder logProbability(Float logProbability); @@ -81,7 +91,7 @@ public Builder clearLogProbability() { /** * Setter for token. * - *

token: The candidate's token string value. + *

token: The token's string representation. */ @JsonProperty("token") public abstract Builder token(String token); @@ -99,7 +109,10 @@ public Builder clearToken() { /** * Setter for tokenId. * - *

tokenId: The candidate's token id value. + *

tokenId: The token's numerical ID. While the `token` field provides the string + * representation of the token, the `token_id` is the numerical representation that the model + * uses internally. This can be useful for developers who want to build custom logic based on + * the model's vocabulary. */ @JsonProperty("tokenId") public abstract Builder tokenId(Integer tokenId); diff --git a/src/main/java/com/google/genai/types/LogprobsResultTopCandidates.java b/src/main/java/com/google/genai/types/LogprobsResultTopCandidates.java index 23ce637041b..4cde4885e0f 100644 --- a/src/main/java/com/google/genai/types/LogprobsResultTopCandidates.java +++ b/src/main/java/com/google/genai/types/LogprobsResultTopCandidates.java @@ -30,11 +30,14 @@ import java.util.List; import java.util.Optional; -/** Candidates with top log probabilities at each decoding step. */ +/** + * A list of the top candidate tokens and their log probabilities at each decoding step. This can be + * used to see what other tokens the model considered. + */ @AutoValue @JsonDeserialize(builder = LogprobsResultTopCandidates.Builder.class) public abstract class LogprobsResultTopCandidates extends JsonSerializable { - /** Sorted by log probability in descending order. */ + /** The list of candidate tokens, sorted by log probability in descending order. */ @JsonProperty("candidates") public abstract Optional> candidates(); @@ -59,7 +62,7 @@ private static Builder create() { /** * Setter for candidates. * - *

candidates: Sorted by log probability in descending order. + *

candidates: The list of candidate tokens, sorted by log probability in descending order. */ @JsonProperty("candidates") public abstract Builder candidates(List candidates); @@ -67,7 +70,7 @@ private static Builder create() { /** * Setter for candidates. * - *

candidates: Sorted by log probability in descending order. + *

candidates: The list of candidate tokens, sorted by log probability in descending order. */ @CanIgnoreReturnValue public Builder candidates(LogprobsResultCandidate... candidates) { @@ -77,7 +80,7 @@ public Builder candidates(LogprobsResultCandidate... candidates) { /** * Setter for candidates builder. * - *

candidates: Sorted by log probability in descending order. + *

candidates: The list of candidate tokens, sorted by log probability in descending order. */ @CanIgnoreReturnValue public Builder candidates(LogprobsResultCandidate.Builder... candidatesBuilders) { diff --git a/src/main/java/com/google/genai/types/McpServer.java b/src/main/java/com/google/genai/types/McpServer.java new file mode 100644 index 00000000000..7b6bd914b2f --- /dev/null +++ b/src/main/java/com/google/genai/types/McpServer.java @@ -0,0 +1,119 @@ +/* + * 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; + +/** + * A MCPServer is a server that can be called by the model to perform actions. It is a server that + * implements the MCP protocol. Next ID: 5. This data type is not supported in Vertex AI. + */ +@AutoValue +@JsonDeserialize(builder = McpServer.Builder.class) +public abstract class McpServer extends JsonSerializable { + /** The name of the MCPServer. */ + @JsonProperty("name") + public abstract Optional name(); + + /** A transport that can stream HTTP requests and responses. */ + @JsonProperty("streamableHttpTransport") + public abstract Optional streamableHttpTransport(); + + /** Instantiates a builder for McpServer. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_McpServer.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for McpServer. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `McpServer.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_McpServer.Builder(); + } + + /** + * Setter for name. + * + *

name: The name of the MCPServer. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for streamableHttpTransport. + * + *

streamableHttpTransport: A transport that can stream HTTP requests and responses. + */ + @JsonProperty("streamableHttpTransport") + public abstract Builder streamableHttpTransport( + StreamableHttpTransport streamableHttpTransport); + + /** + * Setter for streamableHttpTransport builder. + * + *

streamableHttpTransport: A transport that can stream HTTP requests and responses. + */ + @CanIgnoreReturnValue + public Builder streamableHttpTransport( + StreamableHttpTransport.Builder streamableHttpTransportBuilder) { + return streamableHttpTransport(streamableHttpTransportBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder streamableHttpTransport( + Optional streamableHttpTransport); + + /** Clears the value of streamableHttpTransport field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStreamableHttpTransport() { + return streamableHttpTransport(Optional.empty()); + } + + public abstract McpServer build(); + } + + /** Deserializes a JSON string to a McpServer object. */ + @ExcludeFromGeneratedCoverageReport + public static McpServer fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, McpServer.class); + } +} diff --git a/src/main/java/com/google/genai/types/ModalityTokenCount.java b/src/main/java/com/google/genai/types/ModalityTokenCount.java index 54912f5e97b..4e4196475ef 100644 --- a/src/main/java/com/google/genai/types/ModalityTokenCount.java +++ b/src/main/java/com/google/genai/types/ModalityTokenCount.java @@ -34,7 +34,7 @@ public abstract class ModalityTokenCount extends JsonSerializable { @JsonProperty("modality") public abstract Optional modality(); - /** Number of tokens. */ + /** The number of tokens counted for this modality. */ @JsonProperty("tokenCount") public abstract Optional tokenCount(); @@ -97,7 +97,7 @@ public Builder modality(String modality) { /** * Setter for tokenCount. * - *

tokenCount: Number of tokens. + *

tokenCount: The number of tokens counted for this modality. */ @JsonProperty("tokenCount") public abstract Builder tokenCount(Integer tokenCount); diff --git a/src/main/java/com/google/genai/types/OutputInfo.java b/src/main/java/com/google/genai/types/OutputInfo.java new file mode 100644 index 00000000000..f70606a0ed2 --- /dev/null +++ b/src/main/java/com/google/genai/types/OutputInfo.java @@ -0,0 +1,88 @@ +/* + * 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; + +/** + * Describes the info for output of EvaluationService.EvaluateDataset. This data type is not + * supported in Gemini API. + */ +@AutoValue +@JsonDeserialize(builder = OutputInfo.Builder.class) +public abstract class OutputInfo extends JsonSerializable { + /** + * Output only. The full path of the Cloud Storage directory created, into which the evaluation + * results and aggregation results are written. + */ + @JsonProperty("gcsOutputDirectory") + public abstract Optional gcsOutputDirectory(); + + /** Instantiates a builder for OutputInfo. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_OutputInfo.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for OutputInfo. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `OutputInfo.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_OutputInfo.Builder(); + } + + /** + * Setter for gcsOutputDirectory. + * + *

gcsOutputDirectory: Output only. The full path of the Cloud Storage directory created, + * into which the evaluation results and aggregation results are written. + */ + @JsonProperty("gcsOutputDirectory") + public abstract Builder gcsOutputDirectory(String gcsOutputDirectory); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsOutputDirectory(Optional gcsOutputDirectory); + + /** Clears the value of gcsOutputDirectory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsOutputDirectory() { + return gcsOutputDirectory(Optional.empty()); + } + + public abstract OutputInfo build(); + } + + /** Deserializes a JSON string to a OutputInfo object. */ + @ExcludeFromGeneratedCoverageReport + public static OutputInfo fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, OutputInfo.class); + } +} diff --git a/src/main/java/com/google/genai/types/PairwiseChoice.java b/src/main/java/com/google/genai/types/PairwiseChoice.java new file mode 100644 index 00000000000..a2abafb8f97 --- /dev/null +++ b/src/main/java/com/google/genai/types/PairwiseChoice.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Output only. Pairwise metric choice. This enum is not supported in Gemini API. */ +public class PairwiseChoice { + + /** Enum representing the known values for PairwiseChoice. */ + public enum Known { + /** Unspecified prediction choice. */ + PAIRWISE_CHOICE_UNSPECIFIED, + + /** Baseline prediction wins */ + BASELINE, + + /** Candidate prediction wins */ + CANDIDATE, + + /** Winner cannot be determined */ + TIE + } + + private Known pairwiseChoiceEnum; + private final String value; + + @JsonCreator + public PairwiseChoice(String value) { + this.value = value; + for (Known pairwiseChoiceEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(pairwiseChoiceEnum.toString(), value)) { + this.pairwiseChoiceEnum = pairwiseChoiceEnum; + break; + } + } + if (this.pairwiseChoiceEnum == null) { + this.pairwiseChoiceEnum = Known.PAIRWISE_CHOICE_UNSPECIFIED; + } + } + + public PairwiseChoice(Known knownValue) { + this.pairwiseChoiceEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof PairwiseChoice)) { + return false; + } + + PairwiseChoice other = (PairwiseChoice) o; + + if (this.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED + && other.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.pairwiseChoiceEnum == other.pairwiseChoiceEnum; + } else if (this.pairwiseChoiceEnum == Known.PAIRWISE_CHOICE_UNSPECIFIED + && other.pairwiseChoiceEnum == Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.pairwiseChoiceEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.pairwiseChoiceEnum; + } +} diff --git a/src/main/java/com/google/genai/types/PairwiseMetricResult.java b/src/main/java/com/google/genai/types/PairwiseMetricResult.java new file mode 100644 index 00000000000..1141df76286 --- /dev/null +++ b/src/main/java/com/google/genai/types/PairwiseMetricResult.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for pairwise metric result. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = PairwiseMetricResult.Builder.class) +public abstract class PairwiseMetricResult extends JsonSerializable { + /** Output only. Spec for custom output. */ + @JsonProperty("customOutput") + public abstract Optional customOutput(); + + /** Output only. Explanation for pairwise metric score. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** Output only. Pairwise metric choice. */ + @JsonProperty("pairwiseChoice") + public abstract Optional pairwiseChoice(); + + /** Instantiates a builder for PairwiseMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PairwiseMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PairwiseMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PairwiseMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PairwiseMetricResult.Builder(); + } + + /** + * Setter for customOutput. + * + *

customOutput: Output only. Spec for custom output. + */ + @JsonProperty("customOutput") + public abstract Builder customOutput(CustomOutput customOutput); + + /** + * Setter for customOutput builder. + * + *

customOutput: Output only. Spec for custom output. + */ + @CanIgnoreReturnValue + public Builder customOutput(CustomOutput.Builder customOutputBuilder) { + return customOutput(customOutputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customOutput(Optional customOutput); + + /** Clears the value of customOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomOutput() { + return customOutput(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: Output only. Explanation for pairwise metric score. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for pairwiseChoice. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @JsonProperty("pairwiseChoice") + public abstract Builder pairwiseChoice(PairwiseChoice pairwiseChoice); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pairwiseChoice(Optional pairwiseChoice); + + /** Clears the value of pairwiseChoice field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPairwiseChoice() { + return pairwiseChoice(Optional.empty()); + } + + /** + * Setter for pairwiseChoice given a known enum. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @CanIgnoreReturnValue + public Builder pairwiseChoice(PairwiseChoice.Known knownType) { + return pairwiseChoice(new PairwiseChoice(knownType)); + } + + /** + * Setter for pairwiseChoice given a string. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @CanIgnoreReturnValue + public Builder pairwiseChoice(String pairwiseChoice) { + return pairwiseChoice(new PairwiseChoice(pairwiseChoice)); + } + + public abstract PairwiseMetricResult build(); + } + + /** Deserializes a JSON string to a PairwiseMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static PairwiseMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PairwiseMetricResult.class); + } +} diff --git a/src/main/java/com/google/genai/types/Part.java b/src/main/java/com/google/genai/types/Part.java index b251e15e35a..9fd97fb855f 100644 --- a/src/main/java/com/google/genai/types/Part.java +++ b/src/main/java/com/google/genai/types/Part.java @@ -40,42 +40,47 @@ public abstract class Part extends JsonSerializable { @JsonProperty("mediaResolution") public abstract Optional mediaResolution(); - /** Optional. Result of executing the [ExecutableCode]. */ + /** Optional. The result of executing the ExecutableCode. */ @JsonProperty("codeExecutionResult") public abstract Optional codeExecutionResult(); - /** Optional. Code generated by the model that is meant to be executed. */ + /** Optional. Code generated by the model that is intended to be executed. */ @JsonProperty("executableCode") public abstract Optional executableCode(); - /** Optional. URI based data. */ + /** + * Optional. The URI-based data of the part. This can be used to include files from Google Cloud + * Storage. + */ @JsonProperty("fileData") public abstract Optional fileData(); /** - * Optional. A predicted [FunctionCall] returned from the model that contains a string - * representing the [FunctionDeclaration.name] with the parameters and their values. + * Optional. A predicted function call returned from the model. This contains the name of the + * function to call and the arguments to pass to the function. */ @JsonProperty("functionCall") public abstract Optional functionCall(); /** - * Optional. The result output of a [FunctionCall] that contains a string representing the - * [FunctionDeclaration.name] and a structured JSON object containing any output from the function - * call. It is used as context to the model. + * Optional. The result of a function call. This is used to provide the model with the result of a + * function call that it predicted. */ @JsonProperty("functionResponse") public abstract Optional functionResponse(); - /** Optional. Inlined bytes data. */ + /** + * Optional. The inline data content of the part. This can be used to include images, audio, or + * video in a request. + */ @JsonProperty("inlineData") public abstract Optional inlineData(); - /** Optional. Text part (can be code). */ + /** Optional. The text content of the part. */ @JsonProperty("text") public abstract Optional text(); - /** Optional. Indicates if the part is thought from the model. */ + /** Optional. Indicates whether the `part` represents the model's thought process or reasoning. */ @JsonProperty("thought") public abstract Optional thought(); @@ -90,6 +95,15 @@ public abstract class Part extends JsonSerializable { @JsonProperty("videoMetadata") public abstract Optional videoMetadata(); + /** + * 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 + * from which the Part originates or a way to multiplex multiple Part streams. This field is not + * supported in Vertex AI. + */ + @JsonProperty("partMetadata") + public abstract Optional> partMetadata(); + /** Instantiates a builder for Part. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -139,7 +153,7 @@ public Builder clearMediaResolution() { /** * Setter for codeExecutionResult. * - *

codeExecutionResult: Optional. Result of executing the [ExecutableCode]. + *

codeExecutionResult: Optional. The result of executing the ExecutableCode. */ @JsonProperty("codeExecutionResult") public abstract Builder codeExecutionResult(CodeExecutionResult codeExecutionResult); @@ -147,7 +161,7 @@ public Builder clearMediaResolution() { /** * Setter for codeExecutionResult builder. * - *

codeExecutionResult: Optional. Result of executing the [ExecutableCode]. + *

codeExecutionResult: Optional. The result of executing the ExecutableCode. */ @CanIgnoreReturnValue public Builder codeExecutionResult(CodeExecutionResult.Builder codeExecutionResultBuilder) { @@ -167,7 +181,7 @@ public Builder clearCodeExecutionResult() { /** * Setter for executableCode. * - *

executableCode: Optional. Code generated by the model that is meant to be executed. + *

executableCode: Optional. Code generated by the model that is intended to be executed. */ @JsonProperty("executableCode") public abstract Builder executableCode(ExecutableCode executableCode); @@ -175,7 +189,7 @@ public Builder clearCodeExecutionResult() { /** * Setter for executableCode builder. * - *

executableCode: Optional. Code generated by the model that is meant to be executed. + *

executableCode: Optional. Code generated by the model that is intended to be executed. */ @CanIgnoreReturnValue public Builder executableCode(ExecutableCode.Builder executableCodeBuilder) { @@ -195,7 +209,8 @@ public Builder clearExecutableCode() { /** * Setter for fileData. * - *

fileData: Optional. URI based data. + *

fileData: Optional. The URI-based data of the part. This can be used to include files from + * Google Cloud Storage. */ @JsonProperty("fileData") public abstract Builder fileData(FileData fileData); @@ -203,7 +218,8 @@ public Builder clearExecutableCode() { /** * Setter for fileData builder. * - *

fileData: Optional. URI based data. + *

fileData: Optional. The URI-based data of the part. This can be used to include files from + * Google Cloud Storage. */ @CanIgnoreReturnValue public Builder fileData(FileData.Builder fileDataBuilder) { @@ -223,8 +239,8 @@ public Builder clearFileData() { /** * Setter for functionCall. * - *

functionCall: Optional. A predicted [FunctionCall] returned from the model that contains a - * string representing the [FunctionDeclaration.name] with the parameters and their values. + *

functionCall: Optional. A predicted function call returned from the model. This contains + * the name of the function to call and the arguments to pass to the function. */ @JsonProperty("functionCall") public abstract Builder functionCall(FunctionCall functionCall); @@ -232,8 +248,8 @@ public Builder clearFileData() { /** * Setter for functionCall builder. * - *

functionCall: Optional. A predicted [FunctionCall] returned from the model that contains a - * string representing the [FunctionDeclaration.name] with the parameters and their values. + *

functionCall: Optional. A predicted function call returned from the model. This contains + * the name of the function to call and the arguments to pass to the function. */ @CanIgnoreReturnValue public Builder functionCall(FunctionCall.Builder functionCallBuilder) { @@ -253,9 +269,8 @@ public Builder clearFunctionCall() { /** * Setter for functionResponse. * - *

functionResponse: Optional. The result output of a [FunctionCall] that contains a string - * representing the [FunctionDeclaration.name] and a structured JSON object containing any - * output from the function call. It is used as context to the model. + *

functionResponse: Optional. The result of a function call. This is used to provide the + * model with the result of a function call that it predicted. */ @JsonProperty("functionResponse") public abstract Builder functionResponse(FunctionResponse functionResponse); @@ -263,9 +278,8 @@ public Builder clearFunctionCall() { /** * Setter for functionResponse builder. * - *

functionResponse: Optional. The result output of a [FunctionCall] that contains a string - * representing the [FunctionDeclaration.name] and a structured JSON object containing any - * output from the function call. It is used as context to the model. + *

functionResponse: Optional. The result of a function call. This is used to provide the + * model with the result of a function call that it predicted. */ @CanIgnoreReturnValue public Builder functionResponse(FunctionResponse.Builder functionResponseBuilder) { @@ -285,7 +299,8 @@ public Builder clearFunctionResponse() { /** * Setter for inlineData. * - *

inlineData: Optional. Inlined bytes data. + *

inlineData: Optional. The inline data content of the part. This can be used to include + * images, audio, or video in a request. */ @JsonProperty("inlineData") public abstract Builder inlineData(Blob inlineData); @@ -293,7 +308,8 @@ public Builder clearFunctionResponse() { /** * Setter for inlineData builder. * - *

inlineData: Optional. Inlined bytes data. + *

inlineData: Optional. The inline data content of the part. This can be used to include + * images, audio, or video in a request. */ @CanIgnoreReturnValue public Builder inlineData(Blob.Builder inlineDataBuilder) { @@ -313,7 +329,7 @@ public Builder clearInlineData() { /** * Setter for text. * - *

text: Optional. Text part (can be code). + *

text: Optional. The text content of the part. */ @JsonProperty("text") public abstract Builder text(String text); @@ -331,7 +347,8 @@ public Builder clearText() { /** * Setter for thought. * - *

thought: Optional. Indicates if the part is thought from the model. + *

thought: Optional. Indicates whether the `part` represents the model's thought process or + * reasoning. */ @JsonProperty("thought") public abstract Builder thought(boolean thought); @@ -395,6 +412,27 @@ public Builder clearVideoMetadata() { return videoMetadata(Optional.empty()); } + /** + * Setter for partMetadata. + * + *

partMetadata: 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 from which the Part originates or a way to multiplex multiple Part + * streams. This field is not supported in Vertex AI. + */ + @JsonProperty("partMetadata") + public abstract Builder partMetadata(Map partMetadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder partMetadata(Optional> partMetadata); + + /** Clears the value of partMetadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPartMetadata() { + return partMetadata(Optional.empty()); + } + public abstract Part build(); } diff --git a/src/main/java/com/google/genai/types/PartialArg.java b/src/main/java/com/google/genai/types/PartialArg.java index 97fab7b6239..e6a8b6f6462 100644 --- a/src/main/java/com/google/genai/types/PartialArg.java +++ b/src/main/java/com/google/genai/types/PartialArg.java @@ -30,6 +30,17 @@ @AutoValue @JsonDeserialize(builder = PartialArg.Builder.class) public abstract class PartialArg extends JsonSerializable { + /** Optional. Represents a boolean value. */ + @JsonProperty("boolValue") + public abstract Optional boolValue(); + + /** + * Required. A JSON Path (RFC 9535) to the argument being streamed. + * https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". + */ + @JsonProperty("jsonPath") + public abstract Optional jsonPath(); + /** Optional. Represents a null value. */ @JsonProperty("nullValue") public abstract Optional nullValue(); @@ -42,17 +53,6 @@ public abstract class PartialArg extends JsonSerializable { @JsonProperty("stringValue") public abstract Optional stringValue(); - /** Optional. Represents a boolean value. */ - @JsonProperty("boolValue") - public abstract Optional boolValue(); - - /** - * Required. A JSON Path (RFC 9535) to the argument being streamed. - * https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". - */ - @JsonProperty("jsonPath") - public abstract Optional jsonPath(); - /** * Optional. Whether this is not the last part of the same json_path. If true, another PartialArg * message for the current json_path is expected to follow. @@ -78,6 +78,43 @@ private static Builder create() { return new AutoValue_PartialArg.Builder(); } + /** + * Setter for boolValue. + * + *

boolValue: Optional. Represents a boolean value. + */ + @JsonProperty("boolValue") + public abstract Builder boolValue(boolean boolValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder boolValue(Optional boolValue); + + /** Clears the value of boolValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBoolValue() { + return boolValue(Optional.empty()); + } + + /** + * Setter for jsonPath. + * + *

jsonPath: Required. A JSON Path (RFC 9535) to the argument being streamed. + * https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". + */ + @JsonProperty("jsonPath") + public abstract Builder jsonPath(String jsonPath); + + @ExcludeFromGeneratedCoverageReport + abstract Builder jsonPath(Optional jsonPath); + + /** Clears the value of jsonPath field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJsonPath() { + return jsonPath(Optional.empty()); + } + /** * Setter for nullValue. * @@ -152,43 +189,6 @@ public Builder clearStringValue() { return stringValue(Optional.empty()); } - /** - * Setter for boolValue. - * - *

boolValue: Optional. Represents a boolean value. - */ - @JsonProperty("boolValue") - public abstract Builder boolValue(boolean boolValue); - - @ExcludeFromGeneratedCoverageReport - abstract Builder boolValue(Optional boolValue); - - /** Clears the value of boolValue field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearBoolValue() { - return boolValue(Optional.empty()); - } - - /** - * Setter for jsonPath. - * - *

jsonPath: Required. A JSON Path (RFC 9535) to the argument being streamed. - * https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". - */ - @JsonProperty("jsonPath") - public abstract Builder jsonPath(String jsonPath); - - @ExcludeFromGeneratedCoverageReport - abstract Builder jsonPath(Optional jsonPath); - - /** Clears the value of jsonPath field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearJsonPath() { - return jsonPath(Optional.empty()); - } - /** * Setter for willContinue. * diff --git a/src/main/java/com/google/genai/types/PointwiseMetricResult.java b/src/main/java/com/google/genai/types/PointwiseMetricResult.java new file mode 100644 index 00000000000..e8422380894 --- /dev/null +++ b/src/main/java/com/google/genai/types/PointwiseMetricResult.java @@ -0,0 +1,135 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for pointwise metric result. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = PointwiseMetricResult.Builder.class) +public abstract class PointwiseMetricResult extends JsonSerializable { + /** Output only. Spec for custom output. */ + @JsonProperty("customOutput") + public abstract Optional customOutput(); + + /** Output only. Explanation for pointwise metric score. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** Output only. Pointwise metric score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for PointwiseMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PointwiseMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PointwiseMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PointwiseMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PointwiseMetricResult.Builder(); + } + + /** + * Setter for customOutput. + * + *

customOutput: Output only. Spec for custom output. + */ + @JsonProperty("customOutput") + public abstract Builder customOutput(CustomOutput customOutput); + + /** + * Setter for customOutput builder. + * + *

customOutput: Output only. Spec for custom output. + */ + @CanIgnoreReturnValue + public Builder customOutput(CustomOutput.Builder customOutputBuilder) { + return customOutput(customOutputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customOutput(Optional customOutput); + + /** Clears the value of customOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomOutput() { + return customOutput(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: Output only. Explanation for pointwise metric score. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for score. + * + *

score: Output only. Pointwise metric score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract PointwiseMetricResult build(); + } + + /** Deserializes a JSON string to a PointwiseMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static PointwiseMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PointwiseMetricResult.class); + } +} diff --git a/src/main/java/com/google/genai/types/PrebuiltVoiceConfig.java b/src/main/java/com/google/genai/types/PrebuiltVoiceConfig.java index c400d3cccc4..4a6d2073362 100644 --- a/src/main/java/com/google/genai/types/PrebuiltVoiceConfig.java +++ b/src/main/java/com/google/genai/types/PrebuiltVoiceConfig.java @@ -26,11 +26,11 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** The configuration for the prebuilt speaker to use. */ +/** Configuration for a prebuilt voice. */ @AutoValue @JsonDeserialize(builder = PrebuiltVoiceConfig.Builder.class) public abstract class PrebuiltVoiceConfig extends JsonSerializable { - /** The name of the preset voice to use. */ + /** The name of the prebuilt voice to use. */ @JsonProperty("voiceName") public abstract Optional voiceName(); @@ -55,7 +55,7 @@ private static Builder create() { /** * Setter for voiceName. * - *

voiceName: The name of the preset voice to use. + *

voiceName: The name of the prebuilt voice to use. */ @JsonProperty("voiceName") public abstract Builder voiceName(String voiceName); diff --git a/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java b/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java index 37793697b49..1a153804ae5 100644 --- a/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java +++ b/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java @@ -37,6 +37,17 @@ @AutoValue @JsonDeserialize(builder = PreferenceOptimizationDataStats.Builder.class) public abstract class PreferenceOptimizationDataStats extends JsonSerializable { + /** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */ + @JsonProperty("droppedExampleIndices") + public abstract Optional> droppedExampleIndices(); + + /** + * Output only. For each index in `dropped_example_indices`, the user-facing reason why the + * example was dropped. + */ + @JsonProperty("droppedExampleReasons") + public abstract Optional> droppedExampleReasons(); + /** Output only. Dataset distributions for scores variance per example. */ @JsonProperty("scoreVariancePerExampleDistribution") public abstract Optional scoreVariancePerExampleDistribution(); @@ -89,6 +100,66 @@ private static Builder create() { return new AutoValue_PreferenceOptimizationDataStats.Builder(); } + /** + * Setter for droppedExampleIndices. + * + *

droppedExampleIndices: Output only. A partial sample of the indices (starting from 1) of + * the dropped examples. + */ + @JsonProperty("droppedExampleIndices") + public abstract Builder droppedExampleIndices(List droppedExampleIndices); + + /** + * Setter for droppedExampleIndices. + * + *

droppedExampleIndices: Output only. A partial sample of the indices (starting from 1) of + * the dropped examples. + */ + @CanIgnoreReturnValue + public Builder droppedExampleIndices(Long... droppedExampleIndices) { + return droppedExampleIndices(Arrays.asList(droppedExampleIndices)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder droppedExampleIndices(Optional> droppedExampleIndices); + + /** Clears the value of droppedExampleIndices field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDroppedExampleIndices() { + return droppedExampleIndices(Optional.empty()); + } + + /** + * Setter for droppedExampleReasons. + * + *

droppedExampleReasons: Output only. For each index in `dropped_example_indices`, the + * user-facing reason why the example was dropped. + */ + @JsonProperty("droppedExampleReasons") + public abstract Builder droppedExampleReasons(List droppedExampleReasons); + + /** + * Setter for droppedExampleReasons. + * + *

droppedExampleReasons: Output only. For each index in `dropped_example_indices`, the + * user-facing reason why the example was dropped. + */ + @CanIgnoreReturnValue + public Builder droppedExampleReasons(String... droppedExampleReasons) { + return droppedExampleReasons(Arrays.asList(droppedExampleReasons)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder droppedExampleReasons(Optional> droppedExampleReasons); + + /** Clears the value of droppedExampleReasons field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDroppedExampleReasons() { + return droppedExampleReasons(Optional.empty()); + } + /** * Setter for scoreVariancePerExampleDistribution. * diff --git a/src/main/java/com/google/genai/types/RawOutput.java b/src/main/java/com/google/genai/types/RawOutput.java new file mode 100644 index 00000000000..89d9ec829bb --- /dev/null +++ b/src/main/java/com/google/genai/types/RawOutput.java @@ -0,0 +1,93 @@ +/* + * 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.Arrays; +import java.util.List; +import java.util.Optional; + +/** Raw output. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = RawOutput.Builder.class) +public abstract class RawOutput extends JsonSerializable { + /** Output only. Raw output string. */ + @JsonProperty("rawOutput") + public abstract Optional> rawOutput(); + + /** Instantiates a builder for RawOutput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RawOutput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RawOutput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RawOutput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RawOutput.Builder(); + } + + /** + * Setter for rawOutput. + * + *

rawOutput: Output only. Raw output string. + */ + @JsonProperty("rawOutput") + public abstract Builder rawOutput(List rawOutput); + + /** + * Setter for rawOutput. + * + *

rawOutput: Output only. Raw output string. + */ + @CanIgnoreReturnValue + public Builder rawOutput(String... rawOutput) { + return rawOutput(Arrays.asList(rawOutput)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawOutput(Optional> rawOutput); + + /** Clears the value of rawOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawOutput() { + return rawOutput(Optional.empty()); + } + + public abstract RawOutput build(); + } + + /** Deserializes a JSON string to a RawOutput object. */ + @ExcludeFromGeneratedCoverageReport + public static RawOutput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RawOutput.class); + } +} diff --git a/src/main/java/com/google/genai/types/RetrievalMetadata.java b/src/main/java/com/google/genai/types/RetrievalMetadata.java index 6629e7554a0..969947a668c 100644 --- a/src/main/java/com/google/genai/types/RetrievalMetadata.java +++ b/src/main/java/com/google/genai/types/RetrievalMetadata.java @@ -26,15 +26,15 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Metadata related to retrieval in the grounding flow. */ +/** Metadata returned to client when grounding is enabled. */ @AutoValue @JsonDeserialize(builder = RetrievalMetadata.Builder.class) public abstract class RetrievalMetadata extends JsonSerializable { /** - * Optional. Score indicating how likely information from Google Search could help answer the - * prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most - * likely. This score is only populated when Google Search grounding and dynamic retrieval is - * enabled. It will be compared to the threshold to determine whether to trigger Google Search. + * Optional. Score indicating how likely information from google search could help answer the + * prompt. The score is in the range [0, 1], where 0 is the least likely and 1 is the most likely. + * This score is only populated when google search grounding and dynamic retrieval is enabled. It + * will be compared to the threshold to determine whether to trigger Google search. */ @JsonProperty("googleSearchDynamicRetrievalScore") public abstract Optional googleSearchDynamicRetrievalScore(); @@ -61,10 +61,10 @@ private static Builder create() { * Setter for googleSearchDynamicRetrievalScore. * *

googleSearchDynamicRetrievalScore: Optional. Score indicating how likely information from - * Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is - * the least likely and 1 is the most likely. This score is only populated when Google Search + * google search could help answer the prompt. The score is in the range [0, 1], where 0 is the + * least likely and 1 is the most likely. This score is only populated when google search * grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine - * whether to trigger Google Search. + * whether to trigger Google search. */ @JsonProperty("googleSearchDynamicRetrievalScore") public abstract Builder googleSearchDynamicRetrievalScore( diff --git a/src/main/java/com/google/genai/types/RougeMetricValue.java b/src/main/java/com/google/genai/types/RougeMetricValue.java new file mode 100644 index 00000000000..e3fc4265a47 --- /dev/null +++ b/src/main/java/com/google/genai/types/RougeMetricValue.java @@ -0,0 +1,81 @@ +/* + * 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; + +/** Rouge metric value for an instance. This data type is not supported in Gemini API. */ +@AutoValue +@JsonDeserialize(builder = RougeMetricValue.Builder.class) +public abstract class RougeMetricValue extends JsonSerializable { + /** Output only. Rouge score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for RougeMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RougeMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RougeMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RougeMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RougeMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Rouge score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract RougeMetricValue build(); + } + + /** Deserializes a JSON string to a RougeMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static RougeMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RougeMetricValue.class); + } +} diff --git a/src/main/java/com/google/genai/types/SafetyRating.java b/src/main/java/com/google/genai/types/SafetyRating.java index c4222e239ce..eedc1d7b24e 100644 --- a/src/main/java/com/google/genai/types/SafetyRating.java +++ b/src/main/java/com/google/genai/types/SafetyRating.java @@ -26,15 +26,18 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Safety rating corresponding to the generated content. */ +/** + * A safety rating for a piece of content. The safety rating contains the harm category and the harm + * probability level. + */ @AutoValue @JsonDeserialize(builder = SafetyRating.Builder.class) public abstract class SafetyRating extends JsonSerializable { - /** Output only. Indicates whether the content was filtered out because of this rating. */ + /** Output only. Indicates whether the content was blocked because of this rating. */ @JsonProperty("blocked") public abstract Optional blocked(); - /** Output only. Harm category. */ + /** Output only. The harm category of this rating. */ @JsonProperty("category") public abstract Optional category(); @@ -46,21 +49,27 @@ public abstract class SafetyRating extends JsonSerializable { @JsonProperty("overwrittenThreshold") public abstract Optional overwrittenThreshold(); - /** Output only. Harm probability levels in the content. */ + /** Output only. The probability of harm for this category. */ @JsonProperty("probability") public abstract Optional probability(); - /** Output only. Harm probability score. This field is not supported in Gemini API. */ + /** + * Output only. The probability score of harm for this category. This field is not supported in + * Gemini API. + */ @JsonProperty("probabilityScore") public abstract Optional probabilityScore(); /** - * Output only. Harm severity levels in the content. This field is not supported in Gemini API. + * Output only. The severity of harm for this category. This field is not supported in Gemini API. */ @JsonProperty("severity") public abstract Optional severity(); - /** Output only. Harm severity score. This field is not supported in Gemini API. */ + /** + * Output only. The severity score of harm for this category. This field is not supported in + * Gemini API. + */ @JsonProperty("severityScore") public abstract Optional severityScore(); @@ -85,8 +94,7 @@ private static Builder create() { /** * Setter for blocked. * - *

blocked: Output only. Indicates whether the content was filtered out because of this - * rating. + *

blocked: Output only. Indicates whether the content was blocked because of this rating. */ @JsonProperty("blocked") public abstract Builder blocked(boolean blocked); @@ -104,7 +112,7 @@ public Builder clearBlocked() { /** * Setter for category. * - *

category: Output only. Harm category. + *

category: Output only. The harm category of this rating. */ @JsonProperty("category") public abstract Builder category(HarmCategory category); @@ -122,7 +130,7 @@ public Builder clearCategory() { /** * Setter for category given a known enum. * - *

category: Output only. Harm category. + *

category: Output only. The harm category of this rating. */ @CanIgnoreReturnValue public Builder category(HarmCategory.Known knownType) { @@ -132,7 +140,7 @@ public Builder category(HarmCategory.Known knownType) { /** * Setter for category given a string. * - *

category: Output only. Harm category. + *

category: Output only. The harm category of this rating. */ @CanIgnoreReturnValue public Builder category(String category) { @@ -189,7 +197,7 @@ public Builder overwrittenThreshold(String overwrittenThreshold) { /** * Setter for probability. * - *

probability: Output only. Harm probability levels in the content. + *

probability: Output only. The probability of harm for this category. */ @JsonProperty("probability") public abstract Builder probability(HarmProbability probability); @@ -207,7 +215,7 @@ public Builder clearProbability() { /** * Setter for probability given a known enum. * - *

probability: Output only. Harm probability levels in the content. + *

probability: Output only. The probability of harm for this category. */ @CanIgnoreReturnValue public Builder probability(HarmProbability.Known knownType) { @@ -217,7 +225,7 @@ public Builder probability(HarmProbability.Known knownType) { /** * Setter for probability given a string. * - *

probability: Output only. Harm probability levels in the content. + *

probability: Output only. The probability of harm for this category. */ @CanIgnoreReturnValue public Builder probability(String probability) { @@ -227,8 +235,8 @@ public Builder probability(String probability) { /** * Setter for probabilityScore. * - *

probabilityScore: Output only. Harm probability score. This field is not supported in - * Gemini API. + *

probabilityScore: Output only. The probability score of harm for this category. This field + * is not supported in Gemini API. */ @JsonProperty("probabilityScore") public abstract Builder probabilityScore(Float probabilityScore); @@ -246,8 +254,8 @@ public Builder clearProbabilityScore() { /** * Setter for severity. * - *

severity: Output only. Harm severity levels in the content. This field is not supported in - * Gemini API. + *

severity: Output only. The severity of harm for this category. This field is not supported + * in Gemini API. */ @JsonProperty("severity") public abstract Builder severity(HarmSeverity severity); @@ -265,8 +273,8 @@ public Builder clearSeverity() { /** * Setter for severity given a known enum. * - *

severity: Output only. Harm severity levels in the content. This field is not supported in - * Gemini API. + *

severity: Output only. The severity of harm for this category. This field is not supported + * in Gemini API. */ @CanIgnoreReturnValue public Builder severity(HarmSeverity.Known knownType) { @@ -276,8 +284,8 @@ public Builder severity(HarmSeverity.Known knownType) { /** * Setter for severity given a string. * - *

severity: Output only. Harm severity levels in the content. This field is not supported in - * Gemini API. + *

severity: Output only. The severity of harm for this category. This field is not supported + * in Gemini API. */ @CanIgnoreReturnValue public Builder severity(String severity) { @@ -287,8 +295,8 @@ public Builder severity(String severity) { /** * Setter for severityScore. * - *

severityScore: Output only. Harm severity score. This field is not supported in Gemini - * API. + *

severityScore: Output only. The severity score of harm for this category. This field is + * not supported in Gemini API. */ @JsonProperty("severityScore") public abstract Builder severityScore(Float severityScore); diff --git a/src/main/java/com/google/genai/types/SafetySetting.java b/src/main/java/com/google/genai/types/SafetySetting.java index f6afd389794..406b6552eda 100644 --- a/src/main/java/com/google/genai/types/SafetySetting.java +++ b/src/main/java/com/google/genai/types/SafetySetting.java @@ -26,22 +26,28 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Safety settings. */ +/** + * A safety setting that affects the safety-blocking behavior. A SafetySetting consists of a harm + * category and a threshold for that category. + */ @AutoValue @JsonDeserialize(builder = SafetySetting.Builder.class) public abstract class SafetySetting extends JsonSerializable { - /** Required. Harm category. */ + /** Required. The harm category to be blocked. */ @JsonProperty("category") public abstract Optional category(); /** - * Optional. Specify if the threshold is used for probability or severity score. If not specified, - * the threshold is used for probability score. This field is not supported in Gemini API. + * Optional. The method for blocking content. If not specified, the default behavior is to use the + * probability score. This field is not supported in Gemini API. */ @JsonProperty("method") public abstract Optional method(); - /** Required. The harm block threshold. */ + /** + * Required. The threshold for blocking content. If the harm probability exceeds this threshold, + * the content will be blocked. + */ @JsonProperty("threshold") public abstract Optional threshold(); @@ -66,7 +72,7 @@ private static Builder create() { /** * Setter for category. * - *

category: Required. Harm category. + *

category: Required. The harm category to be blocked. */ @JsonProperty("category") public abstract Builder category(HarmCategory category); @@ -84,7 +90,7 @@ public Builder clearCategory() { /** * Setter for category given a known enum. * - *

category: Required. Harm category. + *

category: Required. The harm category to be blocked. */ @CanIgnoreReturnValue public Builder category(HarmCategory.Known knownType) { @@ -94,7 +100,7 @@ public Builder category(HarmCategory.Known knownType) { /** * Setter for category given a string. * - *

category: Required. Harm category. + *

category: Required. The harm category to be blocked. */ @CanIgnoreReturnValue public Builder category(String category) { @@ -104,9 +110,8 @@ public Builder category(String category) { /** * Setter for method. * - *

method: Optional. Specify if the threshold is used for probability or severity score. If - * not specified, the threshold is used for probability score. This field is not supported in - * Gemini API. + *

method: Optional. The method for blocking content. If not specified, the default behavior + * is to use the probability score. This field is not supported in Gemini API. */ @JsonProperty("method") public abstract Builder method(HarmBlockMethod method); @@ -124,9 +129,8 @@ public Builder clearMethod() { /** * Setter for method given a known enum. * - *

method: Optional. Specify if the threshold is used for probability or severity score. If - * not specified, the threshold is used for probability score. This field is not supported in - * Gemini API. + *

method: Optional. The method for blocking content. If not specified, the default behavior + * is to use the probability score. This field is not supported in Gemini API. */ @CanIgnoreReturnValue public Builder method(HarmBlockMethod.Known knownType) { @@ -136,9 +140,8 @@ public Builder method(HarmBlockMethod.Known knownType) { /** * Setter for method given a string. * - *

method: Optional. Specify if the threshold is used for probability or severity score. If - * not specified, the threshold is used for probability score. This field is not supported in - * Gemini API. + *

method: Optional. The method for blocking content. If not specified, the default behavior + * is to use the probability score. This field is not supported in Gemini API. */ @CanIgnoreReturnValue public Builder method(String method) { @@ -148,7 +151,8 @@ public Builder method(String method) { /** * Setter for threshold. * - *

threshold: Required. The harm block threshold. + *

threshold: Required. The threshold for blocking content. If the harm probability exceeds + * this threshold, the content will be blocked. */ @JsonProperty("threshold") public abstract Builder threshold(HarmBlockThreshold threshold); @@ -166,7 +170,8 @@ public Builder clearThreshold() { /** * Setter for threshold given a known enum. * - *

threshold: Required. The harm block threshold. + *

threshold: Required. The threshold for blocking content. If the harm probability exceeds + * this threshold, the content will be blocked. */ @CanIgnoreReturnValue public Builder threshold(HarmBlockThreshold.Known knownType) { @@ -176,7 +181,8 @@ public Builder threshold(HarmBlockThreshold.Known knownType) { /** * Setter for threshold given a string. * - *

threshold: Required. The harm block threshold. + *

threshold: Required. The threshold for blocking content. If the harm probability exceeds + * this threshold, the content will be blocked. */ @CanIgnoreReturnValue public Builder threshold(String threshold) { diff --git a/src/main/java/com/google/genai/types/Schema.java b/src/main/java/com/google/genai/types/Schema.java index 65e07a8c384..07c9bc3a96d 100644 --- a/src/main/java/com/google/genai/types/Schema.java +++ b/src/main/java/com/google/genai/types/Schema.java @@ -42,106 +42,124 @@ @JsonDeserialize(builder = Schema.Builder.class) public abstract class Schema extends JsonSerializable { /** - * Optional. The value should be validated against any (one or more) of the subschemas in the - * list. + * Optional. The instance must be valid against any (one or more) of the subschemas listed in + * `any_of`. */ @JsonProperty("anyOf") public abstract Optional> anyOf(); - /** Optional. Default value of the data. */ + /** Optional. Default value to use if the field is not specified. */ @JsonProperty("default") public abstract Optional default_(); - /** Optional. The description of the data. */ + /** Optional. Description of the schema. */ @JsonProperty("description") public abstract Optional description(); /** - * Optional. Possible values of the element of primitive type with enum format. Examples: 1. We - * can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} 2. - * We can define apartment number as : {type:INTEGER, format:enum, enum:["101", "201", "301"]} + * Optional. Possible values of the field. This field can be used to restrict a value to a fixed + * set of values. To mark a field as an enum, set `format` to `enum` and provide the list of + * possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, + * enum:["EAST", "NORTH", "SOUTH", "WEST"]}` 2. To define apartment numbers: `{type:INTEGER, + * format:enum, enum:["101", "201", "301"]}` */ @JsonProperty("enum") public abstract Optional> enum_(); - /** Optional. Example of the object. Will only populated when the object is the root. */ + /** Optional. Example of an instance of this schema. */ @JsonProperty("example") public abstract Optional example(); /** - * Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for - * INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc + * Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For + * `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, + * `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type. */ @JsonProperty("format") public abstract Optional format(); - /** Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY. */ + /** Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array. */ @JsonProperty("items") public abstract Optional items(); - /** Optional. Maximum number of the elements for Type.ARRAY. */ + /** + * Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array. + */ @JsonProperty("maxItems") public abstract Optional maxItems(); - /** Optional. Maximum length of the Type.STRING */ + /** Optional. If type is `STRING`, `max_length` specifies the maximum length of the string. */ @JsonProperty("maxLength") public abstract Optional maxLength(); - /** Optional. Maximum number of the properties for Type.OBJECT. */ + /** + * Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that + * can be provided. + */ @JsonProperty("maxProperties") public abstract Optional maxProperties(); - /** Optional. Maximum value of the Type.INTEGER and Type.NUMBER */ + /** Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value. */ @JsonProperty("maximum") public abstract Optional maximum(); - /** Optional. Minimum number of the elements for Type.ARRAY. */ + /** + * Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array. + */ @JsonProperty("minItems") public abstract Optional minItems(); - /** Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING */ + /** Optional. If type is `STRING`, `min_length` specifies the minimum length of the string. */ @JsonProperty("minLength") public abstract Optional minLength(); - /** Optional. Minimum number of the properties for Type.OBJECT. */ + /** + * Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that + * can be provided. + */ @JsonProperty("minProperties") public abstract Optional minProperties(); - /** - * Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and - * Type.NUMBER - */ + /** Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value. */ @JsonProperty("minimum") public abstract Optional minimum(); - /** Optional. Indicates if the value may be null. */ + /** Optional. Indicates if the value of this field can be null. */ @JsonProperty("nullable") public abstract Optional nullable(); - /** Optional. Pattern of the Type.STRING to restrict a string to a regular expression. */ + /** + * Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must + * match. + */ @JsonProperty("pattern") public abstract Optional pattern(); - /** Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT. */ + /** + * Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions + * for each property of the object. + */ @JsonProperty("properties") public abstract Optional> properties(); /** - * Optional. The order of the properties. Not a standard field in open api spec. Only used to - * support the order of the properties. + * Optional. Order of properties displayed or used where order matters. This is not a standard + * field in OpenAPI specification, but can be used to control the order of properties. */ @JsonProperty("propertyOrdering") public abstract Optional> propertyOrdering(); - /** Optional. Required properties of Type.OBJECT. */ + /** + * Optional. If type is `OBJECT`, `required` lists the names of properties that must be present. + */ @JsonProperty("required") public abstract Optional> required(); - /** Optional. The title of the Schema. */ + /** Optional. Title for the schema. */ @JsonProperty("title") public abstract Optional title(); - /** Optional. The type of the data. */ + /** Optional. Data type of the schema field. */ @JsonProperty("type") public abstract Optional type(); @@ -166,8 +184,8 @@ private static Builder create() { /** * Setter for anyOf. * - *

anyOf: Optional. The value should be validated against any (one or more) of the subschemas - * in the list. + *

anyOf: Optional. The instance must be valid against any (one or more) of the subschemas + * listed in `any_of`. */ @JsonProperty("anyOf") public abstract Builder anyOf(List anyOf); @@ -175,8 +193,8 @@ private static Builder create() { /** * Setter for anyOf. * - *

anyOf: Optional. The value should be validated against any (one or more) of the subschemas - * in the list. + *

anyOf: Optional. The instance must be valid against any (one or more) of the subschemas + * listed in `any_of`. */ @CanIgnoreReturnValue public Builder anyOf(Schema... anyOf) { @@ -186,8 +204,8 @@ public Builder anyOf(Schema... anyOf) { /** * Setter for anyOf builder. * - *

anyOf: Optional. The value should be validated against any (one or more) of the subschemas - * in the list. + *

anyOf: Optional. The instance must be valid against any (one or more) of the subschemas + * listed in `any_of`. */ @CanIgnoreReturnValue public Builder anyOf(Schema.Builder... anyOfBuilders) { @@ -210,7 +228,7 @@ public Builder clearAnyOf() { /** * Setter for default_. * - *

default_: Optional. Default value of the data. + *

default_: Optional. Default value to use if the field is not specified. */ @JsonProperty("default") public abstract Builder default_(Object default_); @@ -228,7 +246,7 @@ public Builder clearDefault_() { /** * Setter for description. * - *

description: Optional. The description of the data. + *

description: Optional. Description of the schema. */ @JsonProperty("description") public abstract Builder description(String description); @@ -246,10 +264,11 @@ public Builder clearDescription() { /** * Setter for enum_. * - *

enum_: Optional. Possible values of the element of primitive type with enum format. - * Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", - * "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, - * enum:["101", "201", "301"]} + *

enum_: Optional. Possible values of the field. This field can be used to restrict a value + * to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the + * list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, + * format:enum, enum:["EAST", "NORTH", "SOUTH", "WEST"]}` 2. To define apartment numbers: + * `{type:INTEGER, format:enum, enum:["101", "201", "301"]}` */ @JsonProperty("enum") public abstract Builder enum_(List enum_); @@ -257,10 +276,11 @@ public Builder clearDescription() { /** * Setter for enum_. * - *

enum_: Optional. Possible values of the element of primitive type with enum format. - * Examples: 1. We can define direction as : {type:STRING, format:enum, enum:["EAST", NORTH", - * "SOUTH", "WEST"]} 2. We can define apartment number as : {type:INTEGER, format:enum, - * enum:["101", "201", "301"]} + *

enum_: Optional. Possible values of the field. This field can be used to restrict a value + * to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the + * list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, + * format:enum, enum:["EAST", "NORTH", "SOUTH", "WEST"]}` 2. To define apartment numbers: + * `{type:INTEGER, format:enum, enum:["101", "201", "301"]}` */ @CanIgnoreReturnValue public Builder enum_(String... enum_) { @@ -280,7 +300,7 @@ public Builder clearEnum_() { /** * Setter for example. * - *

example: Optional. Example of the object. Will only populated when the object is the root. + *

example: Optional. Example of an instance of this schema. */ @JsonProperty("example") public abstract Builder example(Object example); @@ -298,8 +318,10 @@ public Builder clearExample() { /** * Setter for format. * - *

format: Optional. The format of the data. Supported formats: for NUMBER type: "float", - * "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc + *

format: Optional. The format of the data. For `NUMBER` type, format can be `float` or + * `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can + * be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the + * data type. */ @JsonProperty("format") public abstract Builder format(String format); @@ -317,7 +339,8 @@ public Builder clearFormat() { /** * Setter for items. * - *

items: Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY. + *

items: Optional. If type is `ARRAY`, `items` specifies the schema of elements in the + * array. */ @JsonProperty("items") public abstract Builder items(Schema items); @@ -325,7 +348,8 @@ public Builder clearFormat() { /** * Setter for items builder. * - *

items: Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY. + *

items: Optional. If type is `ARRAY`, `items` specifies the schema of elements in the + * array. */ @CanIgnoreReturnValue public Builder items(Schema.Builder itemsBuilder) { @@ -345,7 +369,8 @@ public Builder clearItems() { /** * Setter for maxItems. * - *

maxItems: Optional. Maximum number of the elements for Type.ARRAY. + *

maxItems: Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items + * in an array. */ @JsonProperty("maxItems") public abstract Builder maxItems(Long maxItems); @@ -363,7 +388,8 @@ public Builder clearMaxItems() { /** * Setter for maxLength. * - *

maxLength: Optional. Maximum length of the Type.STRING + *

maxLength: Optional. If type is `STRING`, `max_length` specifies the maximum length of the + * string. */ @JsonProperty("maxLength") public abstract Builder maxLength(Long maxLength); @@ -381,7 +407,8 @@ public Builder clearMaxLength() { /** * Setter for maxProperties. * - *

maxProperties: Optional. Maximum number of the properties for Type.OBJECT. + *

maxProperties: Optional. If type is `OBJECT`, `max_properties` specifies the maximum + * number of properties that can be provided. */ @JsonProperty("maxProperties") public abstract Builder maxProperties(Long maxProperties); @@ -399,7 +426,8 @@ public Builder clearMaxProperties() { /** * Setter for maximum. * - *

maximum: Optional. Maximum value of the Type.INTEGER and Type.NUMBER + *

maximum: Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum + * allowed value. */ @JsonProperty("maximum") public abstract Builder maximum(Double maximum); @@ -417,7 +445,8 @@ public Builder clearMaximum() { /** * Setter for minItems. * - *

minItems: Optional. Minimum number of the elements for Type.ARRAY. + *

minItems: Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items + * in an array. */ @JsonProperty("minItems") public abstract Builder minItems(Long minItems); @@ -435,7 +464,8 @@ public Builder clearMinItems() { /** * Setter for minLength. * - *

minLength: Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING + *

minLength: Optional. If type is `STRING`, `min_length` specifies the minimum length of the + * string. */ @JsonProperty("minLength") public abstract Builder minLength(Long minLength); @@ -453,7 +483,8 @@ public Builder clearMinLength() { /** * Setter for minProperties. * - *

minProperties: Optional. Minimum number of the properties for Type.OBJECT. + *

minProperties: Optional. If type is `OBJECT`, `min_properties` specifies the minimum + * number of properties that can be provided. */ @JsonProperty("minProperties") public abstract Builder minProperties(Long minProperties); @@ -471,8 +502,8 @@ public Builder clearMinProperties() { /** * Setter for minimum. * - *

minimum: Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the - * Type.INTEGER and Type.NUMBER + *

minimum: Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum + * allowed value. */ @JsonProperty("minimum") public abstract Builder minimum(Double minimum); @@ -490,7 +521,7 @@ public Builder clearMinimum() { /** * Setter for nullable. * - *

nullable: Optional. Indicates if the value may be null. + *

nullable: Optional. Indicates if the value of this field can be null. */ @JsonProperty("nullable") public abstract Builder nullable(boolean nullable); @@ -508,8 +539,8 @@ public Builder clearNullable() { /** * Setter for pattern. * - *

pattern: Optional. Pattern of the Type.STRING to restrict a string to a regular - * expression. + *

pattern: Optional. If type is `STRING`, `pattern` specifies a regular expression that the + * string must match. */ @JsonProperty("pattern") public abstract Builder pattern(String pattern); @@ -527,7 +558,8 @@ public Builder clearPattern() { /** * Setter for properties. * - *

properties: Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT. + *

properties: Optional. If type is `OBJECT`, `properties` is a map of property names to + * schema definitions for each property of the object. */ @JsonProperty("properties") public abstract Builder properties(Map properties); @@ -545,8 +577,9 @@ public Builder clearProperties() { /** * Setter for propertyOrdering. * - *

propertyOrdering: Optional. The order of the properties. Not a standard field in open api - * spec. Only used to support the order of the properties. + *

propertyOrdering: Optional. Order of properties displayed or used where order matters. + * This is not a standard field in OpenAPI specification, but can be used to control the order + * of properties. */ @JsonProperty("propertyOrdering") public abstract Builder propertyOrdering(List propertyOrdering); @@ -554,8 +587,9 @@ public Builder clearProperties() { /** * Setter for propertyOrdering. * - *

propertyOrdering: Optional. The order of the properties. Not a standard field in open api - * spec. Only used to support the order of the properties. + *

propertyOrdering: Optional. Order of properties displayed or used where order matters. + * This is not a standard field in OpenAPI specification, but can be used to control the order + * of properties. */ @CanIgnoreReturnValue public Builder propertyOrdering(String... propertyOrdering) { @@ -575,7 +609,8 @@ public Builder clearPropertyOrdering() { /** * Setter for required. * - *

required: Optional. Required properties of Type.OBJECT. + *

required: Optional. If type is `OBJECT`, `required` lists the names of properties that + * must be present. */ @JsonProperty("required") public abstract Builder required(List required); @@ -583,7 +618,8 @@ public Builder clearPropertyOrdering() { /** * Setter for required. * - *

required: Optional. Required properties of Type.OBJECT. + *

required: Optional. If type is `OBJECT`, `required` lists the names of properties that + * must be present. */ @CanIgnoreReturnValue public Builder required(String... required) { @@ -603,7 +639,7 @@ public Builder clearRequired() { /** * Setter for title. * - *

title: Optional. The title of the Schema. + *

title: Optional. Title for the schema. */ @JsonProperty("title") public abstract Builder title(String title); @@ -621,7 +657,7 @@ public Builder clearTitle() { /** * Setter for type. * - *

type: Optional. The type of the data. + *

type: Optional. Data type of the schema field. */ @JsonProperty("type") public abstract Builder type(Type type); @@ -639,7 +675,7 @@ public Builder clearType() { /** * Setter for type given a known enum. * - *

type: Optional. The type of the data. + *

type: Optional. Data type of the schema field. */ @CanIgnoreReturnValue public Builder type(Type.Known knownType) { @@ -649,7 +685,7 @@ public Builder type(Type.Known knownType) { /** * Setter for type given a string. * - *

type: Optional. The type of the data. + *

type: Optional. Data type of the schema field. */ @CanIgnoreReturnValue public Builder type(String type) { diff --git a/src/main/java/com/google/genai/types/SearchEntryPoint.java b/src/main/java/com/google/genai/types/SearchEntryPoint.java index faa468109e2..7a47d6f456c 100644 --- a/src/main/java/com/google/genai/types/SearchEntryPoint.java +++ b/src/main/java/com/google/genai/types/SearchEntryPoint.java @@ -26,7 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Google search entry point. */ +/** The entry point used to search for grounding sources. */ @AutoValue @JsonDeserialize(builder = SearchEntryPoint.Builder.class) public abstract class SearchEntryPoint extends JsonSerializable { @@ -34,7 +34,7 @@ public abstract class SearchEntryPoint extends JsonSerializable { @JsonProperty("renderedContent") public abstract Optional renderedContent(); - /** Optional. Base64 encoded JSON representing array of tuple. */ + /** Optional. JSON representing array of tuples. */ @JsonProperty("sdkBlob") public abstract Optional sdkBlob(); @@ -78,7 +78,7 @@ public Builder clearRenderedContent() { /** * Setter for sdkBlob. * - *

sdkBlob: Optional. Base64 encoded JSON representing array of tuple. + *

sdkBlob: Optional. JSON representing array of tuples. */ @JsonProperty("sdkBlob") public abstract Builder sdkBlob(byte[] sdkBlob); diff --git a/src/main/java/com/google/genai/types/Segment.java b/src/main/java/com/google/genai/types/Segment.java index 067a5147008..5b5d9edda2c 100644 --- a/src/main/java/com/google/genai/types/Segment.java +++ b/src/main/java/com/google/genai/types/Segment.java @@ -26,13 +26,22 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Segment of the content. */ +/** Segment of the content this support belongs to. */ @AutoValue @JsonDeserialize(builder = Segment.Builder.class) public abstract class Segment extends JsonSerializable { /** - * Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, - * exclusive, starting at zero. + * Output only. Start index in the given Part, measured in bytes. + * + *

Offset from the start of the Part, inclusive, starting at zero. + */ + @JsonProperty("startIndex") + public abstract Optional startIndex(); + + /** + * Output only. End index in the given Part, measured in bytes. + * + *

Offset from the start of the Part, exclusive, starting at zero. */ @JsonProperty("endIndex") public abstract Optional endIndex(); @@ -41,13 +50,6 @@ public abstract class Segment extends JsonSerializable { @JsonProperty("partIndex") public abstract Optional partIndex(); - /** - * Output only. Start index in the given Part, measured in bytes. Offset from the start of the - * Part, inclusive, starting at zero. - */ - @JsonProperty("startIndex") - public abstract Optional startIndex(); - /** Output only. The text corresponding to the segment from the response. */ @JsonProperty("text") public abstract Optional text(); @@ -70,11 +72,32 @@ private static Builder create() { return new AutoValue_Segment.Builder(); } + /** + * Setter for startIndex. + * + *

startIndex: Output only. Start index in the given Part, measured in bytes. + * + *

Offset from the start of the Part, inclusive, starting at zero. + */ + @JsonProperty("startIndex") + public abstract Builder startIndex(Integer startIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startIndex(Optional startIndex); + + /** Clears the value of startIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartIndex() { + return startIndex(Optional.empty()); + } + /** * Setter for endIndex. * - *

endIndex: Output only. End index in the given Part, measured in bytes. Offset from the - * start of the Part, exclusive, starting at zero. + *

endIndex: Output only. End index in the given Part, measured in bytes. + * + *

Offset from the start of the Part, exclusive, starting at zero. */ @JsonProperty("endIndex") public abstract Builder endIndex(Integer endIndex); @@ -107,25 +130,6 @@ public Builder clearPartIndex() { return partIndex(Optional.empty()); } - /** - * Setter for startIndex. - * - *

startIndex: Output only. Start index in the given Part, measured in bytes. Offset from the - * start of the Part, inclusive, starting at zero. - */ - @JsonProperty("startIndex") - public abstract Builder startIndex(Integer startIndex); - - @ExcludeFromGeneratedCoverageReport - abstract Builder startIndex(Optional startIndex); - - /** Clears the value of startIndex field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearStartIndex() { - return startIndex(Optional.empty()); - } - /** * Setter for text. * diff --git a/src/main/java/com/google/genai/types/SpeakerVoiceConfig.java b/src/main/java/com/google/genai/types/SpeakerVoiceConfig.java index 99e7a896801..b22970e470c 100644 --- a/src/main/java/com/google/genai/types/SpeakerVoiceConfig.java +++ b/src/main/java/com/google/genai/types/SpeakerVoiceConfig.java @@ -26,7 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Configuration for a single speaker in a multi speaker setup. */ +/** Configuration for a single speaker in a multi-speaker setup. */ @AutoValue @JsonDeserialize(builder = SpeakerVoiceConfig.Builder.class) public abstract class SpeakerVoiceConfig extends JsonSerializable { diff --git a/src/main/java/com/google/genai/types/SpeechConfig.java b/src/main/java/com/google/genai/types/SpeechConfig.java index c18a5c5b779..b7e914134d0 100644 --- a/src/main/java/com/google/genai/types/SpeechConfig.java +++ b/src/main/java/com/google/genai/types/SpeechConfig.java @@ -34,7 +34,7 @@ public abstract class SpeechConfig extends JsonSerializable { @JsonProperty("voiceConfig") public abstract Optional voiceConfig(); - /** Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. */ + /** Optional. The language code (ISO 639-1) for the speech synthesis. */ @JsonProperty("languageCode") public abstract Optional languageCode(); @@ -94,7 +94,7 @@ public Builder clearVoiceConfig() { /** * Setter for languageCode. * - *

languageCode: Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. + *

languageCode: Optional. The language code (ISO 639-1) for the speech synthesis. */ @JsonProperty("languageCode") public abstract Builder languageCode(String languageCode); diff --git a/src/main/java/com/google/genai/types/StreamableHttpTransport.java b/src/main/java/com/google/genai/types/StreamableHttpTransport.java new file mode 100644 index 00000000000..1337e16dffc --- /dev/null +++ b/src/main/java/com/google/genai/types/StreamableHttpTransport.java @@ -0,0 +1,174 @@ +/* + * 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.time.Duration; +import java.util.Map; +import java.util.Optional; + +/** + * A transport that can stream HTTP requests and responses. Next ID: 6. This data type is not + * supported in Vertex AI. + */ +@AutoValue +@JsonDeserialize(builder = StreamableHttpTransport.Builder.class) +public abstract class StreamableHttpTransport extends JsonSerializable { + /** Optional: Fields for authentication headers, timeouts, etc., if needed. */ + @JsonProperty("headers") + public abstract Optional> headers(); + + /** Timeout for SSE read operations. */ + @JsonProperty("sseReadTimeout") + public abstract Optional sseReadTimeout(); + + /** Whether to close the client session when the transport closes. */ + @JsonProperty("terminateOnClose") + public abstract Optional terminateOnClose(); + + /** HTTP timeout for regular operations. */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp". */ + @JsonProperty("url") + public abstract Optional url(); + + /** Instantiates a builder for StreamableHttpTransport. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_StreamableHttpTransport.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for StreamableHttpTransport. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `StreamableHttpTransport.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_StreamableHttpTransport.Builder(); + } + + /** + * Setter for headers. + * + *

headers: Optional: Fields for authentication headers, timeouts, etc., if needed. + */ + @JsonProperty("headers") + public abstract Builder headers(Map headers); + + @ExcludeFromGeneratedCoverageReport + abstract Builder headers(Optional> headers); + + /** Clears the value of headers field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHeaders() { + return headers(Optional.empty()); + } + + /** + * Setter for sseReadTimeout. + * + *

sseReadTimeout: Timeout for SSE read operations. + */ + @JsonProperty("sseReadTimeout") + public abstract Builder sseReadTimeout(Duration sseReadTimeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sseReadTimeout(Optional sseReadTimeout); + + /** Clears the value of sseReadTimeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSseReadTimeout() { + return sseReadTimeout(Optional.empty()); + } + + /** + * Setter for terminateOnClose. + * + *

terminateOnClose: Whether to close the client session when the transport closes. + */ + @JsonProperty("terminateOnClose") + public abstract Builder terminateOnClose(boolean terminateOnClose); + + @ExcludeFromGeneratedCoverageReport + abstract Builder terminateOnClose(Optional terminateOnClose); + + /** Clears the value of terminateOnClose field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTerminateOnClose() { + return terminateOnClose(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: HTTP timeout for regular operations. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Duration timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + /** + * Setter for url. + * + *

url: The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp". + */ + @JsonProperty("url") + public abstract Builder url(String url); + + @ExcludeFromGeneratedCoverageReport + abstract Builder url(Optional url); + + /** Clears the value of url field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUrl() { + return url(Optional.empty()); + } + + public abstract StreamableHttpTransport build(); + } + + /** Deserializes a JSON string to a StreamableHttpTransport object. */ + @ExcludeFromGeneratedCoverageReport + public static StreamableHttpTransport fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, StreamableHttpTransport.class); + } +} diff --git a/src/main/java/com/google/genai/types/ThinkingLevel.java b/src/main/java/com/google/genai/types/ThinkingLevel.java index 5985dc0d52c..de8aefae0d9 100644 --- a/src/main/java/com/google/genai/types/ThinkingLevel.java +++ b/src/main/java/com/google/genai/types/ThinkingLevel.java @@ -31,17 +31,17 @@ public enum Known { /** Unspecified thinking level. */ THINKING_LEVEL_UNSPECIFIED, + /** Little to no thinking. This enum value is not supported in Vertex AI. */ + MINIMAL, + /** Low thinking level. */ LOW, - /** Medium thinking level. */ + /** Medium thinking level. This enum value is not supported in Vertex AI. */ MEDIUM, /** High thinking level. */ - HIGH, - - /** MINIMAL thinking level. */ - MINIMAL + HIGH } private Known thinkingLevelEnum; diff --git a/src/main/java/com/google/genai/types/Tool.java b/src/main/java/com/google/genai/types/Tool.java index 82e438cba86..b8a6019a2bc 100644 --- a/src/main/java/com/google/genai/types/Tool.java +++ b/src/main/java/com/google/genai/types/Tool.java @@ -62,6 +62,13 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("fileSearch") public abstract Optional fileSearch(); + /** + * Optional. Tool that allows grounding the model's response with geospatial context related to + * the user's query. + */ + @JsonProperty("googleMaps") + public abstract Optional googleMaps(); + /** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */ @JsonProperty("codeExecution") public abstract Optional codeExecution(); @@ -83,10 +90,6 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("functionDeclarations") public abstract Optional> functionDeclarations(); - /** Optional. GoogleMaps tool type. Tool to support Google Maps in Model. */ - @JsonProperty("googleMaps") - public abstract Optional googleMaps(); - /** * Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google. */ @@ -97,10 +100,22 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("googleSearchRetrieval") public abstract Optional googleSearchRetrieval(); + /** + * Optional. If specified, Vertex AI will use Parallel.ai to search for information to answer user + * queries. The search results will be grounded on Parallel.ai and presented to the model for + * response generation. This field is not supported in Gemini API. + */ + @JsonProperty("parallelAiSearch") + public abstract Optional parallelAiSearch(); + /** Optional. Tool to support URL context retrieval. */ @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(); + /** Instantiates a builder for Tool. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -239,6 +254,36 @@ public Builder clearFileSearch() { return fileSearch(Optional.empty()); } + /** + * Setter for googleMaps. + * + *

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

googleMaps: Optional. Tool that allows grounding the model's response with geospatial + * context related to the user's query. + */ + @CanIgnoreReturnValue + public Builder googleMaps(GoogleMaps.Builder googleMapsBuilder) { + return googleMaps(googleMapsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder googleMaps(Optional googleMaps); + + /** Clears the value of googleMaps field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoogleMaps() { + return googleMaps(Optional.empty()); + } + /** * Setter for codeExecution. * @@ -356,34 +401,6 @@ public Builder clearFunctionDeclarations() { return functionDeclarations(Optional.empty()); } - /** - * Setter for googleMaps. - * - *

googleMaps: Optional. GoogleMaps tool type. Tool to support Google Maps in Model. - */ - @JsonProperty("googleMaps") - public abstract Builder googleMaps(GoogleMaps googleMaps); - - /** - * Setter for googleMaps builder. - * - *

googleMaps: Optional. GoogleMaps tool type. Tool to support Google Maps in Model. - */ - @CanIgnoreReturnValue - public Builder googleMaps(GoogleMaps.Builder googleMapsBuilder) { - return googleMaps(googleMapsBuilder.build()); - } - - @ExcludeFromGeneratedCoverageReport - abstract Builder googleMaps(Optional googleMaps); - - /** Clears the value of googleMaps field. */ - @ExcludeFromGeneratedCoverageReport - @CanIgnoreReturnValue - public Builder clearGoogleMaps() { - return googleMaps(Optional.empty()); - } - /** * Setter for googleSearch. * @@ -445,6 +462,38 @@ public Builder clearGoogleSearchRetrieval() { return googleSearchRetrieval(Optional.empty()); } + /** + * Setter for parallelAiSearch. + * + *

parallelAiSearch: Optional. If specified, Vertex AI will use Parallel.ai to search for + * information to answer user queries. The search results will be grounded on Parallel.ai and + * presented to the model for response generation. This field is not supported in Gemini API. + */ + @JsonProperty("parallelAiSearch") + public abstract Builder parallelAiSearch(ToolParallelAiSearch parallelAiSearch); + + /** + * Setter for parallelAiSearch builder. + * + *

parallelAiSearch: Optional. If specified, Vertex AI will use Parallel.ai to search for + * information to answer user queries. The search results will be grounded on Parallel.ai and + * presented to the model for response generation. This field is not supported in Gemini API. + */ + @CanIgnoreReturnValue + public Builder parallelAiSearch(ToolParallelAiSearch.Builder parallelAiSearchBuilder) { + return parallelAiSearch(parallelAiSearchBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder parallelAiSearch(Optional parallelAiSearch); + + /** Clears the value of parallelAiSearch field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearParallelAiSearch() { + return parallelAiSearch(Optional.empty()); + } + /** * Setter for urlContext. * @@ -473,6 +522,47 @@ public Builder clearUrlContext() { return urlContext(Optional.empty()); } + /** + * 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()); + } + public abstract Tool build(); } diff --git a/src/main/java/com/google/genai/types/ToolParallelAiSearch.java b/src/main/java/com/google/genai/types/ToolParallelAiSearch.java new file mode 100644 index 00000000000..70c2d5c9fbe --- /dev/null +++ b/src/main/java/com/google/genai/types/ToolParallelAiSearch.java @@ -0,0 +1,128 @@ +/* + * 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.Map; +import java.util.Optional; + +/** + * ParallelAiSearch tool type. A tool that uses the Parallel.ai search engine for grounding. This + * data type is not supported in Gemini API. + */ +@AutoValue +@JsonDeserialize(builder = ToolParallelAiSearch.Builder.class) +public abstract class ToolParallelAiSearch extends JsonSerializable { + /** + * Optional. The API key for ParallelAiSearch. If an API key is not provided, the system will + * attempt to verify access by checking for an active Parallel.ai subscription through the Google + * Cloud Marketplace. See https://docs.parallel.ai/search/search-quickstart for more details. + */ + @JsonProperty("apiKey") + public abstract Optional apiKey(); + + /** + * Optional. Custom configs for ParallelAiSearch. This field can be used to pass any parameter + * from the Parallel.ai Search API. See the Parallel.ai documentation for the full list of + * available parameters and their usage: https://docs.parallel.ai/api-reference/search-beta/search + * Currently only `source_policy`, `excerpts`, `max_results`, `mode`, `fetch_policy` can be set + * via this field. For example: { "source_policy": { "include_domains": ["google.com", + * "wikipedia.org"], "exclude_domains": ["example.com"] }, "fetch_policy": { "max_age_seconds": + * 3600 } } + */ + @JsonProperty("customConfigs") + public abstract Optional> customConfigs(); + + /** Instantiates a builder for ToolParallelAiSearch. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParallelAiSearch.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParallelAiSearch. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParallelAiSearch.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParallelAiSearch.Builder(); + } + + /** + * Setter for apiKey. + * + *

apiKey: Optional. The API key for ParallelAiSearch. If an API key is not provided, the + * system will attempt to verify access by checking for an active Parallel.ai subscription + * through the Google Cloud Marketplace. See https://docs.parallel.ai/search/search-quickstart + * for more details. + */ + @JsonProperty("apiKey") + public abstract Builder apiKey(String apiKey); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiKey(Optional apiKey); + + /** Clears the value of apiKey field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiKey() { + return apiKey(Optional.empty()); + } + + /** + * Setter for customConfigs. + * + *

customConfigs: Optional. Custom configs for ParallelAiSearch. This field can be used to + * pass any parameter from the Parallel.ai Search API. See the Parallel.ai documentation for the + * full list of available parameters and their usage: + * https://docs.parallel.ai/api-reference/search-beta/search Currently only `source_policy`, + * `excerpts`, `max_results`, `mode`, `fetch_policy` can be set via this field. For example: { + * "source_policy": { "include_domains": ["google.com", "wikipedia.org"], "exclude_domains": + * ["example.com"] }, "fetch_policy": { "max_age_seconds": 3600 } } + */ + @JsonProperty("customConfigs") + public abstract Builder customConfigs(Map customConfigs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder customConfigs(Optional> customConfigs); + + /** Clears the value of customConfigs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomConfigs() { + return customConfigs(Optional.empty()); + } + + public abstract ToolParallelAiSearch build(); + } + + /** Deserializes a JSON string to a ToolParallelAiSearch object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParallelAiSearch fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParallelAiSearch.class); + } +} diff --git a/src/main/java/com/google/genai/types/TuningDataStats.java b/src/main/java/com/google/genai/types/TuningDataStats.java index 34ba54f57dc..70c086a16c3 100644 --- a/src/main/java/com/google/genai/types/TuningDataStats.java +++ b/src/main/java/com/google/genai/types/TuningDataStats.java @@ -32,7 +32,10 @@ @AutoValue @JsonDeserialize(builder = TuningDataStats.Builder.class) public abstract class TuningDataStats extends JsonSerializable { - /** Output only. Statistics for distillation. */ + /** + * Output only. Statistics for distillation prompt dataset. These statistics do not include the + * responses sampled from the teacher model. + */ @JsonProperty("distillationDataStats") public abstract Optional distillationDataStats(); @@ -65,7 +68,8 @@ private static Builder create() { /** * Setter for distillationDataStats. * - *

distillationDataStats: Output only. Statistics for distillation. + *

distillationDataStats: Output only. Statistics for distillation prompt dataset. These + * statistics do not include the responses sampled from the teacher model. */ @JsonProperty("distillationDataStats") public abstract Builder distillationDataStats(DistillationDataStats distillationDataStats); @@ -73,7 +77,8 @@ private static Builder create() { /** * Setter for distillationDataStats builder. * - *

distillationDataStats: Output only. Statistics for distillation. + *

distillationDataStats: Output only. Statistics for distillation prompt dataset. These + * statistics do not include the responses sampled from the teacher model. */ @CanIgnoreReturnValue public Builder distillationDataStats( diff --git a/src/main/java/com/google/genai/types/TuningJob.java b/src/main/java/com/google/genai/types/TuningJob.java index b99d8f346ce..1bfa1af795d 100644 --- a/src/main/java/com/google/genai/types/TuningJob.java +++ b/src/main/java/com/google/genai/types/TuningJob.java @@ -18,6 +18,8 @@ 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; @@ -25,6 +27,8 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.genai.JsonSerializable; import java.time.Instant; +import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.Optional; @@ -130,10 +134,18 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("customBaseModel") public abstract Optional customBaseModel(); + /** Output only. Evaluation runs for the Tuning Job. */ + @JsonProperty("evaluateDatasetRuns") + public abstract Optional> evaluateDatasetRuns(); + /** Output only. The Experiment associated with this TuningJob. */ @JsonProperty("experiment") public abstract Optional experiment(); + /** Tuning Spec for Full Fine Tuning. */ + @JsonProperty("fullFineTuningSpec") + public abstract Optional fullFineTuningSpec(); + /** * Optional. The labels with user-defined metadata to organize TuningJob and generated resources * such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode @@ -177,6 +189,10 @@ 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(); @@ -680,6 +696,47 @@ public Builder clearCustomBaseModel() { return customBaseModel(Optional.empty()); } + /** + * Setter for evaluateDatasetRuns. + * + *

evaluateDatasetRuns: Output only. Evaluation runs for the Tuning Job. + */ + @JsonProperty("evaluateDatasetRuns") + public abstract Builder evaluateDatasetRuns(List evaluateDatasetRuns); + + /** + * Setter for evaluateDatasetRuns. + * + *

evaluateDatasetRuns: Output only. Evaluation runs for the Tuning Job. + */ + @CanIgnoreReturnValue + public Builder evaluateDatasetRuns(EvaluateDatasetRun... evaluateDatasetRuns) { + return evaluateDatasetRuns(Arrays.asList(evaluateDatasetRuns)); + } + + /** + * Setter for evaluateDatasetRuns builder. + * + *

evaluateDatasetRuns: Output only. Evaluation runs for the Tuning Job. + */ + @CanIgnoreReturnValue + public Builder evaluateDatasetRuns(EvaluateDatasetRun.Builder... evaluateDatasetRunsBuilders) { + return evaluateDatasetRuns( + Arrays.asList(evaluateDatasetRunsBuilders).stream() + .map(EvaluateDatasetRun.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluateDatasetRuns(Optional> evaluateDatasetRuns); + + /** Clears the value of evaluateDatasetRuns field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluateDatasetRuns() { + return evaluateDatasetRuns(Optional.empty()); + } + /** * Setter for experiment. * @@ -698,6 +755,34 @@ public Builder clearExperiment() { return experiment(Optional.empty()); } + /** + * Setter for fullFineTuningSpec. + * + *

fullFineTuningSpec: Tuning Spec for Full Fine Tuning. + */ + @JsonProperty("fullFineTuningSpec") + public abstract Builder fullFineTuningSpec(FullFineTuningSpec fullFineTuningSpec); + + /** + * Setter for fullFineTuningSpec builder. + * + *

fullFineTuningSpec: Tuning Spec for Full Fine Tuning. + */ + @CanIgnoreReturnValue + public Builder fullFineTuningSpec(FullFineTuningSpec.Builder fullFineTuningSpecBuilder) { + return fullFineTuningSpec(fullFineTuningSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder fullFineTuningSpec(Optional fullFineTuningSpec); + + /** Clears the value of fullFineTuningSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFullFineTuningSpec() { + return fullFineTuningSpec(Optional.empty()); + } + /** * Setter for labels. * @@ -802,6 +887,47 @@ public Builder clearTunedModelDisplayName() { return tunedModelDisplayName(Optional.empty()); } + /** + * Setter for tuningJobState. + * + *

tuningJobState: Output only. The detail state of the tuning job (while the overall + * `JobState` is running). + */ + @JsonProperty("tuningJobState") + public abstract Builder tuningJobState(TuningJobState tuningJobState); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tuningJobState(Optional tuningJobState); + + /** Clears the value of tuningJobState field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTuningJobState() { + return tuningJobState(Optional.empty()); + } + + /** + * Setter for tuningJobState given a known enum. + * + *

tuningJobState: Output only. The detail state of the tuning job (while the overall + * `JobState` is running). + */ + @CanIgnoreReturnValue + public Builder tuningJobState(TuningJobState.Known knownType) { + return tuningJobState(new TuningJobState(knownType)); + } + + /** + * Setter for tuningJobState given a string. + * + *

tuningJobState: Output only. The detail state of the tuning job (while the overall + * `JobState` is running). + */ + @CanIgnoreReturnValue + public Builder tuningJobState(String tuningJobState) { + return tuningJobState(new TuningJobState(tuningJobState)); + } + /** * Setter for veoTuningSpec. * diff --git a/src/main/java/com/google/genai/types/TuningJobState.java b/src/main/java/com/google/genai/types/TuningJobState.java new file mode 100644 index 00000000000..4d94317d2a9 --- /dev/null +++ b/src/main/java/com/google/genai/types/TuningJobState.java @@ -0,0 +1,123 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * Output only. The detail state of the tuning job (while the overall `JobState` is running). This + * enum is not supported in Gemini API. + */ +public class TuningJobState { + + /** Enum representing the known values for TuningJobState. */ + public enum Known { + /** Default tuning job state. */ + TUNING_JOB_STATE_UNSPECIFIED, + + /** Tuning job is waiting for job quota. */ + TUNING_JOB_STATE_WAITING_FOR_QUOTA, + + /** Tuning job is validating the dataset. */ + TUNING_JOB_STATE_PROCESSING_DATASET, + + /** Tuning job is waiting for hardware capacity. */ + TUNING_JOB_STATE_WAITING_FOR_CAPACITY, + + /** Tuning job is running. */ + TUNING_JOB_STATE_TUNING, + + /** Tuning job is doing some post processing steps. */ + TUNING_JOB_STATE_POST_PROCESSING + } + + private Known tuningJobStateEnum; + private final String value; + + @JsonCreator + public TuningJobState(String value) { + this.value = value; + for (Known tuningJobStateEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(tuningJobStateEnum.toString(), value)) { + this.tuningJobStateEnum = tuningJobStateEnum; + break; + } + } + if (this.tuningJobStateEnum == null) { + this.tuningJobStateEnum = Known.TUNING_JOB_STATE_UNSPECIFIED; + } + } + + public TuningJobState(Known knownValue) { + this.tuningJobStateEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof TuningJobState)) { + return false; + } + + TuningJobState other = (TuningJobState) o; + + if (this.tuningJobStateEnum != Known.TUNING_JOB_STATE_UNSPECIFIED + && other.tuningJobStateEnum != Known.TUNING_JOB_STATE_UNSPECIFIED) { + return this.tuningJobStateEnum == other.tuningJobStateEnum; + } else if (this.tuningJobStateEnum == Known.TUNING_JOB_STATE_UNSPECIFIED + && other.tuningJobStateEnum == Known.TUNING_JOB_STATE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.tuningJobStateEnum != Known.TUNING_JOB_STATE_UNSPECIFIED) { + return this.tuningJobStateEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.tuningJobStateEnum; + } +} diff --git a/src/main/java/com/google/genai/types/Type.java b/src/main/java/com/google/genai/types/Type.java index 3500e4695c9..8e7da1286c5 100644 --- a/src/main/java/com/google/genai/types/Type.java +++ b/src/main/java/com/google/genai/types/Type.java @@ -23,7 +23,7 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** The type of the data. */ +/** Data type of the schema field. */ public class Type { /** Enum representing the known values for Type. */ diff --git a/src/main/java/com/google/genai/types/UrlContextMetadata.java b/src/main/java/com/google/genai/types/UrlContextMetadata.java index 64f5bd34057..3f5a940d0ef 100644 --- a/src/main/java/com/google/genai/types/UrlContextMetadata.java +++ b/src/main/java/com/google/genai/types/UrlContextMetadata.java @@ -30,11 +30,14 @@ import java.util.List; import java.util.Optional; -/** Metadata related to url context retrieval tool. */ +/** + * Metadata returned when the model uses the `url_context` tool to get information from a + * user-provided URL. + */ @AutoValue @JsonDeserialize(builder = UrlContextMetadata.Builder.class) public abstract class UrlContextMetadata extends JsonSerializable { - /** Output only. List of url context. */ + /** Output only. A list of URL metadata, with one entry for each URL retrieved by the tool. */ @JsonProperty("urlMetadata") public abstract Optional> urlMetadata(); @@ -59,7 +62,8 @@ private static Builder create() { /** * Setter for urlMetadata. * - *

urlMetadata: Output only. List of url context. + *

urlMetadata: Output only. A list of URL metadata, with one entry for each URL retrieved by + * the tool. */ @JsonProperty("urlMetadata") public abstract Builder urlMetadata(List urlMetadata); @@ -67,7 +71,8 @@ private static Builder create() { /** * Setter for urlMetadata. * - *

urlMetadata: Output only. List of url context. + *

urlMetadata: Output only. A list of URL metadata, with one entry for each URL retrieved by + * the tool. */ @CanIgnoreReturnValue public Builder urlMetadata(UrlMetadata... urlMetadata) { @@ -77,7 +82,8 @@ public Builder urlMetadata(UrlMetadata... urlMetadata) { /** * Setter for urlMetadata builder. * - *

urlMetadata: Output only. List of url context. + *

urlMetadata: Output only. A list of URL metadata, with one entry for each URL retrieved by + * the tool. */ @CanIgnoreReturnValue public Builder urlMetadata(UrlMetadata.Builder... urlMetadataBuilders) { diff --git a/src/main/java/com/google/genai/types/UrlMetadata.java b/src/main/java/com/google/genai/types/UrlMetadata.java index 67db3427936..ee40d77fb12 100644 --- a/src/main/java/com/google/genai/types/UrlMetadata.java +++ b/src/main/java/com/google/genai/types/UrlMetadata.java @@ -26,15 +26,15 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Context of the a single url retrieval. */ +/** The metadata for a single URL retrieval. */ @AutoValue @JsonDeserialize(builder = UrlMetadata.Builder.class) public abstract class UrlMetadata extends JsonSerializable { - /** Retrieved url by the tool. */ + /** The URL retrieved by the tool. */ @JsonProperty("retrievedUrl") public abstract Optional retrievedUrl(); - /** Status of the url retrieval. */ + /** The status of the URL retrieval. */ @JsonProperty("urlRetrievalStatus") public abstract Optional urlRetrievalStatus(); @@ -59,7 +59,7 @@ private static Builder create() { /** * Setter for retrievedUrl. * - *

retrievedUrl: Retrieved url by the tool. + *

retrievedUrl: The URL retrieved by the tool. */ @JsonProperty("retrievedUrl") public abstract Builder retrievedUrl(String retrievedUrl); @@ -77,7 +77,7 @@ public Builder clearRetrievedUrl() { /** * Setter for urlRetrievalStatus. * - *

urlRetrievalStatus: Status of the url retrieval. + *

urlRetrievalStatus: The status of the URL retrieval. */ @JsonProperty("urlRetrievalStatus") public abstract Builder urlRetrievalStatus(UrlRetrievalStatus urlRetrievalStatus); @@ -95,7 +95,7 @@ public Builder clearUrlRetrievalStatus() { /** * Setter for urlRetrievalStatus given a known enum. * - *

urlRetrievalStatus: Status of the url retrieval. + *

urlRetrievalStatus: The status of the URL retrieval. */ @CanIgnoreReturnValue public Builder urlRetrievalStatus(UrlRetrievalStatus.Known knownType) { @@ -105,7 +105,7 @@ public Builder urlRetrievalStatus(UrlRetrievalStatus.Known knownType) { /** * Setter for urlRetrievalStatus given a string. * - *

urlRetrievalStatus: Status of the url retrieval. + *

urlRetrievalStatus: The status of the URL retrieval. */ @CanIgnoreReturnValue public Builder urlRetrievalStatus(String urlRetrievalStatus) { diff --git a/src/main/java/com/google/genai/types/UrlRetrievalStatus.java b/src/main/java/com/google/genai/types/UrlRetrievalStatus.java index 8449ac9ec5e..915fcb22285 100644 --- a/src/main/java/com/google/genai/types/UrlRetrievalStatus.java +++ b/src/main/java/com/google/genai/types/UrlRetrievalStatus.java @@ -23,7 +23,7 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Status of the url retrieval. */ +/** The status of the URL retrieval. */ public class UrlRetrievalStatus { /** Enum representing the known values for UrlRetrievalStatus. */ @@ -31,10 +31,10 @@ public enum Known { /** Default value. This value is unused. */ URL_RETRIEVAL_STATUS_UNSPECIFIED, - /** Url retrieval is successful. */ + /** The URL was retrieved successfully. */ URL_RETRIEVAL_STATUS_SUCCESS, - /** Url retrieval is failed due to error. */ + /** The URL retrieval failed. */ URL_RETRIEVAL_STATUS_ERROR, /** diff --git a/src/main/java/com/google/genai/types/VeoHyperParameters.java b/src/main/java/com/google/genai/types/VeoHyperParameters.java index cfd9fb90515..7a101089d28 100644 --- a/src/main/java/com/google/genai/types/VeoHyperParameters.java +++ b/src/main/java/com/google/genai/types/VeoHyperParameters.java @@ -47,6 +47,14 @@ public abstract class VeoHyperParameters extends JsonSerializable { @JsonProperty("tuningTask") public abstract Optional tuningTask(); + /** + * Optional. The ratio of Google internal dataset to use in the training mixture, in range of `[0, + * 1)`. If `0.2`, it means 20% of Google internal dataset and 80% of user dataset will be used for + * training. + */ + @JsonProperty("veoDataMixtureRatio") + public abstract Optional veoDataMixtureRatio(); + /** Instantiates a builder for VeoHyperParameters. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -140,6 +148,26 @@ public Builder tuningTask(String tuningTask) { return tuningTask(new TuningTask(tuningTask)); } + /** + * Setter for veoDataMixtureRatio. + * + *

veoDataMixtureRatio: Optional. The ratio of Google internal dataset to use in the training + * mixture, in range of `[0, 1)`. If `0.2`, it means 20% of Google internal dataset and 80% of + * user dataset will be used for training. + */ + @JsonProperty("veoDataMixtureRatio") + public abstract Builder veoDataMixtureRatio(Double veoDataMixtureRatio); + + @ExcludeFromGeneratedCoverageReport + abstract Builder veoDataMixtureRatio(Optional veoDataMixtureRatio); + + /** Clears the value of veoDataMixtureRatio field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVeoDataMixtureRatio() { + return veoDataMixtureRatio(Optional.empty()); + } + public abstract VeoHyperParameters build(); } diff --git a/src/main/java/com/google/genai/types/VideoMetadata.java b/src/main/java/com/google/genai/types/VideoMetadata.java index 975c975827d..c7a466f2ae3 100644 --- a/src/main/java/com/google/genai/types/VideoMetadata.java +++ b/src/main/java/com/google/genai/types/VideoMetadata.java @@ -27,7 +27,10 @@ import java.time.Duration; import java.util.Optional; -/** Metadata describes the input video content. */ +/** + * Provides metadata for a video, including the start and end offsets for clipping and the frame + * rate. + */ @AutoValue @JsonDeserialize(builder = VideoMetadata.Builder.class) public abstract class VideoMetadata extends JsonSerializable { @@ -36,8 +39,8 @@ public abstract class VideoMetadata extends JsonSerializable { public abstract Optional endOffset(); /** - * Optional. The frame rate of the video sent to the model. If not specified, the default value - * will be 1.0. The fps range is (0.0, 24.0]. + * Optional. The frame rate of the video sent to the model. If not specified, the default value is + * 1.0. The valid range is (0.0, 24.0]. */ @JsonProperty("fps") public abstract Optional fps(); @@ -86,7 +89,7 @@ public Builder clearEndOffset() { * Setter for fps. * *

fps: Optional. The frame rate of the video sent to the model. If not specified, the - * default value will be 1.0. The fps range is (0.0, 24.0]. + * default value is 1.0. The valid range is (0.0, 24.0]. */ @JsonProperty("fps") public abstract Builder fps(Double fps); diff --git a/src/main/java/com/google/genai/types/VoiceConfig.java b/src/main/java/com/google/genai/types/VoiceConfig.java index bdc4b89a254..4cafaee9af9 100644 --- a/src/main/java/com/google/genai/types/VoiceConfig.java +++ b/src/main/java/com/google/genai/types/VoiceConfig.java @@ -34,7 +34,7 @@ public abstract class VoiceConfig extends JsonSerializable { @JsonProperty("replicatedVoiceConfig") public abstract Optional replicatedVoiceConfig(); - /** The configuration for the prebuilt voice to use. */ + /** The configuration for a prebuilt voice. */ @JsonProperty("prebuiltVoiceConfig") public abstract Optional prebuiltVoiceConfig(); @@ -88,7 +88,7 @@ public Builder clearReplicatedVoiceConfig() { /** * Setter for prebuiltVoiceConfig. * - *

prebuiltVoiceConfig: The configuration for the prebuilt voice to use. + *

prebuiltVoiceConfig: The configuration for a prebuilt voice. */ @JsonProperty("prebuiltVoiceConfig") public abstract Builder prebuiltVoiceConfig(PrebuiltVoiceConfig prebuiltVoiceConfig); @@ -96,7 +96,7 @@ public Builder clearReplicatedVoiceConfig() { /** * Setter for prebuiltVoiceConfig builder. * - *

prebuiltVoiceConfig: The configuration for the prebuilt voice to use. + *

prebuiltVoiceConfig: The configuration for a prebuilt voice. */ @CanIgnoreReturnValue public Builder prebuiltVoiceConfig(PrebuiltVoiceConfig.Builder prebuiltVoiceConfigBuilder) {