langchain/docs/extras/integrations/memory
Viktor Zhemchuzhnikov 507e46844e
Extend SQLChatMessageHistory (#9849)
### 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
2023-09-03 15:49:53 -07:00
..
cassandra_chat_message_history.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
dynamodb_chat_message_history.ipynb Extend DynamoDBChatMessageHistory to support composite keys (#9896) 2023-09-03 15:05:16 -07:00
entity_memory_with_sqlite.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
index.mdx mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
momento_chat_message_history.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
mongodb_chat_message_history.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
motorhead_memory_managed.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
motorhead_memory.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
postgres_chat_message_history.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
redis_chat_message_history.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
rockset_chat_message_history.ipynb Integrate Rockset as a chat history store (#8940) 2023-08-08 18:54:07 -07:00
sql_chat_message_history.ipynb Extend SQLChatMessageHistory (#9849) 2023-09-03 15:49:53 -07:00
streamlit_chat_message_history.ipynb Extend the StreamlitChatMessageHistory docs with a fuller example and… (#8774) 2023-08-04 14:27:46 -07:00
xata_chat_message_history.ipynb Pre-release Xata version no longer required (#9915) 2023-08-29 07:21:22 -07:00
zep_memory.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00