Skip to content

The agent engineering platform.

docs: update imports of `memory` to use `langchain_community` (#18689)

Leonid Ganeline48eed8693160
diff --git a/docs/docs/integrations/memory/astradb_chat_message_history.ipynb b/docs/docs/integrations/memory/astradb_chat_message_history.ipynb
index 068b804f00..eb385ff392 100644
--- a/docs/docs/integrations/memory/astradb_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/astradb_chat_message_history.ipynb
@@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import AstraDBChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import AstraDBChatMessageHistory\n",
"\n",
"message_history = AstraDBChatMessageHistory(\n",
" session_id=\"test-session\",\n",
diff --git a/docs/docs/integrations/memory/aws_dynamodb.ipynb b/docs/docs/integrations/memory/aws_dynamodb.ipynb
index 9410bbe024..f55920b172 100644
--- a/docs/docs/integrations/memory/aws_dynamodb.ipynb
+++ b/docs/docs/integrations/memory/aws_dynamodb.ipynb
@@ -45,6 +45,18 @@
"# os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass()"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0c68f434-0ccf-49a4-8313-e9f6064086a8",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from langchain_community.chat_message_histories import (\n",
+ " DynamoDBChatMessageHistory,\n",
+ ")"
+ ]
+ },
{
"cell_type": "markdown",
"id": "030d784f",
@@ -105,8 +117,6 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import DynamoDBChatMessageHistory\n",
- "\n",
"history = DynamoDBChatMessageHistory(table_name=\"SessionTable\", session_id=\"0\")\n",
"\n",
"history.add_user_message(\"hi!\")\n",
@@ -152,8 +162,6 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import DynamoDBChatMessageHistory\n",
- "\n",
"history = DynamoDBChatMessageHistory(\n",
" table_name=\"SessionTable\",\n",
" session_id=\"0\",\n",
@@ -184,6 +192,7 @@
"execution_count": 14,
"id": "088c037c",
"metadata": {
+ "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
@@ -198,8 +207,6 @@
}
],
"source": [
- "from langchain_community.chat_message_histories import DynamoDBChatMessageHistory\n",
- "\n",
"composite_table = dynamodb.create_table(\n",
" TableName=\"CompositeTable\",\n",
" KeySchema=[\n",
@@ -384,7 +391,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/cassandra_chat_message_history.ipynb b/docs/docs/integrations/memory/cassandra_chat_message_history.ipynb
index 64ead129f5..8f7e7bd600 100644
--- a/docs/docs/integrations/memory/cassandra_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/cassandra_chat_message_history.ipynb
@@ -123,7 +123,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import CassandraChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " CassandraChatMessageHistory,\n",
+ ")\n",
"\n",
"message_history = CassandraChatMessageHistory(\n",
" session_id=\"test-session\",\n",
@@ -181,7 +183,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.17"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb b/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb
index d9073c25b3..4894bccdb7 100644
--- a/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/elasticsearch_chat_message_history.ipynb
@@ -116,7 +116,9 @@
"source": [
"import os\n",
"\n",
- "from langchain.memory import ElasticsearchChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " ElasticsearchChatMessageHistory,\n",
+ ")\n",
"\n",
"es_url = os.environ.get(\"ES_URL\", \"http://localhost:9200\")\n",
"\n",
diff --git a/docs/docs/integrations/memory/google_alloydb.ipynb b/docs/docs/integrations/memory/google_alloydb.ipynb
index 772fa68f66..3e52e545ef 100644
--- a/docs/docs/integrations/memory/google_alloydb.ipynb
+++ b/docs/docs/integrations/memory/google_alloydb.ipynb
@@ -374,7 +374,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.5"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/momento_chat_message_history.ipynb b/docs/docs/integrations/memory/momento_chat_message_history.ipynb
index 362ccf8d78..79391395f4 100644
--- a/docs/docs/integrations/memory/momento_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/momento_chat_message_history.ipynb
@@ -27,7 +27,7 @@
"source": [
"from datetime import timedelta\n",
"\n",
- "from langchain.memory import MomentoChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import MomentoChatMessageHistory\n",
"\n",
"session_id = \"foo\"\n",
"cache_name = \"langchain\"\n",
diff --git a/docs/docs/integrations/memory/motorhead_memory.ipynb b/docs/docs/integrations/memory/motorhead_memory.ipynb
index e8c3ee989d..ae56d38fef 100644
--- a/docs/docs/integrations/memory/motorhead_memory.ipynb
+++ b/docs/docs/integrations/memory/motorhead_memory.ipynb
@@ -202,9 +202,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.1"
+ "version": "3.10.12"
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/docs/docs/integrations/memory/neo4j_chat_message_history.ipynb b/docs/docs/integrations/memory/neo4j_chat_message_history.ipynb
index f31915bb74..d9dc80020c 100644
--- a/docs/docs/integrations/memory/neo4j_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/neo4j_chat_message_history.ipynb
@@ -19,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import Neo4jChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import Neo4jChatMessageHistory\n",
"\n",
"history = Neo4jChatMessageHistory(\n",
" url=\"bolt://localhost:7687\",\n",
@@ -68,7 +68,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.8"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/postgres_chat_message_history.ipynb b/docs/docs/integrations/memory/postgres_chat_message_history.ipynb
index c697817d1c..5e8c29c8de 100644
--- a/docs/docs/integrations/memory/postgres_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/postgres_chat_message_history.ipynb
@@ -19,7 +19,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import PostgresChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " PostgresChatMessageHistory,\n",
+ ")\n",
"\n",
"history = PostgresChatMessageHistory(\n",
" connection_string=\"postgresql://postgres:mypassword@localhost/chat_history\",\n",
diff --git a/docs/docs/integrations/memory/redis_chat_message_history.ipynb b/docs/docs/integrations/memory/redis_chat_message_history.ipynb
index 3e79998e72..760cdc0d09 100644
--- a/docs/docs/integrations/memory/redis_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/redis_chat_message_history.ipynb
@@ -31,6 +31,16 @@
"pip install -U langchain-community redis"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b11090e7-284b-4ed2-9790-ce0d35638717",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from langchain_community.chat_message_histories import RedisChatMessageHistory"
+ ]
+ },
{
"cell_type": "markdown",
"id": "20b99474-75ea-422e-9809-fbdb9d103afc",
@@ -46,8 +56,6 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import RedisChatMessageHistory\n",
- "\n",
"history = RedisChatMessageHistory(\"foo\", url=\"redis://localhost:6379\")\n",
"\n",
"history.add_user_message(\"hi!\")\n",
@@ -103,7 +111,6 @@
"source": [
"from typing import Optional\n",
"\n",
- "from langchain_community.chat_message_histories import RedisChatMessageHistory\n",
"from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
"from langchain_core.runnables.history import RunnableWithMessageHistory\n",
"from langchain_openai import ChatOpenAI"
@@ -178,7 +185,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.18"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/rockset_chat_message_history.ipynb b/docs/docs/integrations/memory/rockset_chat_message_history.ipynb
index d5bef0e22a..0a24253dec 100644
--- a/docs/docs/integrations/memory/rockset_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/rockset_chat_message_history.ipynb
@@ -52,7 +52,9 @@
},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import RocksetChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " RocksetChatMessageHistory,\n",
+ ")\n",
"from rockset import Regions, RocksetClient\n",
"\n",
"history = RocksetChatMessageHistory(\n",
diff --git a/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb b/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb
index 852733fa56..4c3a498b44 100644
--- a/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/singlestoredb_chat_message_history.ipynb
@@ -18,7 +18,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import SingleStoreDBChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " SingleStoreDBChatMessageHistory,\n",
+ ")\n",
"\n",
"history = SingleStoreDBChatMessageHistory(\n",
" session_id=\"foo\", host=\"root:pass@localhost:3306/db\"\n",
@@ -56,9 +58,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.2"
+ "version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/integrations/memory/sql_chat_message_history.ipynb b/docs/docs/integrations/memory/sql_chat_message_history.ipynb
index e8cca61262..869b9eeb06 100644
--- a/docs/docs/integrations/memory/sql_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/sql_chat_message_history.ipynb
@@ -71,7 +71,10 @@
"end_time": "2023-08-28T10:04:38.077748Z",
"start_time": "2023-08-28T10:04:36.105894Z"
},
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -94,7 +97,10 @@
"end_time": "2023-08-28T10:04:38.929396Z",
"start_time": "2023-08-28T10:04:38.915727Z"
},
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [
{
@@ -241,7 +247,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.1"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/docs/docs/integrations/memory/streamlit_chat_message_history.ipynb b/docs/docs/integrations/memory/streamlit_chat_message_history.ipynb
index 987d6aeccc..da4e55b44e 100644
--- a/docs/docs/integrations/memory/streamlit_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/streamlit_chat_message_history.ipynb
@@ -36,7 +36,9 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import StreamlitChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import (\n",
+ " StreamlitChatMessageHistory,\n",
+ ")\n",
"\n",
"history = StreamlitChatMessageHistory(key=\"chat_messages\")\n",
"\n",
@@ -71,8 +73,6 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories import StreamlitChatMessageHistory\n",
- "\n",
"# Optionally, specify your own session_state key for storing messages\n",
"msgs = StreamlitChatMessageHistory(key=\"special_app_key\")\n",
"\n",
diff --git a/docs/docs/integrations/memory/tidb_chat_message_history.ipynb b/docs/docs/integrations/memory/tidb_chat_message_history.ipynb
index 070f25507e..5e8ad467cd 100644
--- a/docs/docs/integrations/memory/tidb_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/tidb_chat_message_history.ipynb
@@ -244,7 +244,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "langchain",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -258,9 +258,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.13"
+ "version": "3.10.12"
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb b/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb
index 4c6c4705d2..2b79ea20a3 100644
--- a/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/upstash_redis_chat_message_history.ipynb
@@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.chat_message_histories.upstash_redis import (\n",
+ "from langchain_community.chat_message_histories import (\n",
" UpstashRedisChatMessageHistory,\n",
")\n",
"\n",
diff --git a/docs/docs/integrations/memory/xata_chat_message_history.ipynb b/docs/docs/integrations/memory/xata_chat_message_history.ipynb
index 47d21506a9..3c55b84d6f 100644
--- a/docs/docs/integrations/memory/xata_chat_message_history.ipynb
+++ b/docs/docs/integrations/memory/xata_chat_message_history.ipynb
@@ -75,7 +75,7 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.memory import XataChatMessageHistory\n",
+ "from langchain_community.chat_message_histories import XataChatMessageHistory\n",
"\n",
"history = XataChatMessageHistory(\n",
" session_id=\"session-1\", api_key=api_key, db_url=db_url, table_name=\"memory\"\n",
@@ -154,7 +154,7 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_community.vectorstores.xata import XataVectorStore\n",
+ "from langchain_community.vectorstores import XataVectorStore\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"embeddings = OpenAIEmbeddings()\n",
diff --git a/docs/docs/integrations/memory/zep_memory.ipynb b/docs/docs/integrations/memory/zep_memory.ipynb
index 86379dd785..a9e7a29a9b 100644
--- a/docs/docs/integrations/memory/zep_memory.ipynb
+++ b/docs/docs/integrations/memory/zep_memory.ipynb
@@ -419,7 +419,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.6"
+ "version": "3.10.12"
}
},
"nbformat": 4,