Skip to content

Commit f514d4b

Browse files
jscudcopybara-github
authored andcommitted
feat: Update data types from discovery doc.
PiperOrigin-RevId: 832486480
1 parent b1565a3 commit f514d4b

File tree

77 files changed

+4852
-1140
lines changed

Some content is hidden

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

77 files changed

+4852
-1140
lines changed

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

Lines changed: 87 additions & 112 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) {
@@ -977,65 +1017,6 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) {
9771017
return toObject;
9781018
}
9791019

980-
@ExcludeFromGeneratedCoverageReport
981-
ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) {
982-
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();
983-
if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) {
984-
Common.setValueByPath(
985-
toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"}));
986-
}
987-
988-
if (Common.getValueByPath(fromObject, new String[] {"args"}) != null) {
989-
Common.setValueByPath(
990-
toObject,
991-
new String[] {"args"},
992-
Common.getValueByPath(fromObject, new String[] {"args"}));
993-
}
994-
995-
if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) {
996-
Common.setValueByPath(
997-
toObject,
998-
new String[] {"name"},
999-
Common.getValueByPath(fromObject, new String[] {"name"}));
1000-
}
1001-
1002-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"partialArgs"}))) {
1003-
throw new IllegalArgumentException("partialArgs parameter is not supported in Gemini API.");
1004-
}
1005-
1006-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"willContinue"}))) {
1007-
throw new IllegalArgumentException("willContinue parameter is not supported in Gemini API.");
1008-
}
1009-
1010-
return toObject;
1011-
}
1012-
1013-
@ExcludeFromGeneratedCoverageReport
1014-
ObjectNode functionCallingConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1015-
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();
1016-
if (Common.getValueByPath(fromObject, new String[] {"mode"}) != null) {
1017-
Common.setValueByPath(
1018-
toObject,
1019-
new String[] {"mode"},
1020-
Common.getValueByPath(fromObject, new String[] {"mode"}));
1021-
}
1022-
1023-
if (Common.getValueByPath(fromObject, new String[] {"allowedFunctionNames"}) != null) {
1024-
Common.setValueByPath(
1025-
toObject,
1026-
new String[] {"allowedFunctionNames"},
1027-
Common.getValueByPath(fromObject, new String[] {"allowedFunctionNames"}));
1028-
}
1029-
1030-
if (!Common.isZero(
1031-
Common.getValueByPath(fromObject, new String[] {"streamFunctionCallArguments"}))) {
1032-
throw new IllegalArgumentException(
1033-
"streamFunctionCallArguments parameter is not supported in Gemini API.");
1034-
}
1035-
1036-
return toObject;
1037-
}
1038-
10391020
@ExcludeFromGeneratedCoverageReport
10401021
ObjectNode generateContentConfigToMldev(
10411022
ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) {
@@ -1188,10 +1169,7 @@ ObjectNode generateContentConfigToMldev(
11881169
Common.setValueByPath(
11891170
parentObject,
11901171
new String[] {"toolConfig"},
1191-
toolConfigToMldev(
1192-
JsonSerializable.toJsonNode(
1193-
Common.getValueByPath(fromObject, new String[] {"toolConfig"})),
1194-
toObject));
1172+
Common.getValueByPath(fromObject, new String[] {"toolConfig"}));
11951173
}
11961174

11971175
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"labels"}))) {
@@ -1339,8 +1317,14 @@ ObjectNode getBatchJobParametersToVertex(
13391317
@ExcludeFromGeneratedCoverageReport
13401318
ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
13411319
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.");
1320+
if (Common.getValueByPath(fromObject, new String[] {"authConfig"}) != null) {
1321+
Common.setValueByPath(
1322+
toObject,
1323+
new String[] {"authConfig"},
1324+
authConfigToMldev(
1325+
JsonSerializable.toJsonNode(
1326+
Common.getValueByPath(fromObject, new String[] {"authConfig"})),
1327+
toObject));
13441328
}
13451329

13461330
if (Common.getValueByPath(fromObject, new String[] {"enableWidget"}) != null) {
@@ -1356,14 +1340,14 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
13561340
@ExcludeFromGeneratedCoverageReport
13571341
ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) {
13581342
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();
1359-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) {
1343+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
13601344
throw new IllegalArgumentException(
1361-
"excludeDomains parameter is not supported in Gemini API.");
1345+
"blockingConfidence parameter is not supported in Gemini API.");
13621346
}
13631347

1364-
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
1348+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) {
13651349
throw new IllegalArgumentException(
1366-
"blockingConfidence parameter is not supported in Gemini API.");
1350+
"excludeDomains parameter is not supported in Gemini API.");
13671351
}
13681352

13691353
if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) {
@@ -1404,6 +1388,16 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
14041388
"outputCompressionQuality parameter is not supported in Gemini API.");
14051389
}
14061390

1391+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"imageOutputOptions"}))) {
1392+
throw new IllegalArgumentException(
1393+
"imageOutputOptions parameter is not supported in Gemini API.");
1394+
}
1395+
1396+
if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"personGeneration"}))) {
1397+
throw new IllegalArgumentException(
1398+
"personGeneration parameter is not supported in Gemini API.");
1399+
}
1400+
14071401
return toObject;
14081402
}
14091403

@@ -1663,10 +1657,7 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
16631657
Common.setValueByPath(
16641658
toObject,
16651659
new String[] {"functionCall"},
1666-
functionCallToMldev(
1667-
JsonSerializable.toJsonNode(
1668-
Common.getValueByPath(fromObject, new String[] {"functionCall"})),
1669-
toObject));
1660+
Common.getValueByPath(fromObject, new String[] {"functionCall"}));
16701661
}
16711662

16721663
if (Common.getValueByPath(fromObject, new String[] {"functionResponse"}) != null) {
@@ -1714,6 +1705,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
17141705
Common.getValueByPath(fromObject, new String[] {"videoMetadata"}));
17151706
}
17161707

1708+
if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) {
1709+
Common.setValueByPath(
1710+
toObject,
1711+
new String[] {"partMetadata"},
1712+
Common.getValueByPath(fromObject, new String[] {"partMetadata"}));
1713+
}
1714+
17171715
return toObject;
17181716
}
17191717

@@ -1741,29 +1739,6 @@ ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) {
17411739
return toObject;
17421740
}
17431741

1744-
@ExcludeFromGeneratedCoverageReport
1745-
ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
1746-
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();
1747-
if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) {
1748-
Common.setValueByPath(
1749-
toObject,
1750-
new String[] {"functionCallingConfig"},
1751-
functionCallingConfigToMldev(
1752-
JsonSerializable.toJsonNode(
1753-
Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})),
1754-
toObject));
1755-
}
1756-
1757-
if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) {
1758-
Common.setValueByPath(
1759-
toObject,
1760-
new String[] {"retrievalConfig"},
1761-
Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}));
1762-
}
1763-
1764-
return toObject;
1765-
}
1766-
17671742
@ExcludeFromGeneratedCoverageReport
17681743
ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
17691744
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();
@@ -1799,6 +1774,16 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
17991774
Common.getValueByPath(fromObject, new String[] {"fileSearch"}));
18001775
}
18011776

1777+
if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) {
1778+
Common.setValueByPath(
1779+
toObject,
1780+
new String[] {"googleMaps"},
1781+
googleMapsToMldev(
1782+
JsonSerializable.toJsonNode(
1783+
Common.getValueByPath(fromObject, new String[] {"googleMaps"})),
1784+
toObject));
1785+
}
1786+
18021787
if (Common.getValueByPath(fromObject, new String[] {"codeExecution"}) != null) {
18031788
Common.setValueByPath(
18041789
toObject,
@@ -1811,16 +1796,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
18111796
"enterpriseWebSearch parameter is not supported in Gemini API.");
18121797
}
18131798

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-
18241799
if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) {
18251800
Common.setValueByPath(
18261801
toObject,

0 commit comments

Comments
 (0)