From 99f853474dfe0794e10890b5a5623ba70eeb088f Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Thu, 24 Sep 2026 10:34:37 -0700 Subject: [PATCH] feat: add context field to MemoryConfig PiperOrigin-RevId: 987602465 --- .../google/cloud/agentplatform/Memories.java | 14 ++++++++++++ .../agentplatform/types/MemoryConfig.java | 22 +++++++++++++++++++ .../types/UpdateMemoryConfig.java | 22 +++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/main/java/com/google/cloud/agentplatform/Memories.java b/src/main/java/com/google/cloud/agentplatform/Memories.java index 58680d8..a2b2cef 100644 --- a/src/main/java/com/google/cloud/agentplatform/Memories.java +++ b/src/main/java/com/google/cloud/agentplatform/Memories.java @@ -412,6 +412,13 @@ ObjectNode memoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"memoryId"})); } + if (Common.getValueByPath(fromObject, new String[] {"context"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"context"}, + Common.getValueByPath(fromObject, new String[] {"context"})); + } + return toObject; } @@ -635,6 +642,13 @@ ObjectNode updateMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObje Common.getValueByPath(fromObject, new String[] {"memoryId"})); } + if (Common.getValueByPath(fromObject, new String[] {"context"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"context"}, + Common.getValueByPath(fromObject, new String[] {"context"})); + } + if (Common.getValueByPath(fromObject, new String[] {"updateMask"}) != null) { Common.setValueByPath( parentObject, diff --git a/src/main/java/com/google/cloud/agentplatform/types/MemoryConfig.java b/src/main/java/com/google/cloud/agentplatform/types/MemoryConfig.java index 06c0b61..4b908f9 100644 --- a/src/main/java/com/google/cloud/agentplatform/types/MemoryConfig.java +++ b/src/main/java/com/google/cloud/agentplatform/types/MemoryConfig.java @@ -104,6 +104,10 @@ public abstract class MemoryConfig extends JsonSerializable { @JsonProperty("memoryId") public abstract Optional memoryId(); + /** Optional. Represents the context of the memory. */ + @JsonProperty("context") + public abstract Optional context(); + /** Instantiates a builder for MemoryConfig. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -371,6 +375,24 @@ public Builder clearMemoryId() { return memoryId(Optional.empty()); } + /** + * Setter for context. + * + *

context: Optional. Represents the context of the memory. + */ + @JsonProperty("context") + public abstract Builder context(String context); + + @ExcludeFromGeneratedCoverageReport + abstract Builder context(Optional context); + + /** Clears the value of context field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContext() { + return context(Optional.empty()); + } + public abstract MemoryConfig build(); } diff --git a/src/main/java/com/google/cloud/agentplatform/types/UpdateMemoryConfig.java b/src/main/java/com/google/cloud/agentplatform/types/UpdateMemoryConfig.java index 22d150b..41c9d90 100644 --- a/src/main/java/com/google/cloud/agentplatform/types/UpdateMemoryConfig.java +++ b/src/main/java/com/google/cloud/agentplatform/types/UpdateMemoryConfig.java @@ -104,6 +104,10 @@ public abstract class UpdateMemoryConfig extends JsonSerializable { @JsonProperty("memoryId") public abstract Optional memoryId(); + /** Optional. Represents the context of the memory. */ + @JsonProperty("context") + public abstract Optional context(); + /** * The update mask to apply. For the `FieldMask` definition, see * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. @@ -378,6 +382,24 @@ public Builder clearMemoryId() { return memoryId(Optional.empty()); } + /** + * Setter for context. + * + *

context: Optional. Represents the context of the memory. + */ + @JsonProperty("context") + public abstract Builder context(String context); + + @ExcludeFromGeneratedCoverageReport + abstract Builder context(Optional context); + + /** Clears the value of context field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContext() { + return context(Optional.empty()); + } + /** * Setter for updateMask. *