Add Wrapping Library Metadata to MongoDB vector store (#13084)

**Description**
MongoDB drivers are used in various flavors and languages. Making sure
we exercise our due diligence in identifying the "origin" of the library
calls makes it best to understand how our Atlas servers get accessed.
pull/13508/head
Noah Stapp 10 months ago committed by GitHub
parent 21552628c8
commit c1b041c188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -102,13 +102,18 @@ class MongoDBAtlasVectorSearch(VectorStore):
"""
try:
from pymongo import MongoClient
from importlib.metadata import version
from pymongo import DriverInfo, MongoClient
except ImportError:
raise ImportError(
"Could not import pymongo, please install it with "
"`pip install pymongo`."
)
client: MongoClient = MongoClient(connection_string)
client: MongoClient = MongoClient(
connection_string,
driver=DriverInfo(name="Langchain", version=version("langchain")),
)
db_name, collection_name = namespace.split(".")
collection = client[db_name][collection_name]
return cls(collection, embedding, **kwargs)

Loading…
Cancel
Save