[HumanMessage(content='Hello', additional_kwargs={}, example=False),     AIMessage(content='Hi', additional_kwargs={}, example=False)]Custom Storage Format‚ÄãBy default, only the session id and message dictionary are stored in the table.However, sometimes you might want to store some additional information, like message date, author, language etc.To do that, you can create a custom message converter, by implementing BaseMessageConverter interface.from datetime import datetimefrom langchain.schema import BaseMessage, HumanMessage, AIMessage, SystemMessagefrom typing import Anyfrom sqlalchemy import Column, Integer, Text, DateTimefrom sqlalchemy.orm import declarative_basefrom langchain.memory.chat_message_histories.sql import BaseMessageConverterBase = declarative_base()class CustomMessage(Base):    __tablename__ = 'custom_message_store'    id = Column(Integer, primary_key=True)    session_id = Column(Text)    type = Column(Text)    content = Column(Text)    created_at = Column(DateTime)    author_email = Column(Text)class CustomMessageConverter(BaseMessageConverter):    def __init__(self, author_email: str):        self.author_email = author_email        def from_sql_model(self, sql_message: Any) -> BaseMessage:        if sql_message.type == 'human':            return HumanMessage(                content=sql_message.content,            )        elif sql_message.type == 'ai':            return AIMessage(                content=sql_message.content,            )        elif sql_message.type == 'system':            return SystemMessage(                content=sql_message.content,            )        else:            raise ValueError(f'Unknown message type: {sql_message.type}')        def to_sql_model(self, message: BaseMessage, session_id: str) -> Any:        now = datetime.now()        return CustomMessage(            session_id=session_id,            type=message.type,            content=message.content,            created_at=now,
Structured Query Language (SQL) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data, i.e., data incorporating relations among entities and variables.
Structured Query Language (SQL) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data, i.e., data incorporating relations among entities and variables. ->: [HumanMessage(content='Hello', additional_kwargs={}, example=False),     AIMessage(content='Hi', additional_kwargs={}, example=False)]Custom Storage Format‚ÄãBy default, only the session id and message dictionary are stored in the table.However, sometimes you might want to store some additional information, like message date, author, language etc.To do that, you can create a custom message converter, by implementing BaseMessageConverter interface.from datetime import datetimefrom langchain.schema import BaseMessage, HumanMessage, AIMessage, SystemMessagefrom typing import Anyfrom sqlalchemy import Column, Integer, Text, DateTimefrom sqlalchemy.orm import declarative_basefrom langchain.memory.chat_message_histories.sql import BaseMessageConverterBase = declarative_base()class CustomMessage(Base):    __tablename__ = 'custom_message_store'    id = Column(Integer, primary_key=True)    session_id = Column(Text)    type = Column(Text)    content = Column(Text)    created_at = Column(DateTime)    author_email = Column(Text)class CustomMessageConverter(BaseMessageConverter):    def __init__(self, author_email: str):        self.author_email = author_email        def from_sql_model(self, sql_message: Any) -> BaseMessage:        if sql_message.type == 'human':            return HumanMessage(                content=sql_message.content,            )        elif sql_message.type == 'ai':            return AIMessage(                content=sql_message.content,            )        elif sql_message.type == 'system':            return SystemMessage(                content=sql_message.content,            )        else:            raise ValueError(f'Unknown message type: {sql_message.type}')        def to_sql_model(self, message: BaseMessage, session_id: str) -> Any:        now = datetime.now()        return CustomMessage(            session_id=session_id,            type=message.type,            content=message.content,            created_at=now,