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
3 changes: 3 additions & 0 deletions vertexai/_genai/memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def _RetrieveAgentEngineMemoriesConfig_to_vertex(
[item for item in getv(from_object, ["filter_groups"])],
)

if getv(from_object, ["memory_types"]) is not None:
setv(parent_object, ["memoryTypes"], getv(from_object, ["memory_types"]))

return to_object


Expand Down
8 changes: 8 additions & 0 deletions vertexai/_genai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,13 @@
from .common import MemoryRevision
from .common import MemoryRevisionDict
from .common import MemoryRevisionOrDict
from .common import MemoryStructuredContent
from .common import MemoryStructuredContentDict
from .common import MemoryStructuredContentOrDict
from .common import MemoryTopicId
from .common import MemoryTopicIdDict
from .common import MemoryTopicIdOrDict
from .common import MemoryType
from .common import Message
from .common import MessageDict
from .common import Metadata
Expand Down Expand Up @@ -1682,6 +1686,9 @@
"AgentEngineMemoryConfig",
"AgentEngineMemoryConfigDict",
"AgentEngineMemoryConfigOrDict",
"MemoryStructuredContent",
"MemoryStructuredContentDict",
"MemoryStructuredContentOrDict",
"Memory",
"MemoryDict",
"MemoryOrDict",
Expand Down Expand Up @@ -2138,6 +2145,7 @@
"ManagedTopicEnum",
"IdentityType",
"AgentServerMode",
"MemoryType",
"Operator",
"Language",
"MachineConfig",
Expand Down
66 changes: 66 additions & 0 deletions vertexai/_genai/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ class AgentServerMode(_common.CaseInSensitiveEnum):
"""Experimental agent server mode. This mode contains experimental features."""


class MemoryType(_common.CaseInSensitiveEnum):
"""The type of the memory."""

MEMORY_TYPE_UNSPECIFIED = "MEMORY_TYPE_UNSPECIFIED"
"""Represents an unspecified memory type. This value should not be used."""
NATURAL_LANGUAGE_COLLECTION = "NATURAL_LANGUAGE_COLLECTION"
"""Indicates belonging to a collection of natural language memories."""
STRUCTURED_PROFILE = "STRUCTURED_PROFILE"
"""Indicates belonging to a structured profile."""


class Operator(_common.CaseInSensitiveEnum):
"""Operator to apply to the filter. If not set, then EQUAL will be used."""

Expand Down Expand Up @@ -8269,6 +8280,34 @@ class _CreateAgentEngineMemoryRequestParametersDict(TypedDict, total=False):
]


class MemoryStructuredContent(_common.BaseModel):
"""Represents the structured value of the memory."""

data: Optional[dict[str, Any]] = Field(
default=None,
description="""Required. Represents the structured value of the memory.""",
)
schema_id: Optional[str] = Field(
default=None,
description="""Required. Represents the schema ID for which this structured memory belongs to.""",
)


class MemoryStructuredContentDict(TypedDict, total=False):
"""Represents the structured value of the memory."""

data: Optional[dict[str, Any]]
"""Required. Represents the structured value of the memory."""

schema_id: Optional[str]
"""Required. Represents the schema ID for which this structured memory belongs to."""


MemoryStructuredContentOrDict = Union[
MemoryStructuredContent, MemoryStructuredContentDict
]


class Memory(_common.BaseModel):
"""A memory."""

Expand Down Expand Up @@ -8329,6 +8368,14 @@ class Memory(_common.BaseModel):
default=None,
description="""Output only. Timestamp when this Memory was most recently updated.""",
)
memory_type: Optional[MemoryType] = Field(
default=None,
description="""Optional. Represents the type of the memory. If not set, the `NATURAL_LANGUAGE_COLLECTION` type is used. If `STRUCTURED_COLLECTION` or `STRUCTURED_PROFILE` is used, then `structured_data` must be provided.""",
)
structured_content: Optional[MemoryStructuredContent] = Field(
default=None,
description="""Optional. Represents the structured content of the memory.""",
)


class MemoryDict(TypedDict, total=False):
Expand Down Expand Up @@ -8379,6 +8426,12 @@ class MemoryDict(TypedDict, total=False):
update_time: Optional[datetime.datetime]
"""Output only. Timestamp when this Memory was most recently updated."""

memory_type: Optional[MemoryType]
"""Optional. Represents the type of the memory. If not set, the `NATURAL_LANGUAGE_COLLECTION` type is used. If `STRUCTURED_COLLECTION` or `STRUCTURED_PROFILE` is used, then `structured_data` must be provided."""

structured_content: Optional[MemoryStructuredContentDict]
"""Optional. Represents the structured content of the memory."""


MemoryOrDict = Union[Memory, MemoryDict]

Expand Down Expand Up @@ -9284,6 +9337,13 @@ class RetrieveAgentEngineMemoriesConfig(_common.BaseModel):
metadata.author = "agent 321"))`.
""",
)
memory_types: Optional[list[MemoryType]] = Field(
default=None,
description="""Specifies the types of memories to retrieve. If this field is empty
or not provided, the request will default to retrieving only memories of
type `NATURAL_LANGUAGE_COLLECTION`. If populated, the request will
retrieve memories matching any of the specified `MemoryType` values.""",
)


class RetrieveAgentEngineMemoriesConfigDict(TypedDict, total=False):
Expand Down Expand Up @@ -9318,6 +9378,12 @@ class RetrieveAgentEngineMemoriesConfigDict(TypedDict, total=False):
metadata.author = "agent 321"))`.
"""

memory_types: Optional[list[MemoryType]]
"""Specifies the types of memories to retrieve. If this field is empty
or not provided, the request will default to retrieving only memories of
type `NATURAL_LANGUAGE_COLLECTION`. If populated, the request will
retrieve memories matching any of the specified `MemoryType` values."""


RetrieveAgentEngineMemoriesConfigOrDict = Union[
RetrieveAgentEngineMemoriesConfig, RetrieveAgentEngineMemoriesConfigDict
Expand Down
Loading