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
64 changes: 64 additions & 0 deletions src/main/java/com/google/genai/Batches.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,53 @@ public Batches(ApiClient apiClient) {
this.apiClient = apiClient;
}

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

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

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

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

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -1430,6 +1477,16 @@ ObjectNode generateContentConfigToMldev(
Common.getValueByPath(fromObject, new String[] {"serviceTier"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -1966,6 +2023,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
}

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

return toObject;
}

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/google/genai/Caches.java
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -1066,6 +1073,13 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) {
+ " Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down
35 changes: 35 additions & 0 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode paren
Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}));
}

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

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

return toObject;
}

Expand Down Expand Up @@ -518,6 +532,13 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject
+ " Gemini Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down Expand Up @@ -1907,6 +1928,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -2014,6 +2042,13 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) {
+ " Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down
87 changes: 87 additions & 0 deletions src/main/java/com/google/genai/Models.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,54 @@ void videoGenerationReferenceTypeMldevEnumValidate(Object enumValue) {
}
}

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

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

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

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

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -1746,6 +1794,17 @@ ObjectNode generateContentConfigToMldev(
Common.getValueByPath(fromObject, new String[] {"serviceTier"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -1998,6 +2057,13 @@ ObjectNode generateContentConfigToVertex(
Common.getValueByPath(fromObject, new String[] {"serviceTier"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -3568,6 +3634,13 @@ ObjectNode generationConfigToVertex(
+ " Gemini Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down Expand Up @@ -4401,6 +4474,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -4510,6 +4590,13 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r
+ " Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/google/genai/TokensConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode paren
Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}));
}

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

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

return toObject;
}

Expand Down Expand Up @@ -679,6 +693,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
}

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

return toObject;
}

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/google/genai/Tunings.java
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,13 @@ ObjectNode generationConfigFromVertex(
Common.getValueByPath(fromObject, new String[] {"responseFormat"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -1411,6 +1418,13 @@ ObjectNode generationConfigToVertex(
+ " Gemini Enterprise Agent Platform mode.");
}

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

return toObject;
}

Expand Down
Loading
Loading