Skip to main content
GcsJsonDb is a class that implements the Db interface using Google Cloud Storage as the backend storage system. Each table is stored as a JSON file in a GCS bucket.

Methods

upsert_sessions

Upsert multiple sessions in one method call. Parameters:
  • sessions (List[Session]): List of sessions to upsert
  • deserialize (Optional[bool]): Whether to deserialize the sessions. Defaults to True
  • preserve_updated_at (bool): Whether to keep the sessions' existing updated_at timestamps. Defaults to False
Returns: List[Union[Session, Dict[str, Any]]]

upsert_memories

Upsert multiple memories in one method call. Parameters:
  • memories (List[UserMemory]): List of memories to upsert
  • deserialize (Optional[bool]): Whether to deserialize the memories. Defaults to True
  • preserve_updated_at (bool): Whether to keep the memories' existing updated_at timestamps. Defaults to False
Returns: List[Union[UserMemory, Dict[str, Any]]]
GcsJsonDb accepts multiple records through the bulk methods but processes each record with an individual upsert. These methods do not reduce GCS read and write operations. In v2.7.2, preserve_updated_at is accepted but ignored, so an upsert replaces the existing timestamp.