Skip to content

Commit 36ba543

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Update data types from discovery doc.
PiperOrigin-RevId: 840888933
1 parent 42e76ee commit 36ba543

File tree

88 files changed

+965
-5565
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

+965
-5565
lines changed

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

Lines changed: 24 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,6 @@ 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-
10767
@ExcludeFromGeneratedCoverageReport
10868
ObjectNode batchJobDestinationFromMldev(JsonNode fromObject, ObjectNode parentObject) {
10969
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -567,18 +527,18 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) {
567527
Common.getValueByPath(fromObject, new String[] {"finishReason"}));
568528
}
569529

570-
if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) {
530+
if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) {
571531
Common.setValueByPath(
572532
toObject,
573-
new String[] {"groundingMetadata"},
574-
Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}));
533+
new String[] {"avgLogprobs"},
534+
Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}));
575535
}
576536

577-
if (Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}) != null) {
537+
if (Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}) != null) {
578538
Common.setValueByPath(
579539
toObject,
580-
new String[] {"avgLogprobs"},
581-
Common.getValueByPath(fromObject, new String[] {"avgLogprobs"}));
540+
new String[] {"groundingMetadata"},
541+
Common.getValueByPath(fromObject, new String[] {"groundingMetadata"}));
582542
}
583543

584544
if (Common.getValueByPath(fromObject, new String[] {"index"}) != null) {
@@ -1264,11 +1224,8 @@ ObjectNode generateContentConfigToMldev(
12641224
Common.setValueByPath(
12651225
toObject,
12661226
new String[] {"speechConfig"},
1267-
speechConfigToMldev(
1268-
JsonSerializable.toJsonNode(
1269-
Transformers.tSpeechConfig(
1270-
Common.getValueByPath(fromObject, new String[] {"speechConfig"}))),
1271-
toObject));
1227+
Transformers.tSpeechConfig(
1228+
Common.getValueByPath(fromObject, new String[] {"speechConfig"})));
12721229
}
12731230

12741231
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}))) {
@@ -1382,14 +1339,8 @@ ObjectNode getBatchJobParametersToVertex(
13821339
@ExcludeFromGeneratedCoverageReport
13831340
ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
13841341
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
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));
1342+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) {
1343+
throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API.");
13931344
}
13941345

13951346
if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) {
@@ -1405,14 +1356,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
14051356
@ExcludeFromGeneratedCoverageReport
14061357
ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) {
14071358
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
1408-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
1359+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) {
14091360
throw new IllegalArgumentException(
1410-
"blockingConfidence parameter is not supported in Gemini API.");
1361+
"excludeDomains parameter is not supported in Gemini API.");
14111362
}
14121363

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

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

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-
14661407
return toObject;
14671408
}
14681409

@@ -1684,24 +1625,6 @@ ObjectNode listBatchJobsResponseFromVertex(JsonNode fromObject, ObjectNode paren
16841625
return toObject;
16851626
}
16861627

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-
17051628
@ExcludeFromGeneratedCoverageReport
17061629
ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
17071630
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1791,13 +1714,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
17911714
Common.getValueByPath(fromObject, new String[] {"videoMetadata"}));
17921715
}
17931716

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-
18011717
return toObject;
18021718
}
18031719

@@ -1825,62 +1741,6 @@ ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) {
18251741
return toObject;
18261742
}
18271743

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-
18841744
@ExcludeFromGeneratedCoverageReport
18851745
ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
18861746
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
@@ -1939,16 +1799,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
19391799
Common.getValueByPath(fromObject, new String[] {"fileSearch"}));
19401800
}
19411801

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-
19521802
if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) {
19531803
Common.setValueByPath(
19541804
toObject,
@@ -1961,6 +1811,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
19611811
"enterpriseWebSearch parameter is not supported in Gemini API.");
19621812
}
19631813

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+
19641824
if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) {
19651825
Common.setValueByPath(
19661826
toObject,
@@ -1981,24 +1841,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
19811841
return toObject;
19821842
}
19831843

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-
20021844
/** A shared buildRequest method for both sync and async methods. */
20031845
BuiltRequest buildRequestForPrivateCreate(
20041846
String model, BatchJobSource src, CreateBatchJobConfig config) {

0 commit comments

Comments
 (0)