diff --git a/langchain_postgres/chat_message_histories.py b/langchain_postgres/chat_message_histories.py index 85f2aef..c18c70d 100644 --- a/langchain_postgres/chat_message_histories.py +++ b/langchain_postgres/chat_message_histories.py @@ -320,6 +320,7 @@ def get_messages(self) -> List[BaseMessage]: with self._connection.cursor() as cursor: cursor.execute(query, {"session_id": self._session_id}) items = [record[0] for record in cursor.fetchall()] + self._connection.commit() messages = messages_from_dict(items) return messages @@ -336,6 +337,7 @@ async def aget_messages(self) -> List[BaseMessage]: async with self._aconnection.cursor() as cursor: await cursor.execute(query, {"session_id": self._session_id}) items = [record[0] for record in await cursor.fetchall()] + await self._aconnection.commit() messages = messages_from_dict(items) return messages