Skip to content

Commit 88884d7

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: GenAI SDK client(memory): Add enable_third_person_memories
PiperOrigin-RevId: 852836887
1 parent cffa558 commit 88884d7

File tree

3 files changed

+118
-110
lines changed

3 files changed

+118
-110
lines changed

tests/unit/vertexai/genai/replays/test_create_agent_engine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def test_create_with_context_spec(client):
8383
],
8484
}
8585
],
86+
"enable_third_person_memories": True,
8687
}
8788
memory_bank_customization_config = types.MemoryBankCustomizationConfig(
8889
**customization_config

vertexai/_genai/types/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,15 +1385,6 @@
13851385
"ReasoningEngineSpec",
13861386
"ReasoningEngineSpecDict",
13871387
"ReasoningEngineSpecOrDict",
1388-
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic",
1389-
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict",
1390-
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicOrDict",
1391-
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic",
1392-
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict",
1393-
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicOrDict",
1394-
"MemoryBankCustomizationConfigMemoryTopic",
1395-
"MemoryBankCustomizationConfigMemoryTopicDict",
1396-
"MemoryBankCustomizationConfigMemoryTopicOrDict",
13971388
"MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent",
13981389
"MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEventDict",
13991390
"MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEventOrDict",
@@ -1409,6 +1400,15 @@
14091400
"MemoryBankCustomizationConfigGenerateMemoriesExample",
14101401
"MemoryBankCustomizationConfigGenerateMemoriesExampleDict",
14111402
"MemoryBankCustomizationConfigGenerateMemoriesExampleOrDict",
1403+
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic",
1404+
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict",
1405+
"MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicOrDict",
1406+
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic",
1407+
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict",
1408+
"MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicOrDict",
1409+
"MemoryBankCustomizationConfigMemoryTopic",
1410+
"MemoryBankCustomizationConfigMemoryTopicDict",
1411+
"MemoryBankCustomizationConfigMemoryTopicOrDict",
14121412
"MemoryBankCustomizationConfig",
14131413
"MemoryBankCustomizationConfigDict",
14141414
"MemoryBankCustomizationConfigOrDict",

vertexai/_genai/types/common.py

Lines changed: 108 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class AgentServerMode(_common.CaseInSensitiveEnum):
229229

230230

231231
class ManagedTopicEnum(_common.CaseInSensitiveEnum):
232-
"""The managed topic."""
232+
"""The managed memory topic."""
233233

234234
MANAGED_TOPIC_ENUM_UNSPECIFIED = "MANAGED_TOPIC_ENUM_UNSPECIFIED"
235235
"""Unspecified topic. This value should not be used."""
@@ -5000,94 +5000,6 @@ class ReasoningEngineSpecDict(TypedDict, total=False):
50005000
ReasoningEngineSpecOrDict = Union[ReasoningEngineSpec, ReasoningEngineSpecDict]
50015001

50025002

5003-
class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic(_common.BaseModel):
5004-
"""A custom memory topic defined by the developer."""
5005-
5006-
label: Optional[str] = Field(
5007-
default=None, description="""Required. The label of the topic."""
5008-
)
5009-
description: Optional[str] = Field(
5010-
default=None,
5011-
description="""Required. Description of the memory topic. This should explain what information should be extracted for this topic.""",
5012-
)
5013-
5014-
5015-
class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict(
5016-
TypedDict, total=False
5017-
):
5018-
"""A custom memory topic defined by the developer."""
5019-
5020-
label: Optional[str]
5021-
"""Required. The label of the topic."""
5022-
5023-
description: Optional[str]
5024-
"""Required. Description of the memory topic. This should explain what information should be extracted for this topic."""
5025-
5026-
5027-
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicOrDict = Union[
5028-
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic,
5029-
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict,
5030-
]
5031-
5032-
5033-
class MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic(_common.BaseModel):
5034-
"""A managed memory topic defined by the system."""
5035-
5036-
managed_topic_enum: Optional[ManagedTopicEnum] = Field(
5037-
default=None, description="""Required. The managed topic."""
5038-
)
5039-
5040-
5041-
class MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict(
5042-
TypedDict, total=False
5043-
):
5044-
"""A managed memory topic defined by the system."""
5045-
5046-
managed_topic_enum: Optional[ManagedTopicEnum]
5047-
"""Required. The managed topic."""
5048-
5049-
5050-
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicOrDict = Union[
5051-
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic,
5052-
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict,
5053-
]
5054-
5055-
5056-
class MemoryBankCustomizationConfigMemoryTopic(_common.BaseModel):
5057-
"""A topic of information that should be extracted from conversations and stored as memories."""
5058-
5059-
custom_memory_topic: Optional[
5060-
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic
5061-
] = Field(
5062-
default=None, description="""A custom memory topic defined by the developer."""
5063-
)
5064-
managed_memory_topic: Optional[
5065-
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic
5066-
] = Field(
5067-
default=None, description="""A managed memory topic defined by Memory Bank."""
5068-
)
5069-
5070-
5071-
class MemoryBankCustomizationConfigMemoryTopicDict(TypedDict, total=False):
5072-
"""A topic of information that should be extracted from conversations and stored as memories."""
5073-
5074-
custom_memory_topic: Optional[
5075-
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict
5076-
]
5077-
"""A custom memory topic defined by the developer."""
5078-
5079-
managed_memory_topic: Optional[
5080-
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict
5081-
]
5082-
"""A managed memory topic defined by Memory Bank."""
5083-
5084-
5085-
MemoryBankCustomizationConfigMemoryTopicOrDict = Union[
5086-
MemoryBankCustomizationConfigMemoryTopic,
5087-
MemoryBankCustomizationConfigMemoryTopicDict,
5088-
]
5089-
5090-
50915003
class MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent(
50925004
_common.BaseModel
50935005
):
@@ -5239,39 +5151,134 @@ class MemoryBankCustomizationConfigGenerateMemoriesExampleDict(TypedDict, total=
52395151
]
52405152

52415153

5154+
class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic(_common.BaseModel):
5155+
"""A custom memory topic defined by the developer."""
5156+
5157+
label: Optional[str] = Field(
5158+
default=None, description="""Required. The label of the topic."""
5159+
)
5160+
description: Optional[str] = Field(
5161+
default=None,
5162+
description="""Required. Description of the memory topic. This should explain what information should be extracted for this topic.""",
5163+
)
5164+
5165+
5166+
class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict(
5167+
TypedDict, total=False
5168+
):
5169+
"""A custom memory topic defined by the developer."""
5170+
5171+
label: Optional[str]
5172+
"""Required. The label of the topic."""
5173+
5174+
description: Optional[str]
5175+
"""Required. Description of the memory topic. This should explain what information should be extracted for this topic."""
5176+
5177+
5178+
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicOrDict = Union[
5179+
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic,
5180+
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict,
5181+
]
5182+
5183+
5184+
class MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic(_common.BaseModel):
5185+
"""A managed memory topic defined by the system."""
5186+
5187+
managed_topic_enum: Optional[ManagedTopicEnum] = Field(
5188+
default=None, description="""Required. The managed topic."""
5189+
)
5190+
5191+
5192+
class MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict(
5193+
TypedDict, total=False
5194+
):
5195+
"""A managed memory topic defined by the system."""
5196+
5197+
managed_topic_enum: Optional[ManagedTopicEnum]
5198+
"""Required. The managed topic."""
5199+
5200+
5201+
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicOrDict = Union[
5202+
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic,
5203+
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict,
5204+
]
5205+
5206+
5207+
class MemoryBankCustomizationConfigMemoryTopic(_common.BaseModel):
5208+
"""A topic of information that should be extracted from conversations and stored as memories."""
5209+
5210+
custom_memory_topic: Optional[
5211+
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic
5212+
] = Field(
5213+
default=None, description="""A custom memory topic defined by the developer."""
5214+
)
5215+
managed_memory_topic: Optional[
5216+
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic
5217+
] = Field(
5218+
default=None, description="""A managed memory topic defined by Memory Bank."""
5219+
)
5220+
5221+
5222+
class MemoryBankCustomizationConfigMemoryTopicDict(TypedDict, total=False):
5223+
"""A topic of information that should be extracted from conversations and stored as memories."""
5224+
5225+
custom_memory_topic: Optional[
5226+
MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict
5227+
]
5228+
"""A custom memory topic defined by the developer."""
5229+
5230+
managed_memory_topic: Optional[
5231+
MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopicDict
5232+
]
5233+
"""A managed memory topic defined by Memory Bank."""
5234+
5235+
5236+
MemoryBankCustomizationConfigMemoryTopicOrDict = Union[
5237+
MemoryBankCustomizationConfigMemoryTopic,
5238+
MemoryBankCustomizationConfigMemoryTopicDict,
5239+
]
5240+
5241+
52425242
class MemoryBankCustomizationConfig(_common.BaseModel):
52435243
"""Configuration for organizing memories for a particular scope."""
52445244

5245-
scope_keys: Optional[list[str]] = Field(
5245+
generate_memories_examples: Optional[
5246+
list[MemoryBankCustomizationConfigGenerateMemoriesExample]
5247+
] = Field(
52465248
default=None,
5247-
description="""Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank.""",
5249+
description="""Optional. Examples of how to generate memories for a particular scope.""",
52485250
)
52495251
memory_topics: Optional[list[MemoryBankCustomizationConfigMemoryTopic]] = Field(
52505252
default=None,
52515253
description="""Optional. Topics of information that should be extracted from conversations and stored as memories. If not set, then Memory Bank's default topics will be used.""",
52525254
)
5253-
generate_memories_examples: Optional[
5254-
list[MemoryBankCustomizationConfigGenerateMemoriesExample]
5255-
] = Field(
5255+
scope_keys: Optional[list[str]] = Field(
52565256
default=None,
5257-
description="""Optional. Examples of how to generate memories for a particular scope.""",
5257+
description="""Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank.""",
5258+
)
5259+
enable_third_person_memories: Optional[bool] = Field(
5260+
default=None,
5261+
description="""Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")""",
52585262
)
52595263

52605264

52615265
class MemoryBankCustomizationConfigDict(TypedDict, total=False):
52625266
"""Configuration for organizing memories for a particular scope."""
52635267

5264-
scope_keys: Optional[list[str]]
5265-
"""Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank."""
5266-
5267-
memory_topics: Optional[list[MemoryBankCustomizationConfigMemoryTopicDict]]
5268-
"""Optional. Topics of information that should be extracted from conversations and stored as memories. If not set, then Memory Bank's default topics will be used."""
5269-
52705268
generate_memories_examples: Optional[
52715269
list[MemoryBankCustomizationConfigGenerateMemoriesExampleDict]
52725270
]
52735271
"""Optional. Examples of how to generate memories for a particular scope."""
52745272

5273+
memory_topics: Optional[list[MemoryBankCustomizationConfigMemoryTopicDict]]
5274+
"""Optional. Topics of information that should be extracted from conversations and stored as memories. If not set, then Memory Bank's default topics will be used."""
5275+
5276+
scope_keys: Optional[list[str]]
5277+
"""Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank."""
5278+
5279+
enable_third_person_memories: Optional[bool]
5280+
"""Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")"""
5281+
52755282

52765283
MemoryBankCustomizationConfigOrDict = Union[
52775284
MemoryBankCustomizationConfig, MemoryBankCustomizationConfigDict

0 commit comments

Comments
 (0)