From 401ca4424eecfefdbc7468fc5ac8fc675880dd34 Mon Sep 17 00:00:00 2001 From: Liang Wang Date: Thu, 22 Feb 2024 00:53:04 +0000 Subject: [PATCH 1/2] docs: add MySQLChatMessageHistory to readme --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29f0a72..05386cb 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,24 @@ docs = loader.lazy_load() See the full [Document Loader][loader] tutorial. +## Chat Message History Usage + +Use [ChatMessageHistory](https://python.langchain.com/docs/modules/memory/chat_messages/) to store messages and provide conversation history to LLMs. + +```python +from langchain_google_cloud_sql_mysql import MySQLChatMessageHistory, MySQLEngine + + +engine = MySQLEngine.from_instance"project-id", ("region", "my-instance", "my-database") +history = MySQLChatMessageHistory( + engine, + table_name="my-message-store", + session_id="my-session_id" +) +``` + +See the full [Chat Message History][history] tutorial. + ## Contributing Contributions to this library are always welcome and highly encouraged. @@ -74,4 +92,5 @@ This is not an officially supported Google product. [api]: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com [auth]: https://googleapis.dev/python/google-api-core/latest/auth.html [venv]: https://virtualenv.pypa.io/en/latest/ -[loader]: ./docs/document_loader.ipynb \ No newline at end of file +[loader]: ./docs/document_loader.ipynb +[history]: ./docs/chat_message_history.ipynb \ No newline at end of file From 3c697b91796a8034d55cb09f50180dc9522d428d Mon Sep 17 00:00:00 2001 From: Liang Wang Date: Thu, 22 Feb 2024 00:55:47 +0000 Subject: [PATCH 2/2] docs: fix error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05386cb..f1a8b7a 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Use [ChatMessageHistory](https://python.langchain.com/docs/modules/memory/chat_m from langchain_google_cloud_sql_mysql import MySQLChatMessageHistory, MySQLEngine -engine = MySQLEngine.from_instance"project-id", ("region", "my-instance", "my-database") +engine = MySQLEngine.from_instance("project-id", "region", "my-instance", "my-database") history = MySQLChatMessageHistory( engine, table_name="my-message-store",