mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
507e46844e
### Description There is a really nice class for saving chat messages into a database - SQLChatMessageHistory. It leverages SqlAlchemy to be compatible with any supported database (in contrast with PostgresChatMessageHistory, which is basically the same but is limited to Postgres). However, the class is not really customizable in terms of what you can store. I can imagine a lot of use cases, when one will need to save a message date, along with some additional metadata. To solve this, I propose to extract the converting logic from BaseMessage to SQLAlchemy model (and vice versa) into a separate class - message converter. So instead of rewriting the whole SQLChatMessageHistory class, a user will only need to write a custom model and a simple mapping class, and pass its instance as a parameter. I also noticed that there is no documentation on this class, so I added that too, with an example of custom message converter. ### Issue N/A ### Dependencies N/A ### Tag maintainer Not yet ### Twitter handle N/A |
||
---|---|---|
.. | ||
cassandra_chat_message_history.ipynb | ||
dynamodb_chat_message_history.ipynb | ||
entity_memory_with_sqlite.ipynb | ||
index.mdx | ||
momento_chat_message_history.ipynb | ||
mongodb_chat_message_history.ipynb | ||
motorhead_memory_managed.ipynb | ||
motorhead_memory.ipynb | ||
postgres_chat_message_history.ipynb | ||
redis_chat_message_history.ipynb | ||
rockset_chat_message_history.ipynb | ||
sql_chat_message_history.ipynb | ||
streamlit_chat_message_history.ipynb | ||
xata_chat_message_history.ipynb | ||
zep_memory.ipynb |