You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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
1 year ago
..
cassandra_chat_message_history.ipynb mv module integrations docs (#8101) 1 year ago
dynamodb_chat_message_history.ipynb Extend DynamoDBChatMessageHistory to support composite keys (#9896) 1 year ago
entity_memory_with_sqlite.ipynb mv module integrations docs (#8101) 1 year ago
index.mdx mv module integrations docs (#8101) 1 year ago
momento_chat_message_history.ipynb mv module integrations docs (#8101) 1 year ago
mongodb_chat_message_history.ipynb mv module integrations docs (#8101) 1 year ago
motorhead_memory.ipynb mv module integrations docs (#8101) 1 year ago
motorhead_memory_managed.ipynb mv module integrations docs (#8101) 1 year ago
postgres_chat_message_history.ipynb mv module integrations docs (#8101) 1 year ago
redis_chat_message_history.ipynb mv module integrations docs (#8101) 1 year ago
rockset_chat_message_history.ipynb Integrate Rockset as a chat history store (#8940) 1 year ago
sql_chat_message_history.ipynb Extend SQLChatMessageHistory (#9849) 1 year ago
streamlit_chat_message_history.ipynb Extend the StreamlitChatMessageHistory docs with a fuller example and… (#8774) 1 year ago
xata_chat_message_history.ipynb Pre-release Xata version no longer required (#9915) 1 year ago
zep_memory.ipynb mv module integrations docs (#8101) 1 year ago