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
288 changes: 180 additions & 108 deletions src/main/java/com/google/genai/Batches.java

Large diffs are not rendered by default.

276 changes: 145 additions & 131 deletions src/main/java/com/google/genai/Caches.java

Large diffs are not rendered by default.

369 changes: 202 additions & 167 deletions src/main/java/com/google/genai/LiveConverters.java

Large diffs are not rendered by default.

429 changes: 262 additions & 167 deletions src/main/java/com/google/genai/Models.java

Large diffs are not rendered by default.

139 changes: 80 additions & 59 deletions src/main/java/com/google/genai/TokensConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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 @@ -277,18 +291,18 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) {
@ExcludeFromGeneratedCoverageReport
ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) {
Common.setValueByPath(
toObject, new String[] {"id"}, Common.getValueByPath(fromObject, new String[] {"id"}));
}

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

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

if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) {
Common.setValueByPath(
toObject,
Expand Down Expand Up @@ -337,13 +351,6 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) {
@ExcludeFromGeneratedCoverageReport
ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"searchTypes"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"searchTypes"},
Common.getValueByPath(fromObject, new String[] {"searchTypes"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"blockingConfidence"}))) {
throw new IllegalArgumentException(
"blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode,"
Expand All @@ -356,6 +363,13 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) {
+ " in Gemini Developer API mode.");
}

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

if (Common.getValueByPath(fromObject, new String[] {"timeRangeFilter"}) != null) {
Common.setValueByPath(
toObject,
Expand Down Expand Up @@ -586,6 +600,27 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"mediaResolution"}));
}

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

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

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

if (Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}) != null) {
Common.setValueByPath(
toObject,
Expand Down Expand Up @@ -665,20 +700,6 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"videoMetadata"}));
}

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

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

if (Common.getValueByPath(fromObject, new String[] {"partMetadata"}) != null) {
Common.setValueByPath(
toObject,
Expand Down Expand Up @@ -743,30 +764,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
+ " Gemini Developer API mode.");
}

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

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

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

if (Common.getValueByPath(fromObject, new String[] {"googleMaps"}) != null) {
Common.setValueByPath(
toObject,
Expand All @@ -777,26 +774,56 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
toObject));
}

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

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

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enterpriseWebSearch"}))) {
throw new IllegalArgumentException(
"enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform"
+ " mode, not in Gemini Developer API mode.");
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

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

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

if (Common.getValueByPath(fromObject, new String[] {"googleSearchRetrieval"}) != null) {
Common.setValueByPath(
toObject,
Expand All @@ -817,17 +844,11 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"urlContext"}));
}

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
new String[] {"fileSearch"},
Common.getValueByPath(fromObject, new String[] {"fileSearch"}));
}

return toObject;
Expand Down
Loading
Loading