memory_collection
Memory Collection Metadata ORM Model
This module defines the MemoryCollection
class, which represents a memory collection and its associated attributes.
Attributes
Classes
MemoryCollection
Bases: Base
Memory collection metadata
Attributes
__table_args__
class-attribute
instance-attribute
__table_args__ = (
Index(
"idx__memory_collection__namespace_pkid__name",
"namespace_pkid",
"name",
),
UniqueConstraint(
"namespace_pkid",
"name",
name="uc__memory_collection__namespace_pkid__name",
),
{"comment": __doc__},
)
agents
class-attribute
instance-attribute
agents: Mapped[List[Agent]] = relationship(
secondary="agent_memory_collection",
back_populates="memory_collections",
)
collection_type
class-attribute
instance-attribute
collection_type: Mapped[MemoryCollectionType] = (
mapped_column(
String(25),
comment="Type of memory collection, episodic or semantic",
)
)
config
class-attribute
instance-attribute
config: Mapped[str] = mapped_column(
JSON,
default={},
nullable=False,
comment="JSON configuration for the vector DB backing the collection",
)
create_ts
class-attribute
instance-attribute
create_ts: Mapped[datetime] = mapped_column(
server_default=now(), comment="Record create timestamp"
)
deleted
class-attribute
instance-attribute
deleted: Mapped[bool] = mapped_column(
default=False,
comment="Memory collection soft delete flag",
)
description
class-attribute
instance-attribute
description: Mapped[str] = mapped_column(
Text,
nullable=False,
default="",
comment="Free-form description of the memory collection",
)
enabled
class-attribute
instance-attribute
enabled: Mapped[bool] = mapped_column(
default=True,
comment="Flag indicating whether the collection is enabled or not",
)
managed
class-attribute
instance-attribute
managed: Mapped[bool] = mapped_column(
default=False,
comment="When true, indicates that this resource is managed by the system and should not be modified by users.",
)
memories
class-attribute
instance-attribute
memories: Mapped[List[Memory]] = relationship(
back_populates="memory_collection", lazy="dynamic"
)
name
class-attribute
instance-attribute
name: Mapped[str] = mapped_column(
String(RESOURCE_NAME_LEN),
unique=False,
comment="Memory collection resource name, typically the same name is used in the Vector index",
)
namespace
class-attribute
instance-attribute
namespace: Mapped[Namespace] = relationship(
back_populates="memory_collections"
)
namespace_pkid
class-attribute
instance-attribute
namespace_pkid: Mapped[str] = mapped_column(
ForeignKey("namespace.pkid"),
comment="Reference to the owning namespace",
)
pkid
class-attribute
instance-attribute
pkid: Mapped[str] = mapped_column(
String(PKID_LEN),
primary_key=True,
default=prefixed_uuid(__tablename__),
comment="Unique memory collection identifier",
)
read_only
class-attribute
instance-attribute
read_only: Mapped[bool] = mapped_column(
default=False,
comment="When set to true the Agent cannot add new memories to the collection",
)
update_ts
class-attribute
instance-attribute
update_ts: Mapped[datetime] = mapped_column(
server_default=now(),
onupdate=current_timestamp(),
comment="Record update timestamp",
)
vectordb_name
class-attribute
instance-attribute
vectordb_name: Mapped[str] = mapped_column(
String(RESOURCE_NAME_LEN),
default="default",
nullable=False,
comment="VectorDB connection name, refers to the corresponding vectordb factory value set in the backend application settings",
)