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
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
12 changes: 6 additions & 6 deletions src/main/java/com/google/genai/Tunings.java
Original file line number Diff line number Diff line change
Expand Up @@ -1594,18 +1594,18 @@ ObjectNode tuningJobFromVertex(
Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"}));
}

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

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

return toObject;
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/com/google/genai/types/CodeExecutionResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
import com.google.genai.JsonSerializable;
import java.util.Optional;

/**
* Result of executing the `ExecutableCode`.
*
* <p>Generated only when the `CodeExecution` tool is used.
*/
/** Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used. */
@AutoValue
@JsonDeserialize(builder = CodeExecutionResult.Builder.class)
public abstract class CodeExecutionResult extends JsonSerializable {
Expand All @@ -46,8 +42,8 @@ public abstract class CodeExecutionResult extends JsonSerializable {
public abstract Optional<String> output();

/**
* The identifier of the `ExecutableCode` part this result is for. Only populated if the
* corresponding `ExecutableCode` has an id.
* Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the
* corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.
*/
@JsonProperty("id")
public abstract Optional<String> id();
Expand Down Expand Up @@ -130,8 +126,9 @@ public Builder clearOutput() {
/**
* Setter for id.
*
* <p>id: The identifier of the `ExecutableCode` part this result is for. Only populated if the
* corresponding `ExecutableCode` has an id.
* <p>id: Optional. The identifier of the `ExecutableCode` part this result is for. Only
* populated if the corresponding `ExecutableCode` has an id. This field is not supported in
* Vertex AI.
*/
@JsonProperty("id")
public abstract Builder id(String id);
Expand Down
Loading
Loading