Skip to content
Open
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
60 changes: 4 additions & 56 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,6 @@ public LiveConverters(ApiClient apiClient) {
this.apiClient = apiClient;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"languageCodes"}))) {
throw new IllegalArgumentException(
"languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not"
+ " in Gemini Developer API mode.");
}

if (Common.getValueByPath(fromObject, new String[] {"languageAuto"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"languageAuto"},
Common.getValueByPath(fromObject, new String[] {"languageAuto"}));
}

if (Common.getValueByPath(fromObject, new String[] {"languageHints"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"languageHints"},
Common.getValueByPath(fromObject, new String[] {"languageHints"}));
}

if (Common.getValueByPath(fromObject, new String[] {"customVocabulary"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"customVocabulary"},
Common.getValueByPath(fromObject, new String[] {"customVocabulary"}));
}

if (Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"adaptationPhrases"},
Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}));
}

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -926,20 +886,14 @@ ObjectNode liveClientSetupToMldev(JsonNode fromObject, ObjectNode parentObject)
Common.setValueByPath(
toObject,
new String[] {"inputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"outputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"proactivity"}) != null) {
Expand Down Expand Up @@ -1214,20 +1168,14 @@ ObjectNode liveConnectConfigToMldev(JsonNode fromObject, ObjectNode parentObject
Common.setValueByPath(
parentObject,
new String[] {"setup", "inputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}) != null) {
Common.setValueByPath(
parentObject,
new String[] {"setup", "outputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"}) != null) {
Expand Down
50 changes: 2 additions & 48 deletions src/main/java/com/google/genai/TokensConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,6 @@ public TokensConverters(ApiClient apiClient) {
this.apiClient = apiClient;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"languageCodes"}))) {
throw new IllegalArgumentException(
"languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not"
+ " in Gemini Developer API mode.");
}

if (Common.getValueByPath(fromObject, new String[] {"languageAuto"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"languageAuto"},
Common.getValueByPath(fromObject, new String[] {"languageAuto"}));
}

if (Common.getValueByPath(fromObject, new String[] {"languageHints"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"languageHints"},
Common.getValueByPath(fromObject, new String[] {"languageHints"}));
}

if (Common.getValueByPath(fromObject, new String[] {"customVocabulary"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"customVocabulary"},
Common.getValueByPath(fromObject, new String[] {"customVocabulary"}));
}

if (Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"adaptationPhrases"},
Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}));
}

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -479,20 +439,14 @@ ObjectNode liveConnectConfigToMldev(JsonNode fromObject, ObjectNode parentObject
Common.setValueByPath(
parentObject,
new String[] {"setup", "inputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}) != null) {
Common.setValueByPath(
parentObject,
new String[] {"setup", "outputAudioTranscription"},
audioTranscriptionConfigToMldev(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})),
toObject));
Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}));
}

if (Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"}) != null) {
Expand Down
37 changes: 24 additions & 13 deletions src/main/java/com/google/genai/types/AudioTranscriptionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,24 @@
@AutoValue
@JsonDeserialize(builder = AudioTranscriptionConfig.Builder.class)
public abstract class AudioTranscriptionConfig extends JsonSerializable {
/** Deprecated: use LanguageAuto or LanguageHints instead. */
/**
* BCP-47 language codes providing hints about the languages present in the audio. If omitted or
* empty, defaults to automatic language detection.
*/
@JsonProperty("languageCodes")
public abstract Optional<List<String>> languageCodes();

/** The model will detect the language automatically. Do not use together with LanguageHints. */
/**
* Deprecated: Auto-detection is now the default when language_codes is omitted. This field will
* be removed in a future version.
*/
@JsonProperty("languageAuto")
public abstract Optional<LanguageAuto> languageAuto();

/** Specifies one or more languages in the audio. Do not use together with LanguageAuto. */
/**
* Deprecated: Use top-level language_codes instead. This field will be removed in a future
* version.
*/
@JsonProperty("languageHints")
public abstract Optional<LanguageHints> languageHints();

Expand Down Expand Up @@ -79,15 +88,17 @@ private static Builder create() {
/**
* Setter for languageCodes.
*
* <p>languageCodes: Deprecated: use LanguageAuto or LanguageHints instead.
* <p>languageCodes: BCP-47 language codes providing hints about the languages present in the
* audio. If omitted or empty, defaults to automatic language detection.
*/
@JsonProperty("languageCodes")
public abstract Builder languageCodes(List<String> languageCodes);

/**
* Setter for languageCodes.
*
* <p>languageCodes: Deprecated: use LanguageAuto or LanguageHints instead.
* <p>languageCodes: BCP-47 language codes providing hints about the languages present in the
* audio. If omitted or empty, defaults to automatic language detection.
*/
@CanIgnoreReturnValue
public Builder languageCodes(String... languageCodes) {
Expand All @@ -107,17 +118,17 @@ public Builder clearLanguageCodes() {
/**
* Setter for languageAuto.
*
* <p>languageAuto: The model will detect the language automatically. Do not use together with
* LanguageHints.
* <p>languageAuto: Deprecated: Auto-detection is now the default when language_codes is
* omitted. This field will be removed in a future version.
*/
@JsonProperty("languageAuto")
public abstract Builder languageAuto(LanguageAuto languageAuto);

/**
* Setter for languageAuto builder.
*
* <p>languageAuto: The model will detect the language automatically. Do not use together with
* LanguageHints.
* <p>languageAuto: Deprecated: Auto-detection is now the default when language_codes is
* omitted. This field will be removed in a future version.
*/
@CanIgnoreReturnValue
public Builder languageAuto(LanguageAuto.Builder languageAutoBuilder) {
Expand All @@ -137,17 +148,17 @@ public Builder clearLanguageAuto() {
/**
* Setter for languageHints.
*
* <p>languageHints: Specifies one or more languages in the audio. Do not use together with
* LanguageAuto.
* <p>languageHints: Deprecated: Use top-level language_codes instead. This field will be
* removed in a future version.
*/
@JsonProperty("languageHints")
public abstract Builder languageHints(LanguageHints languageHints);

/**
* Setter for languageHints builder.
*
* <p>languageHints: Specifies one or more languages in the audio. Do not use together with
* LanguageAuto.
* <p>languageHints: Deprecated: Use top-level language_codes instead. This field will be
* removed in a future version.
*/
@CanIgnoreReturnValue
public Builder languageHints(LanguageHints.Builder languageHintsBuilder) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/google/genai/types/LanguageAuto.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.google.auto.value.AutoValue;
import com.google.genai.JsonSerializable;

/** Indicates the language of the audio should be automatically detected. */
/** Deprecated: Language auto-detection is now the default when language_codes is omitted. */
@AutoValue
@JsonDeserialize(builder = LanguageAuto.Builder.class)
public abstract class LanguageAuto extends JsonSerializable {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/google/genai/types/LanguageHints.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import java.util.List;
import java.util.Optional;

/** Provides hints to the model about possible languages present in the audio. */
/** Deprecated: Use AudioTranscriptionConfig.language_codes instead. */
@AutoValue
@JsonDeserialize(builder = LanguageHints.Builder.class)
public abstract class LanguageHints extends JsonSerializable {
/** BCP-47 language codes. At least one must be specified. */
/** Deprecated. BCP-47 language codes. */
@JsonProperty("languageCodes")
public abstract Optional<List<String>> languageCodes();

Expand All @@ -57,15 +57,15 @@ private static Builder create() {
/**
* Setter for languageCodes.
*
* <p>languageCodes: BCP-47 language codes. At least one must be specified.
* <p>languageCodes: Deprecated. BCP-47 language codes.
*/
@JsonProperty("languageCodes")
public abstract Builder languageCodes(List<String> languageCodes);

/**
* Setter for languageCodes.
*
* <p>languageCodes: BCP-47 language codes. At least one must be specified.
* <p>languageCodes: Deprecated. BCP-47 language codes.
*/
@CanIgnoreReturnValue
public Builder languageCodes(String... languageCodes) {
Expand Down
Loading