Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

Use MutableJSON instead of JSONB type for metadata

Sarah Woodersb8a82b95695c
diff --git a/memgpt/connectors/db.py b/memgpt/connectors/db.py
index 8ac6ba30d..c22361995 100644
--- a/memgpt/connectors/db.py
+++ b/memgpt/connectors/db.py
@@ -11,7 +11,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from sqlalchemy import Column, BIGINT, String, DateTime
from sqlalchemy.dialects.postgresql import JSONB, UUID
-from sqlalchemy_json import mutable_json_type
+from sqlalchemy_json import mutable_json_type, MutableJson
from sqlalchemy import TypeDecorator, CHAR
import uuid
@@ -78,7 +78,8 @@ def get_db_model(table_name: str, table_type: TableType):
agent_id = Column(String)
data_source = Column(String) # agent_name if agent, data_source name if from data source
embedding = mapped_column(Vector(config.embedding_dim))
- metadata_ = Column(mutable_json_type(dbtype=JSONB, nested=True))
+ # metadata_ = Column(mutable_json_type(dbtype=JSONB, nested=True)) # more performance, but not supported for sqlite
+ metadata_ = Column(MutableJson)
def __repr__(self):
return f"<Passage(passage_id='{self.id}', text='{self.text}', embedding='{self.embedding})>"