From 99e5ee6a848413ba79f1415d0f30834b7133d2f2 Mon Sep 17 00:00:00 2001 From: Richie Date: Mon, 4 Dec 2023 02:22:13 +0800 Subject: [PATCH] fix(vectorstores): incorrect import for mongodb atlas DriverInfo (#14060) - **Description:** fix `import` issue for `mongodb atlas` vectore store integration - **Issue:** none - **Dependencies:** none while trying to follow official `langchain`'s [mongodb integration guide](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas), an import error will happen. It's caused by incorrect import location: - `from pymongo import DriverInfo` should be `from pymongo.driver_info import DriverInfo` - reference: [pymongo's DriverInfo class](https://pymongo.readthedocs.io/en/stable/api/pymongo/driver_info.html#pymongo.driver_info.DriverInfo) Thanks! --- libs/langchain/langchain/vectorstores/mongodb_atlas.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/langchain/langchain/vectorstores/mongodb_atlas.py b/libs/langchain/langchain/vectorstores/mongodb_atlas.py index 3d33d301544..1c8d7dce14f 100644 --- a/libs/langchain/langchain/vectorstores/mongodb_atlas.py +++ b/libs/langchain/langchain/vectorstores/mongodb_atlas.py @@ -104,7 +104,8 @@ class MongoDBAtlasVectorSearch(VectorStore): try: from importlib.metadata import version - from pymongo import DriverInfo, MongoClient + from pymongo import MongoClient + from pymongo.driver_info import DriverInfo except ImportError: raise ImportError( "Could not import pymongo, please install it with "