Skip to content

Commit

Permalink
fix(vectorstores): incorrect import for mongodb atlas DriverInfo (#14060
Browse files Browse the repository at this point in the history
)

- **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!
  • Loading branch information
whitedogg13 committed Dec 3, 2023
1 parent 03d6b94 commit 99e5ee6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/langchain/langchain/vectorstores/mongodb_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down

0 comments on commit 99e5ee6

Please sign in to comment.