-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add MySQLChatMessageHistory class #10
Conversation
# load SQLAlchemy row objects into dicts | ||
items = [json.loads(result[0]) for result in results] | ||
messages = messages_from_dict(items) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totoleon I updated this code from the POC to use messages_from_dict
instead of message_chunk_to_message
.
It now returns the proper HumanMessage
and AIMessage
message objects as the other current integrations do. Let me know what you think 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test it? It was messages_from_dict
copied from the pg PoC code, but it didn't work for some reason, and got fixed after I changed to message_chunk_to_message
.
I didn't dive deep though. It should be fine if you were able to make it work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup the integration test works wonders, the trick was json.loads
to turn the string into a dict.
Adding
MySQLChatMessageHistory
class which allows functionality of a memory store.Follows pattern of other chat message history integrations: https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/chat_message_histories