mongodb[patch]: Migrate MongoDBChatMessageHistory (#18590)

## **Description** 
Migrate the `MongoDBChatMessageHistory` to the managed
`langchain-mongodb` partner-package
## **Dependencies**
None
## **Twitter handle**
@mongodb

## **tests and docs**
- [x] Migrate existing integration test
- [x ]~ Convert existing integration test to a unit test~ Creation is
out of scope for this ticket
- [x ] ~Considering delaying work until #17470 merges to leverage the
`MockCollection` object. ~
- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Jib
2024-03-05 13:53:02 -05:00
committed by GitHub
parent f92f7d2e03
commit 9da1e0cf34
8 changed files with 858 additions and 8 deletions

View File

@@ -21,10 +21,10 @@
"source": [
"## Setup\n",
"\n",
"The integration lives in the `langchain-community` package, so we need to install that. We also need to install the `pymongo` package.\n",
"The integration lives in the `langchain-mongodb` package, so we need to install that.\n",
"\n",
"```bash\n",
"pip install -U --quiet langchain-community pymongo\n",
"pip install -U --quiet langchain-mongodb\n",
"```"
]
},
@@ -80,7 +80,7 @@
},
"outputs": [],
"source": [
"from langchain_community.chat_message_histories import MongoDBChatMessageHistory\n",
"from langchain_mongodb.chat_message_histories import MongoDBChatMessageHistory\n",
"\n",
"chat_message_history = MongoDBChatMessageHistory(\n",
" session_id=\"test_session\",\n",