Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 3 additions & 35 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
38 changes: 3 additions & 35 deletions src/main/java/com/google/genai/Models.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/com/google/genai/types/MultiSpeakerVoiceConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<SpeakerVoiceConfig>> speakerVoiceConfigs();

Expand All @@ -59,15 +62,17 @@ private static Builder create() {
/**
* Setter for speakerVoiceConfigs.
*
* <p>speakerVoiceConfigs: Required. All the enabled speaker voices.
* <p>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<SpeakerVoiceConfig> speakerVoiceConfigs);

/**
* Setter for speakerVoiceConfigs.
*
* <p>speakerVoiceConfigs: Required. All the enabled speaker voices.
* <p>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) {
Expand All @@ -77,7 +82,8 @@ public Builder speakerVoiceConfigs(SpeakerVoiceConfig... speakerVoiceConfigs) {
/**
* Setter for speakerVoiceConfigs builder.
*
* <p>speakerVoiceConfigs: Required. All the enabled speaker voices.
* <p>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) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/google/genai/types/SpeechConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public abstract class SpeechConfig extends JsonSerializable {
public abstract Optional<String> 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> multiSpeakerVoiceConfig();
Expand Down Expand Up @@ -112,8 +112,8 @@ public Builder clearLanguageCode() {
/**
* Setter for multiSpeakerVoiceConfig.
*
* <p>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.
* <p>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(
Expand All @@ -122,8 +122,8 @@ public abstract Builder multiSpeakerVoiceConfig(
/**
* Setter for multiSpeakerVoiceConfig builder.
*
* <p>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.
* <p>multiSpeakerVoiceConfig: The configuration for a multi-speaker text-to-speech request.
* This field is mutually exclusive with `voice_config`.
*/
@CanIgnoreReturnValue
public Builder multiSpeakerVoiceConfig(
Expand Down
Loading