Skip to content

Commit 42e76ee

Browse files
jscudcopybara-github
authored andcommitted
feat: Update data types from discovery doc.
PiperOrigin-RevId: 840874953
1 parent 1cd802a commit 42e76ee

File tree

88 files changed

+5565
-965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5565
-965
lines changed

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

Lines changed: 182 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,46 @@ public Batches(ApiClient apiClient) {
6464
this.apiClient = apiClient;
6565
}
6666

67+
@ExcludeFromGeneratedCoverageReport
68+
ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
69+
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
70+
if (Common.getValueByPath(fromObject, new String[] {"apiKey"}) != null) {
71+
Common.setValueByPath(
72+
toObject,
73+
new String[] {"apiKey"},
74+
Common.getValueByPath(fromObject, new String[] {"apiKey"}));
75+
}
76+
77+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"apiKeyConfig"}))) {
78+
throw new IllegalArgumentException("apiKeyConfig parameter is not supported in Gemini API.");
79+
}
80+
81+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authType"}))) {
82+
throw new IllegalArgumentException("authType parameter is not supported in Gemini API.");
83+
}
84+
85+
if (!Common.isZero(
86+
Common.getValueByPath(fromObject, new String[] {"googleServiceAccountConfig"}))) {
87+
throw new IllegalArgumentException(
88+
"googleServiceAccountConfig parameter is not supported in Gemini API.");
89+
}
90+
91+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"httpBasicAuthConfig"}))) {
92+
throw new IllegalArgumentException(
93+
"httpBasicAuthConfig parameter is not supported in Gemini API.");
94+
}
95+
96+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oauthConfig"}))) {
97+
throw new IllegalArgumentException("oauthConfig parameter is not supported in Gemini API.");
98+
}
99+
100+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"oidcConfig"}))) {
101+
throw new IllegalArgumentException("oidcConfig parameter is not supported in Gemini API.");
102+
}
103+
104+
return toObject;
105+
}
106+
67107
@ExcludeFromGeneratedCoverageReport
68108
ObjectNode batchJobDestinationFromMldev(JsonNode fromObject, ObjectNode parentObject) {
69109
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -527,18 +567,18 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) {
527567
Common.getValueByPath(fromObject, new String[] {"finishReason"}));
528568
}
529569

530-
if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) {
570+
if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) {
531571
Common.setValueByPath(
532572
toObject,
533-
new String[] {"avgLogprobs"},
534-
Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}));
573+
new String[] {"groundingMetadata"},
574+
Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}));
535575
}
536576

537-
if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) {
577+
if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) {
538578
Common.setValueByPath(
539579
toObject,
540-
new String[] {"groundingMetadata"},
541-
Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}));
580+
new String[] {"avgLogprobs"},
581+
Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}));
542582
}
543583

544584
if (Common.getValueByPath(fromObject, new String[] {"index"}) != null) {
@@ -1224,8 +1264,11 @@ ObjectNode generateContentConfigToMldev(
12241264
Common.setValueByPath(
12251265
toObject,
12261266
new String[] {"speechConfig"},
1227-
Transformers.tSpeechConfig(
1228-
Common.getValueByPath(fromObject, new String[] {"speechConfig"})));
1267+
speechConfigToMldev(
1268+
JsonSerializable.toJsonNode(
1269+
Transformers.tSpeechConfig(
1270+
Common.getValueByPath(fromObject, new String[] {"speechConfig"}))),
1271+
toObject));
12291272
}
12301273

12311274
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}))) {
@@ -1339,8 +1382,14 @@ ObjectNode getBatchJobParametersToVertex(
13391382
@ExcludeFromGeneratedCoverageReport
13401383
ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
13411384
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1342-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) {
1343-
throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API.");
1385+
if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) {
1386+
Common.setValueByPath(
1387+
toObject,
1388+
new String[] {"authConfig"},
1389+
authConfigToMldev(
1390+
JsonSerializable.toJsonNode(
1391+
Common.getValueByPath(fromObject, new String[] {"authConfig"})),
1392+
toObject));
13441393
}
13451394

13461395
if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) {
@@ -1356,14 +1405,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
13561405
@ExcludeFromGeneratedCoverageReport
13571406
ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) {
13581407
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1359-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) {
1408+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
13601409
throw new IllegalArgumentException(
1361-
"excludeDomains parameter is not supported in Gemini API.");
1410+
"blockingConfidence parameter is not supported in Gemini API.");
13621411
}
13631412

1364-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
1413+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) {
13651414
throw new IllegalArgumentException(
1366-
"blockingConfidence parameter is not supported in Gemini API.");
1415+
"excludeDomains parameter is not supported in Gemini API.");
13671416
}
13681417

13691418
if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) {
@@ -1404,6 +1453,16 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
14041453
"outputCompressionQuality parameter is not supported in Gemini API.");
14051454
}
14061455

1456+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"}))) {
1457+
throw new IllegalArgumentException(
1458+
"imageOutputOptions parameter is not supported in Gemini API.");
1459+
}
1460+
1461+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"personGeneration"}))) {
1462+
throw new IllegalArgumentException(
1463+
"personGeneration parameter is not supported in Gemini API.");
1464+
}
1465+
14071466
return toObject;
14081467
}
14091468

@@ -1625,6 +1684,24 @@ ObjectNode listBatchJobsResponseFromVertex(JsonNode fromObject, ObjectNode paren
16251684
return toObject;
16261685
}
16271686

1687+
@ExcludeFromGeneratedCoverageReport
1688+
ObjectNode multiSpeakerVoiceConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1689+
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1690+
if (Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"}) != null) {
1691+
ArrayNode keyArray =
1692+
(ArrayNode) Common.getValueByPath(fromObject, new String[] {"speakerVoiceConfigs"});
1693+
ObjectMapper objectMapper = new ObjectMapper();
1694+
ArrayNode result = objectMapper.createArrayNode();
1695+
1696+
for (JsonNode item : keyArray) {
1697+
result.add(speakerVoiceConfigToMldev(JsonSerializable.toJsonNode(item), toObject));
1698+
}
1699+
Common.setValueByPath(toObject, new String[] {"speakerVoiceConfigs"}, result);
1700+
}
1701+
1702+
return toObject;
1703+
}
1704+
16281705
@ExcludeFromGeneratedCoverageReport
16291706
ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
16301707
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1714,6 +1791,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
17141791
Common.getValueByPath(fromObject, new String[] {"videoMetadata"}));
17151792
}
17161793

1794+
if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) {
1795+
Common.setValueByPath(
1796+
toObject,
1797+
new String[] {"partMetadata"},
1798+
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
1799+
}
1800+
17171801
return toObject;
17181802
}
17191803

@@ -1741,6 +1825,62 @@ ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) {
17411825
return toObject;
17421826
}
17431827

1828+
@ExcludeFromGeneratedCoverageReport
1829+
ObjectNode speakerVoiceConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1830+
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1831+
if (Common.getValueByPath(fromObject, new String[] {"speaker"}) != null) {
1832+
Common.setValueByPath(
1833+
toObject,
1834+
new String[] {"speaker"},
1835+
Common.getValueByPath(fromObject, new String[] {"speaker"}));
1836+
}
1837+
1838+
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
1839+
Common.setValueByPath(
1840+
toObject,
1841+
new String[] {"voiceConfig"},
1842+
voiceConfigToMldev(
1843+
JsonSerializable.toJsonNode(
1844+
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
1845+
toObject));
1846+
}
1847+
1848+
return toObject;
1849+
}
1850+
1851+
@ExcludeFromGeneratedCoverageReport
1852+
ObjectNode speechConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1853+
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1854+
if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) {
1855+
Common.setValueByPath(
1856+
toObject,
1857+
new String[] {"languageCode"},
1858+
Common.getValueByPath(fromObject, new String[] {"languageCode"}));
1859+
}
1860+
1861+
if (Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"}) != null) {
1862+
Common.setValueByPath(
1863+
toObject,
1864+
new String[] {"multiSpeakerVoiceConfig"},
1865+
multiSpeakerVoiceConfigToMldev(
1866+
JsonSerializable.toJsonNode(
1867+
Common.getValueByPath(fromObject, new String[] {"multiSpeakerVoiceConfig"})),
1868+
toObject));
1869+
}
1870+
1871+
if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) {
1872+
Common.setValueByPath(
1873+
toObject,
1874+
new String[] {"voiceConfig"},
1875+
voiceConfigToMldev(
1876+
JsonSerializable.toJsonNode(
1877+
Common.getValueByPath(fromObject, new String[] {"voiceConfig"})),
1878+
toObject));
1879+
}
1880+
1881+
return toObject;
1882+
}
1883+
17441884
@ExcludeFromGeneratedCoverageReport
17451885
ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
17461886
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1799,6 +1939,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
17991939
Common.getValueByPath(fromObject, new String[] {"fileSearch"}));
18001940
}
18011941

1942+
if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) {
1943+
Common.setValueByPath(
1944+
toObject,
1945+
new String[] {"googleMaps"},
1946+
googleMapsToMldev(
1947+
JsonSerializable.toJsonNode(
1948+
Common.getValueByPath(fromObject, new String[] {"googleMaps"})),
1949+
toObject));
1950+
}
1951+
18021952
if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) {
18031953
Common.setValueByPath(
18041954
toObject,
@@ -1811,16 +1961,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
18111961
"enterpriseWebSearch parameter is not supported in Gemini API.");
18121962
}
18131963

1814-
if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) {
1815-
Common.setValueByPath(
1816-
toObject,
1817-
new String[] {"googleMaps"},
1818-
googleMapsToMldev(
1819-
JsonSerializable.toJsonNode(
1820-
Common.getValueByPath(fromObject, new String[] {"googleMaps"})),
1821-
toObject));
1822-
}
1823-
18241964
if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) {
18251965
Common.setValueByPath(
18261966
toObject,
@@ -1841,6 +1981,24 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
18411981
return toObject;
18421982
}
18431983

1984+
@ExcludeFromGeneratedCoverageReport
1985+
ObjectNode voiceConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1986+
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1987+
if (Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}) != null) {
1988+
Common.setValueByPath(
1989+
toObject,
1990+
new String[] {"prebuiltVoiceConfig"},
1991+
Common.getValueByPath(fromObject, new String[] {"prebuiltVoiceConfig"}));
1992+
}
1993+
1994+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"replicatedVoiceConfig"}))) {
1995+
throw new IllegalArgumentException(
1996+
"replicatedVoiceConfig parameter is not supported in Gemini API.");
1997+
}
1998+
1999+
return toObject;
2000+
}
2001+
18442002
/** A shared buildRequest method for both sync and async methods. */
18452003
BuiltRequest buildRequestForPrivateCreate(
18462004
String model, BatchJobSource src, CreateBatchJobConfig config) {

0 commit comments

Comments
 (0)