From 25f2e25be12c631514c6071b8ea86d3bfb793e79 Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Thu, 8 Aug 2024 18:38:31 -0400 Subject: [PATCH] partners[patch]: Mongodb Retrievers - CI final touches. (#25202) ## Description Contains 2 updates to for integration tests to run on langchain's CI. Addendum to #25057 to get release github action to succeed. --- .../mongodb/tests/integration_tests/test_chain_example.py | 2 +- .../mongodb/tests/integration_tests/test_index.py | 8 ++++++-- .../mongodb/tests/integration_tests/test_retrievers.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/partners/mongodb/tests/integration_tests/test_chain_example.py b/libs/partners/mongodb/tests/integration_tests/test_chain_example.py index c5c33c537d6..861a398cc8d 100644 --- a/libs/partners/mongodb/tests/integration_tests/test_chain_example.py +++ b/libs/partners/mongodb/tests/integration_tests/test_chain_example.py @@ -20,7 +20,7 @@ from ..utils import PatchedMongoDBAtlasVectorSearch CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI") DB_NAME = "langchain_test_db" COLLECTION_NAME = "langchain_test_chain_example" -INDEX_NAME = "vector_index_with_filter" +INDEX_NAME = "vector_index" DIMENSIONS = 1536 TIMEOUT = 60.0 INTERVAL = 0.5 diff --git a/libs/partners/mongodb/tests/integration_tests/test_index.py b/libs/partners/mongodb/tests/integration_tests/test_index.py index bc06fd4e3e1..000cbed484d 100644 --- a/libs/partners/mongodb/tests/integration_tests/test_index.py +++ b/libs/partners/mongodb/tests/integration_tests/test_index.py @@ -9,6 +9,10 @@ from pymongo.collection import Collection from langchain_mongodb import index +DB_NAME = "langchain_test_index_db" +COLLECTION_NAME = "test_index" +VECTOR_INDEX_NAME = "vector_index" + TIMEOUT = 120 DIMENSIONS = 10 @@ -18,14 +22,14 @@ def collection() -> Generator: """Depending on uri, this could point to any type of cluster.""" uri = os.environ.get("MONGODB_ATLAS_URI") client: MongoClient = MongoClient(uri) - clxn = client["db"]["collection"] + clxn = client[DB_NAME][COLLECTION_NAME] clxn.insert_one({"foo": "bar"}) yield clxn clxn.drop() def test_search_index_commands(collection: Collection) -> None: - index_name = "vector_index" + index_name = VECTOR_INDEX_NAME dimensions = DIMENSIONS path = "embedding" similarity = "cosine" diff --git a/libs/partners/mongodb/tests/integration_tests/test_retrievers.py b/libs/partners/mongodb/tests/integration_tests/test_retrievers.py index 8723396f974..8a0cf34c85c 100644 --- a/libs/partners/mongodb/tests/integration_tests/test_retrievers.py +++ b/libs/partners/mongodb/tests/integration_tests/test_retrievers.py @@ -18,7 +18,7 @@ from ..utils import ConsistentFakeEmbeddings, PatchedMongoDBAtlasVectorSearch CONNECTION_STRING = os.environ.get("MONGODB_ATLAS_URI") DB_NAME = "langchain_test_db" -COLLECTION_NAME = "test_retrievers" +COLLECTION_NAME = "langchain_test_retrievers" VECTOR_INDEX_NAME = "vector_index" EMBEDDING_FIELD = "embedding" PAGE_CONTENT_FIELD = "text"