Skip to content

Commit c5334a8

Browse files
Google APIscopybara-github
authored andcommitted
feat: add expiration for TTL for Memory and Sessions
feat: add direct_memories_source docs: Update comment for allowed values for config models PiperOrigin-RevId: 792354273
1 parent ebf610b commit c5334a8

File tree

5 files changed

+139
-4
lines changed

5 files changed

+139
-4
lines changed

google/cloud/aiplatform/v1beta1/memory_bank.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package google.cloud.aiplatform.v1beta1;
1818

1919
import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
21+
import "google/protobuf/duration.proto";
2122
import "google/protobuf/timestamp.proto";
2223

2324
option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
@@ -37,6 +38,20 @@ message Memory {
3738
singular: "memory"
3839
};
3940

41+
// The expiration of the Memory. If not set, the Memory will not be
42+
// automatically deleted.
43+
oneof expiration {
44+
// Optional. Timestamp of when this resource is considered expired.
45+
// This is *always* provided on output, regardless of what `expiration` was
46+
// sent on input.
47+
google.protobuf.Timestamp expire_time = 13
48+
[(google.api.field_behavior) = OPTIONAL];
49+
50+
// Optional. Input only. The TTL for this resource. The expiration time is
51+
// computed: now + TTL.
52+
google.protobuf.Duration ttl = 14 [(google.api.field_behavior) = OPTIONAL];
53+
}
54+
4055
// Identifier. The resource name of the Memory.
4156
// Format:
4257
// `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`

google/cloud/aiplatform/v1beta1/memory_bank_service.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,21 @@ message GenerateMemoriesRequest {
312312
repeated Event events = 1 [(google.api.field_behavior) = REQUIRED];
313313
}
314314

315+
// Defines a direct source of memories that should be uploaded to Memory Bank
316+
// with consolidation.
317+
message DirectMemoriesSource {
318+
// A direct memory to upload to Memory Bank.
319+
message DirectMemory {
320+
// Required. The fact to consolidate with existing memories.
321+
string fact = 1 [(google.api.field_behavior) = REQUIRED];
322+
}
323+
324+
// Required. The direct memories to upload to Memory Bank. At most 5 direct
325+
// memories are allowed per request.
326+
repeated DirectMemory direct_memories = 1
327+
[(google.api.field_behavior) = REQUIRED];
328+
}
329+
315330
// Source content used to generate memories.
316331
oneof source {
317332
// Defines a Vertex Session as the source content from which to generate
@@ -321,6 +336,11 @@ message GenerateMemoriesRequest {
321336
// Defines a direct source of content as the source content from which to
322337
// generate memories.
323338
DirectContentsSource direct_contents_source = 3;
339+
340+
// Defines a direct source of memories that should be uploaded to Memory
341+
// Bank. This is similar to `CreateMemory`, but it allows for consolidation
342+
// between these new memories and existing memories for the same scope.
343+
DirectMemoriesSource direct_memories_source = 9;
324344
}
325345

326346
// Required. The resource name of the ReasoningEngine to generate memories

google/cloud/aiplatform/v1beta1/reasoning_engine.proto

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
2121
import "google/cloud/aiplatform/v1beta1/encryption_spec.proto";
2222
import "google/cloud/aiplatform/v1beta1/env_var.proto";
23+
import "google/cloud/aiplatform/v1beta1/service_networking.proto";
24+
import "google/protobuf/duration.proto";
2325
import "google/protobuf/struct.proto";
2426
import "google/protobuf/timestamp.proto";
2527

@@ -64,6 +66,34 @@ message ReasoningEngineSpec {
6466
// Service Agent.
6567
repeated SecretEnvVar secret_env = 2
6668
[(google.api.field_behavior) = OPTIONAL];
69+
70+
// Optional. Configuration for PSC-I.
71+
PscInterfaceConfig psc_interface_config = 4
72+
[(google.api.field_behavior) = OPTIONAL];
73+
74+
// Optional. The minimum number of application instances that will be kept
75+
// running at all times. Defaults to 1.
76+
optional int32 min_instances = 5 [(google.api.field_behavior) = OPTIONAL];
77+
78+
// Optional. The maximum number of application instances that can be
79+
// launched to handle increased traffic. Defaults to 100.
80+
optional int32 max_instances = 6 [(google.api.field_behavior) = OPTIONAL];
81+
82+
// Optional. Resource limits for each container. Only 'cpu' and 'memory'
83+
// keys are supported. Defaults to {"cpu": "4", "memory": "4Gi"}.
84+
//
85+
// * The only supported values for CPU are '1', '2', '4', and '8'. For
86+
// more information, go to
87+
// https://cloud.google.com/run/docs/configuring/cpu.
88+
// * For supported 'memory' values and syntax, go to
89+
// https://cloud.google.com/run/docs/configuring/memory-limits
90+
map<string, string> resource_limits = 7
91+
[(google.api.field_behavior) = OPTIONAL];
92+
93+
// Optional. Concurrency for each container and agent server. Recommended
94+
// value: 2 * cpu + 1. Defaults to 9.
95+
optional int32 container_concurrency = 8
96+
[(google.api.field_behavior) = OPTIONAL];
6797
}
6898

6999
// Optional. The service account that the Reasoning Engine artifact runs as.
@@ -144,12 +174,50 @@ message ReasoningEngine {
144174
message ReasoningEngineContextSpec {
145175
// Specification for a Memory Bank.
146176
message MemoryBankConfig {
177+
// Configuration for automatically setting the TTL ("time-to-live") of the
178+
// memories in the Memory Bank.
179+
message TtlConfig {
180+
// Configuration for TTL of the memories in the Memory Bank based on the
181+
// action that created or updated the memory.
182+
message GranularTtlConfig {
183+
// Optional. The TTL duration for memories uploaded via CreateMemory.
184+
google.protobuf.Duration create_ttl = 1
185+
[(google.api.field_behavior) = OPTIONAL];
186+
187+
// Optional. The TTL duration for memories newly generated via
188+
// GenerateMemories
189+
// ([GenerateMemoriesResponse.GeneratedMemory.Action.CREATED][google.cloud.aiplatform.v1beta1.GenerateMemoriesResponse.GeneratedMemory.Action.CREATED]).
190+
google.protobuf.Duration generate_created_ttl = 2
191+
[(google.api.field_behavior) = OPTIONAL];
192+
193+
// Optional. The TTL duration for memories updated via GenerateMemories
194+
// ([GenerateMemoriesResponse.GeneratedMemory.Action.CREATED][google.cloud.aiplatform.v1beta1.GenerateMemoriesResponse.GeneratedMemory.Action.CREATED]).
195+
// In the case of an UPDATE action, the `expire_time` of the existing
196+
// memory will be updated to the new value (now + TTL).
197+
google.protobuf.Duration generate_updated_ttl = 3
198+
[(google.api.field_behavior) = OPTIONAL];
199+
}
200+
201+
// Configuration for automatically setting the TTL of the memories in the
202+
// Memory Bank.
203+
oneof ttl {
204+
// Optional. The default TTL duration of the memories in the Memory
205+
// Bank. This applies to all operations that create or update a memory.
206+
google.protobuf.Duration default_ttl = 1
207+
[(google.api.field_behavior) = OPTIONAL];
208+
209+
// Optional. The granular TTL configuration of the memories in the
210+
// Memory Bank.
211+
GranularTtlConfig granular_ttl_config = 2
212+
[(google.api.field_behavior) = OPTIONAL];
213+
}
214+
}
215+
147216
// Configuration for how to generate memories.
148217
message GenerationConfig {
149218
// Required. The model used to generate memories.
150219
// Format:
151-
// `projects/{project}/locations/{location}/publishers/google/models/{model}`
152-
// or `projects/{project}/locations/{location}/endpoints/{endpoint}`.
220+
// `projects/{project}/locations/{location}/publishers/google/models/{model}`.
153221
string model = 1 [
154222
(google.api.field_behavior) = REQUIRED,
155223
(google.api.resource_reference) = {
@@ -162,8 +230,7 @@ message ReasoningEngineContextSpec {
162230
message SimilaritySearchConfig {
163231
// Required. The model used to generate embeddings to lookup similar
164232
// memories. Format:
165-
// `projects/{project}/locations/{location}/publishers/google/models/{model}`
166-
// or `projects/{project}/locations/{location}/endpoints/{endpoint}`.
233+
// `projects/{project}/locations/{location}/publishers/google/models/{model}`.
167234
string embedding_model = 1 [
168235
(google.api.field_behavior) = REQUIRED,
169236
(google.api.resource_reference) = {
@@ -181,6 +248,12 @@ message ReasoningEngineContextSpec {
181248
// `text-embedding-005`.
182249
SimilaritySearchConfig similarity_search_config = 2
183250
[(google.api.field_behavior) = OPTIONAL];
251+
252+
// Optional. Configuration for automatic TTL ("time-to-live") of the
253+
// memories in the Memory Bank. If not set, TTL will not be applied
254+
// automatically. The TTL can be explicitly set by modifying the
255+
// `expire_time` of each Memory resource.
256+
TtlConfig ttl_config = 5 [(google.api.field_behavior) = OPTIONAL];
184257
}
185258

186259
// Optional. Specification for a Memory Bank, which manages memories for the

google/cloud/aiplatform/v1beta1/session.proto

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package google.cloud.aiplatform.v1beta1;
1919
import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
2121
import "google/cloud/aiplatform/v1beta1/content.proto";
22+
import "google/protobuf/duration.proto";
2223
import "google/protobuf/struct.proto";
2324
import "google/protobuf/timestamp.proto";
2425

@@ -39,6 +40,21 @@ message Session {
3940
singular: "session"
4041
};
4142

43+
// The expiration of the session.
44+
oneof expiration {
45+
// Optional. Timestamp of when this session is considered expired.
46+
// This is *always* provided on output, regardless of what was sent
47+
// on input.
48+
google.protobuf.Timestamp expire_time = 13
49+
[(google.api.field_behavior) = OPTIONAL];
50+
51+
// Optional. Input only. The TTL for this session.
52+
google.protobuf.Duration ttl = 14 [
53+
(google.api.field_behavior) = OPTIONAL,
54+
(google.api.field_behavior) = INPUT_ONLY
55+
];
56+
}
57+
4258
// Identifier. The resource name of the session.
4359
// Format:
4460
// 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.
@@ -136,6 +152,9 @@ message EventMetadata {
136152
// Branch is used when multiple child agents shouldn't see their siblings'
137153
// conversation history.
138154
string branch = 6 [(google.api.field_behavior) = OPTIONAL];
155+
156+
// The custom metadata of the LlmResponse.
157+
google.protobuf.Struct custom_metadata = 7;
139158
}
140159

141160
// Actions are parts of events that are executed by the agent.

google/cloud/aiplatform/v1beta1/session_service.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ message ListEventsRequest {
282282
// [SessionService.ListEvents][google.cloud.aiplatform.v1beta1.SessionService.ListEvents]
283283
// call.
284284
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
285+
286+
// Optional. The standard list filter.
287+
// Supported fields:
288+
// * `timestamp` range (i.e. `timestamp>="2025-01-31T11:30:00-04:00"` where
289+
// the timestamp is in RFC 3339 format)
290+
//
291+
// More detail in [AIP-160](https://google.aip.dev/160).
292+
string filter = 4 [(google.api.field_behavior) = OPTIONAL];
285293
}
286294

287295
// Response message for

0 commit comments

Comments
 (0)