diff --git a/libs/langchain/langchain/vectorstores/mongodb_atlas.py b/libs/langchain/langchain/vectorstores/mongodb_atlas.py index b7caec575fd73..26b0f81374880 100644 --- a/libs/langchain/langchain/vectorstores/mongodb_atlas.py +++ b/libs/langchain/langchain/vectorstores/mongodb_atlas.py @@ -104,7 +104,8 @@ def from_connection_string( 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 "