Skip to content
Merged
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
1 change: 0 additions & 1 deletion src/main/java/com/google/genai/Batches.java
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,6 @@ ObjectNode embedContentBatchToMldev(
@ExcludeFromGeneratedCoverageReport
ObjectNode embedContentConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();

if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) {
Common.setValueByPath(
parentObject,
Expand Down
62 changes: 60 additions & 2 deletions src/main/java/com/google/genai/Caches.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) {
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"outcome"},
Common.getValueByPath(fromObject, new String[] {"outcome"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -444,6 +470,32 @@ ObjectNode deleteCachedContentResponseFromVertex(JsonNode fromObject, ObjectNode
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode executableCodeToVertex(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"code"},
Common.getValueByPath(fromObject, new String[] {"code"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -870,14 +922,20 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) {
Common.setValueByPath(
toObject,
new String[] {"codeExecutionResult"},
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}));
codeExecutionResultToVertex(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})),
toObject));
}

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

if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) {
Expand Down
62 changes: 60 additions & 2 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,32 @@ ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) {
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode codeExecutionResultToVertex(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"outcome"},
Common.getValueByPath(fromObject, new String[] {"outcome"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -167,6 +193,32 @@ ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) {
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode executableCodeToVertex(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"code"},
Common.getValueByPath(fromObject, new String[] {"code"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -1761,14 +1813,20 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) {
Common.setValueByPath(
toObject,
new String[] {"codeExecutionResult"},
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}));
codeExecutionResultToVertex(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})),
toObject));
}

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

if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) {
Expand Down
67 changes: 64 additions & 3 deletions src/main/java/com/google/genai/Models.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,33 @@ ObjectNode citationMetadataFromMldev(
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode codeExecutionResultToVertex(
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"outcome"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"outcome"},
Common.getValueByPath(fromObject, new String[] {"outcome"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode computeTokensParametersToVertex(
ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
Expand Down Expand Up @@ -929,7 +956,6 @@ ObjectNode editImageResponseFromVertex(
ObjectNode embedContentConfigToMldev(
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();

if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) {
Common.setValueByPath(
parentObject,
Expand Down Expand Up @@ -1320,6 +1346,33 @@ ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject, Json
return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode executableCodeToVertex(
JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
if (Common.getValueByPath(fromObject, new String[] {"code"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"code"},
Common.getValueByPath(fromObject, new String[] {"code"}));
}

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

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

return toObject;
}

@ExcludeFromGeneratedCoverageReport
ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) {
ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode();
Expand Down Expand Up @@ -4269,14 +4322,22 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r
Common.setValueByPath(
toObject,
new String[] {"codeExecutionResult"},
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"}));
codeExecutionResultToVertex(
JsonSerializable.toJsonNode(
Common.getValueByPath(fromObject, new String[] {"codeExecutionResult"})),
toObject,
rootObject));
}

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

if (Common.getValueByPath(fromObject, new String[] {"fileData"}) != null) {
Expand Down
Loading
Loading