diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 61b563bb24b..06fdf230d47 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -307,10 +307,7 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.setValueByPath( toObject, new String[] {"speechConfig"}, - speechConfigToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"speechConfig"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"speechConfig"})); } if (Common.getValueByPath(fromObject, new String[] {"stopSequences"}) != null) { @@ -1038,11 +1035,8 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( parentObject, new String[] {"setup", "generationConfig", "speechConfig"}, - speechConfigToVertex( - JsonSerializable.toJsonNode( - Transformers.tLiveSpeechConfig( - Common.getValueByPath(fromObject, new String[] {"speechConfig"}))), - toObject)); + Transformers.tLiveSpeechConfig( + Common.getValueByPath(fromObject, new String[] {"speechConfig"}))); } if (Common.getValueByPath(fromObject, new String[] {"thinkingConfig"}) != null) { @@ -1480,32 +1474,6 @@ ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parent return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode speechConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"voiceConfig"}, - Common.getValueByPath(fromObject, new String[] {"voiceConfig"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"languageCode"}, - Common.getValueByPath(fromObject, new String[] {"languageCode"})); - } - - if (!Common.isZero( - Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"}))) { - throw new IllegalArgumentException( - "multiSpeakerVoiceConfig parameter is not supported in Vertex AI."); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 68ddd78a162..dbef522f644 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -1567,11 +1567,8 @@ ObjectNode generateContentConfigToVertex( Common.setValueByPath( toObject, new String[] {"speechConfig"}, - speechConfigToVertex( - JsonSerializable.toJsonNode( - Transformers.tSpeechConfig( - Common.getValueByPath(fromObject, new String[] {"speechConfig"}))), - toObject)); + Transformers.tSpeechConfig( + Common.getValueByPath(fromObject, new String[] {"speechConfig"}))); } if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { @@ -2980,10 +2977,7 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject Common.setValueByPath( toObject, new String[] {"speechConfig"}, - speechConfigToVertex( - JsonSerializable.toJsonNode( - Common.getValueByPath(fromObject, new String[] {"speechConfig"})), - toObject)); + Common.getValueByPath(fromObject, new String[] {"speechConfig"})); } if (Common.getValueByPath(fromObject, new String[] {"stopSequences"}) != null) { @@ -4208,32 +4202,6 @@ ObjectNode segmentImageSourceToVertex(JsonNode fromObject, ObjectNode parentObje return toObject; } - @ExcludeFromGeneratedCoverageReport - ObjectNode speechConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { - ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"voiceConfig"}, - Common.getValueByPath(fromObject, new String[] {"voiceConfig"})); - } - - if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"languageCode"}, - Common.getValueByPath(fromObject, new String[] {"languageCode"})); - } - - if (!Common.isZero( - Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"}))) { - throw new IllegalArgumentException( - "multiSpeakerVoiceConfig parameter is not supported in Vertex AI."); - } - - return toObject; - } - @ExcludeFromGeneratedCoverageReport ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); diff --git a/src/main/java/com/google/genai/types/MultiSpeakerVoiceConfig.java b/src/main/java/com/google/genai/types/MultiSpeakerVoiceConfig.java index 5e21e672753..76a3876d6cb 100644 --- a/src/main/java/com/google/genai/types/MultiSpeakerVoiceConfig.java +++ b/src/main/java/com/google/genai/types/MultiSpeakerVoiceConfig.java @@ -30,11 +30,14 @@ import java.util.List; import java.util.Optional; -/** The configuration for the multi-speaker setup. This data type is not supported in Vertex AI. */ +/** Configuration for a multi-speaker text-to-speech request. */ @AutoValue @JsonDeserialize(builder = MultiSpeakerVoiceConfig.Builder.class) public abstract class MultiSpeakerVoiceConfig extends JsonSerializable { - /** Required. All the enabled speaker voices. */ + /** + * Required. A list of configurations for the voices of the speakers. Exactly two speaker voice + * configurations must be provided. + */ @JsonProperty("speakerVoiceConfigs") public abstract Optional> speakerVoiceConfigs(); @@ -59,7 +62,8 @@ private static Builder create() { /** * Setter for speakerVoiceConfigs. * - *

speakerVoiceConfigs: Required. All the enabled speaker voices. + *

speakerVoiceConfigs: Required. A list of configurations for the voices of the speakers. + * Exactly two speaker voice configurations must be provided. */ @JsonProperty("speakerVoiceConfigs") public abstract Builder speakerVoiceConfigs(List speakerVoiceConfigs); @@ -67,7 +71,8 @@ private static Builder create() { /** * Setter for speakerVoiceConfigs. * - *

speakerVoiceConfigs: Required. All the enabled speaker voices. + *

speakerVoiceConfigs: Required. A list of configurations for the voices of the speakers. + * Exactly two speaker voice configurations must be provided. */ @CanIgnoreReturnValue public Builder speakerVoiceConfigs(SpeakerVoiceConfig... speakerVoiceConfigs) { @@ -77,7 +82,8 @@ public Builder speakerVoiceConfigs(SpeakerVoiceConfig... speakerVoiceConfigs) { /** * Setter for speakerVoiceConfigs builder. * - *

speakerVoiceConfigs: Required. All the enabled speaker voices. + *

speakerVoiceConfigs: Required. A list of configurations for the voices of the speakers. + * Exactly two speaker voice configurations must be provided. */ @CanIgnoreReturnValue public Builder speakerVoiceConfigs(SpeakerVoiceConfig.Builder... speakerVoiceConfigsBuilders) { diff --git a/src/main/java/com/google/genai/types/SpeechConfig.java b/src/main/java/com/google/genai/types/SpeechConfig.java index 8d4f1b7a446..c18a5c5b779 100644 --- a/src/main/java/com/google/genai/types/SpeechConfig.java +++ b/src/main/java/com/google/genai/types/SpeechConfig.java @@ -39,8 +39,8 @@ public abstract class SpeechConfig extends JsonSerializable { public abstract Optional languageCode(); /** - * Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the - * voice_config field. This field is not supported in Vertex AI. + * The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive + * with `voice_config`. */ @JsonProperty("multiSpeakerVoiceConfig") public abstract Optional multiSpeakerVoiceConfig(); @@ -112,8 +112,8 @@ public Builder clearLanguageCode() { /** * Setter for multiSpeakerVoiceConfig. * - *

multiSpeakerVoiceConfig: Optional. The configuration for the multi-speaker setup. It is - * mutually exclusive with the voice_config field. This field is not supported in Vertex AI. + *

multiSpeakerVoiceConfig: The configuration for a multi-speaker text-to-speech request. + * This field is mutually exclusive with `voice_config`. */ @JsonProperty("multiSpeakerVoiceConfig") public abstract Builder multiSpeakerVoiceConfig( @@ -122,8 +122,8 @@ public abstract Builder multiSpeakerVoiceConfig( /** * Setter for multiSpeakerVoiceConfig builder. * - *

multiSpeakerVoiceConfig: Optional. The configuration for the multi-speaker setup. It is - * mutually exclusive with the voice_config field. This field is not supported in Vertex AI. + *

multiSpeakerVoiceConfig: The configuration for a multi-speaker text-to-speech request. + * This field is mutually exclusive with `voice_config`. */ @CanIgnoreReturnValue public Builder multiSpeakerVoiceConfig(