Skip to content

Commit 562dd91

Browse files
authored
fix(pg): fix postgresql (#212)
* support mem0 as LTM * reset test_long_term_memory.py * add mem0 dependency * support host/base_url configuration of mem0 * support session persistent in postgresql
1 parent 05628ab commit 562dd91

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config.yaml.full

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ database:
105105
database:
106106
charset: utf8
107107
# [optional]
108+
postgresql:
109+
host: # host or ip
110+
user:
111+
password:
112+
database: # database with options sinlardb?sslmode=require&channel_binding=require&options=endpoint%3Dcp-great-pearl-0a074332
113+
# [optional]
108114
redis:
109115
host:
110116
port: 6379 # default Redis port

veadk/memory/short_term_memory_backends/postgresql_backend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from functools import cached_property
1616
from typing import Any
17+
from venv import logger
1718

1819
from google.adk.sessions import (
1920
BaseSessionService,
@@ -33,7 +34,8 @@ class PostgreSqlSTMBackend(BaseShortTermMemoryBackend):
3334
postgresql_config: PostgreSqlConfig = Field(default_factory=PostgreSqlConfig)
3435

3536
def model_post_init(self, context: Any) -> None:
36-
self._db_url = f"postgresql+psycopg2://{self.postgresql_config.user}:{self.postgresql_config.password}@{self.postgresql_config.host}:{self.postgresql_config.port}/{self.postgresql_config.database}"
37+
self._db_url = f"postgresql://{self.postgresql_config.user}:{self.postgresql_config.password}@{self.postgresql_config.host}:{self.postgresql_config.port}/{self.postgresql_config.database}"
38+
logger.debug(self._db_url)
3739

3840
@cached_property
3941
@override

0 commit comments

Comments
 (0)