Skip to content

Commit 10b4f10

Browse files
jaycee-licopybara-github
authored andcommitted
chore: Clean up no-op converters
PiperOrigin-RevId: 896112348
1 parent eadce20 commit 10b4f10

3 files changed

Lines changed: 7 additions & 396 deletions

File tree

src/main/java/com/google/genai/LiveConverters.java

Lines changed: 3 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,7 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject
381381
Common.setValueByPath(
382382
toObject,
383383
new String[] {"speechConfig"},
384-
speechConfigToVertex(
385-
JsonSerializable.toJsonNode(
386-
Common.getValueByPath(fromObject, new String[] {"speechConfig"})),
387-
toObject));
384+
Common.getValueByPath(fromObject, new String[] {"speechConfig"}));
388385
}
389386

390387
if (Common.getValueByPath(fromObject, new String[] {"stopSequences"}) != null) {
@@ -1167,11 +1164,8 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec
11671164
Common.setValueByPath(
11681165
parentObject,
11691166
new String[] {"setup", "generationConfig", "speechConfig"},
1170-
speechConfigToVertex(
1171-
JsonSerializable.toJsonNode(
1172-
Transformers.tLiveSpeechConfig(
1173-
Common.getValueByPath(fromObject, new String[] {"speechConfig"}))),
1174-
toObject));
1167+
Transformers.tLiveSpeechConfig(
1168+
Common.getValueByPath(fromObject, new String[] {"speechConfig"})));
11751169
}
11761170

11771171
if (Common.getValueByPath(fromObject, new String[] {"thinkingConfig"}) != null) {
@@ -1585,24 +1579,6 @@ ObjectNode liveServerMessageFromVertex(JsonNode fromObject, ObjectNode parentObj
15851579
return toObject;
15861580
}
15871581

1588-
@ExcludeFromGeneratedCoverageReport
1589-
ObjectNode multiSpeakerVoiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) {
1590-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1591-
if (Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"}) != null) {
1592-
ArrayNode keyArray =
1593-
(ArrayNode) Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"});
1594-
ObjectMapper objectMapper = new ObjectMapper();
1595-
ArrayNode result = objectMapper.createArrayNode();
1596-
1597-
for (JsonNode item : keyArray) {
1598-
result.add(speakerVoiceConfigToVertex(JsonSerializable.toJsonNode(item), toObject));
1599-
}
1600-
Common.setValueByPath(toObject, new String[] {"speakerVoiceConfigs"}, result);
1601-
}
1602-
1603-
return toObject;
1604-
}
1605-
16061582
@ExcludeFromGeneratedCoverageReport
16071583
ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
16081584
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1811,26 +1787,6 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) {
18111787
return toObject;
18121788
}
18131789

1814-
@ExcludeFromGeneratedCoverageReport
1815-
ObjectNode replicatedVoiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) {
1816-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1817-
if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) {
1818-
Common.setValueByPath(
1819-
toObject,
1820-
new String[] {"mimeType"},
1821-
Common.getValueByPath(fromObject, new String[] {"mimeType"}));
1822-
}
1823-
1824-
if (Common.getValueByPath(fromObject, new String[] {"voiceSampleAudio"}) != null) {
1825-
Common.setValueByPath(
1826-
toObject,
1827-
new String[] {"voiceSampleAudio"},
1828-
Common.getValueByPath(fromObject, new String[] {"voiceSampleAudio"}));
1829-
}
1830-
1831-
return toObject;
1832-
}
1833-
18341790
@ExcludeFromGeneratedCoverageReport
18351791
ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
18361792
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1848,62 +1804,6 @@ ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parent
18481804
return toObject;
18491805
}
18501806

1851-
@ExcludeFromGeneratedCoverageReport
1852-
ObjectNode speakerVoiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) {
1853-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1854-
if (Common.getValueByPath(fromObject, new String[] {"speaker"}) != null) {
1855-
Common.setValueByPath(
1856-
toObject,
1857-
new String[] {"speaker"},
1858-
Common.getValueByPath(fromObject, new String[] {"speaker"}));
1859-
}
1860-
1861-
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
1862-
Common.setValueByPath(
1863-
toObject,
1864-
new String[] {"voiceConfig"},
1865-
voiceConfigToVertex(
1866-
JsonSerializable.toJsonNode(
1867-
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
1868-
toObject));
1869-
}
1870-
1871-
return toObject;
1872-
}
1873-
1874-
@ExcludeFromGeneratedCoverageReport
1875-
ObjectNode speechConfigToVertex(JsonNode fromObject, ObjectNode parentObject) {
1876-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1877-
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
1878-
Common.setValueByPath(
1879-
toObject,
1880-
new String[] {"voiceConfig"},
1881-
voiceConfigToVertex(
1882-
JsonSerializable.toJsonNode(
1883-
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
1884-
toObject));
1885-
}
1886-
1887-
if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) {
1888-
Common.setValueByPath(
1889-
toObject,
1890-
new String[] {"languageCode"},
1891-
Common.getValueByPath(fromObject, new String[] {"languageCode"}));
1892-
}
1893-
1894-
if (Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"}) != null) {
1895-
Common.setValueByPath(
1896-
toObject,
1897-
new String[] {"multiSpeakerVoiceConfig"},
1898-
multiSpeakerVoiceConfigToVertex(
1899-
JsonSerializable.toJsonNode(
1900-
Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"})),
1901-
toObject));
1902-
}
1903-
1904-
return toObject;
1905-
}
1906-
19071807
@ExcludeFromGeneratedCoverageReport
19081808
ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
19091809
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -2190,27 +2090,4 @@ ObjectNode voiceActivityFromVertex(JsonNode fromObject, ObjectNode parentObject)
21902090

21912091
return toObject;
21922092
}
2193-
2194-
@ExcludeFromGeneratedCoverageReport
2195-
ObjectNode voiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) {
2196-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
2197-
if (Common.getValueByPath(fromObject, new String[] {"replicatedVoiceConfig"}) != null) {
2198-
Common.setValueByPath(
2199-
toObject,
2200-
new String[] {"replicatedVoiceConfig"},
2201-
replicatedVoiceConfigToVertex(
2202-
JsonSerializable.toJsonNode(
2203-
Common.getValueByPath(fromObject, new String[] {"replicatedVoiceConfig"})),
2204-
toObject));
2205-
}
2206-
2207-
if (Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}) != null) {
2208-
Common.setValueByPath(
2209-
toObject,
2210-
new String[] {"prebuiltVoiceConfig"},
2211-
Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}));
2212-
}
2213-
2214-
return toObject;
2215-
}
22162093
}

src/main/java/com/google/genai/Models.java

Lines changed: 3 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,12 +1825,8 @@ ObjectNode generateContentConfigToVertex(
18251825
Common.setValueByPath(
18261826
toObject,
18271827
new String[] {"speechConfig"},
1828-
speechConfigToVertex(
1829-
JsonSerializable.toJsonNode(
1830-
Transformers.tSpeechConfig(
1831-
Common.getValueByPath(fromObject, new String[] {"speechConfig"}))),
1832-
toObject,
1833-
rootObject));
1828+
Transformers.tSpeechConfig(
1829+
Common.getValueByPath(fromObject, new String[] {"speechConfig"})));
18341830
}
18351831

18361832
if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) {
@@ -3334,11 +3330,7 @@ ObjectNode generationConfigToVertex(
33343330
Common.setValueByPath(
33353331
toObject,
33363332
new String[] {"speechConfig"},
3337-
speechConfigToVertex(
3338-
JsonSerializable.toJsonNode(
3339-
Common.getValueByPath(fromObject, new String[] {"speechConfig"})),
3340-
toObject,
3341-
rootObject));
3333+
Common.getValueByPath(fromObject, new String[] {"speechConfig"}));
33423334
}
33433335

33443336
if (Common.getValueByPath(fromObject, new String[] {"stopSequences"}) != null) {
@@ -4054,26 +4046,6 @@ ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject, JsonNod
40544046
return toObject;
40554047
}
40564048

4057-
@ExcludeFromGeneratedCoverageReport
4058-
ObjectNode multiSpeakerVoiceConfigToVertex(
4059-
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
4060-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
4061-
if (Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"}) != null) {
4062-
ArrayNode keyArray =
4063-
(ArrayNode) Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"});
4064-
ObjectMapper objectMapper = new ObjectMapper();
4065-
ArrayNode result = objectMapper.createArrayNode();
4066-
4067-
for (JsonNode item : keyArray) {
4068-
result.add(
4069-
speakerVoiceConfigToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject));
4070-
}
4071-
Common.setValueByPath(toObject, new String[] {"speakerVoiceConfigs"}, result);
4072-
}
4073-
4074-
return toObject;
4075-
}
4076-
40774049
@ExcludeFromGeneratedCoverageReport
40784050
ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
40794051
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -4546,27 +4518,6 @@ ObjectNode referenceImageAPIToVertex(
45464518
return toObject;
45474519
}
45484520

4549-
@ExcludeFromGeneratedCoverageReport
4550-
ObjectNode replicatedVoiceConfigToVertex(
4551-
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
4552-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
4553-
if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) {
4554-
Common.setValueByPath(
4555-
toObject,
4556-
new String[] {"mimeType"},
4557-
Common.getValueByPath(fromObject, new String[] {"mimeType"}));
4558-
}
4559-
4560-
if (Common.getValueByPath(fromObject, new String[] {"voiceSampleAudio"}) != null) {
4561-
Common.setValueByPath(
4562-
toObject,
4563-
new String[] {"voiceSampleAudio"},
4564-
Common.getValueByPath(fromObject, new String[] {"voiceSampleAudio"}));
4565-
}
4566-
4567-
return toObject;
4568-
}
4569-
45704521
@ExcludeFromGeneratedCoverageReport
45714522
ObjectNode safetyAttributesFromMldev(
45724523
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
@@ -4807,67 +4758,6 @@ ObjectNode segmentImageSourceToVertex(
48074758
return toObject;
48084759
}
48094760

4810-
@ExcludeFromGeneratedCoverageReport
4811-
ObjectNode speakerVoiceConfigToVertex(
4812-
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
4813-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
4814-
if (Common.getValueByPath(fromObject, new String[] {"speaker"}) != null) {
4815-
Common.setValueByPath(
4816-
toObject,
4817-
new String[] {"speaker"},
4818-
Common.getValueByPath(fromObject, new String[] {"speaker"}));
4819-
}
4820-
4821-
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
4822-
Common.setValueByPath(
4823-
toObject,
4824-
new String[] {"voiceConfig"},
4825-
voiceConfigToVertex(
4826-
JsonSerializable.toJsonNode(
4827-
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
4828-
toObject,
4829-
rootObject));
4830-
}
4831-
4832-
return toObject;
4833-
}
4834-
4835-
@ExcludeFromGeneratedCoverageReport
4836-
ObjectNode speechConfigToVertex(
4837-
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
4838-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
4839-
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
4840-
Common.setValueByPath(
4841-
toObject,
4842-
new String[] {"voiceConfig"},
4843-
voiceConfigToVertex(
4844-
JsonSerializable.toJsonNode(
4845-
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
4846-
toObject,
4847-
rootObject));
4848-
}
4849-
4850-
if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) {
4851-
Common.setValueByPath(
4852-
toObject,
4853-
new String[] {"languageCode"},
4854-
Common.getValueByPath(fromObject, new String[] {"languageCode"}));
4855-
}
4856-
4857-
if (Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"}) != null) {
4858-
Common.setValueByPath(
4859-
toObject,
4860-
new String[] {"multiSpeakerVoiceConfig"},
4861-
multiSpeakerVoiceConfigToVertex(
4862-
JsonSerializable.toJsonNode(
4863-
Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"})),
4864-
toObject,
4865-
rootObject));
4866-
}
4867-
4868-
return toObject;
4869-
}
4870-
48714761
@ExcludeFromGeneratedCoverageReport
48724762
ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
48734763
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -5580,31 +5470,6 @@ ObjectNode videoToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode
55805470
return toObject;
55815471
}
55825472

5583-
@ExcludeFromGeneratedCoverageReport
5584-
ObjectNode voiceConfigToVertex(
5585-
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
5586-
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
5587-
if (Common.getValueByPath(fromObject, new String[] {"replicatedVoiceConfig"}) != null) {
5588-
Common.setValueByPath(
5589-
toObject,
5590-
new String[] {"replicatedVoiceConfig"},
5591-
replicatedVoiceConfigToVertex(
5592-
JsonSerializable.toJsonNode(
5593-
Common.getValueByPath(fromObject, new String[] {"replicatedVoiceConfig"})),
5594-
toObject,
5595-
rootObject));
5596-
}
5597-
5598-
if (Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}) != null) {
5599-
Common.setValueByPath(
5600-
toObject,
5601-
new String[] {"prebuiltVoiceConfig"},
5602-
Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}));
5603-
}
5604-
5605-
return toObject;
5606-
}
5607-
56085473
/** A shared buildRequest method for both sync and async methods. */
56095474
BuiltRequest buildRequestForPrivateGenerateContent(
56105475
String model, List<Content> contents, GenerateContentConfig config) {

0 commit comments

Comments
 (0)