Skip to content

Commit 95a05f4

Browse files
authored
Merge pull request #7 from mongodb-labs/update-langchain-test
PYTHON-4134: Update LangChain test to run langchain-mongodb partner package rather than community
2 parents 41be07b + f3f890e commit 95a05f4

File tree

8 files changed

+52
-12
lines changed

8 files changed

+52
-12
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ buildvariants:
136136
DIR: langchain-python
137137
REPO_NAME: langchain
138138
CLONE_URL: https://github.com/langchain-ai/langchain.git
139+
DATABASE: langchain_test_db
139140
run_on:
140141
- rhel87-small
141142
tasks:

.evergreen/scaffold_atlas.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ def upload_data(db: Database, filename: Path) -> None:
4141
)
4242
if not isinstance(loaded_collection, list):
4343
loaded_collection = [loaded_collection]
44-
result: InsertManyResult = db[collection_name].insert_many(loaded_collection)
45-
logger.debug("Uploaded results for %s: %s", filename.name, result.inserted_ids)
44+
if loaded_collection:
45+
result: InsertManyResult = db[collection_name].insert_many(loaded_collection)
46+
logger.debug("Uploaded results for %s: %s", filename.name, result.inserted_ids)
47+
else:
48+
logger.debug("Empty collection named %s created", collection_name)
49+
db.create_collection(collection_name)
4650

4751

4852
def walk_collection_directory() -> list[str]:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"fields": [
3+
{
4+
"numDimensions": 1536,
5+
"path": "embedding",
6+
"similarity": "cosine",
7+
"type": "vector"
8+
},
9+
{
10+
"path": "llm_string",
11+
"type": "filter"
12+
}
13+
],
14+
"name": "langchain-test-index-semantic-cache",
15+
"type": "vectorSearch",
16+
"database": "langchain_test_db",
17+
"collectionName": "langchain_test_cache"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"fields": [
3+
{
4+
"numDimensions": 1536,
5+
"path": "embedding",
6+
"similarity": "cosine",
7+
"type": "vector"
8+
},
9+
{
10+
"path": "c",
11+
"type": "filter"
12+
}
13+
],
14+
"name": "langchain-test-index-vectorstores",
15+
"type": "vectorSearch",
16+
"database": "langchain_test_db",
17+
"collectionName": "langchain_test_vectorstores"
18+
}

langchain-python/run.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,17 @@ set -x
77

88
PYTHON_BINARY=$(find_python3)
99

10-
cd libs/langchain
10+
cd libs/partners/mongodb
1111

1212
$PYTHON_BINARY -m venv .
1313
source ./bin/activate
1414

1515
pip install poetry
16-
pip install filelock
17-
pip install msgpack
18-
pip install requests_toolbelt
19-
pip install motor
2016

2117
poetry install --with test
22-
# Workaround provided in https://github.com/langchain-ai/langchain/issues/12237
23-
pip install build pyproject-hooks requests-toolbelt
24-
pip install --upgrade rapidfuzz filelock msgpack
2518

26-
# Current hack to run just the mongo tests
27-
TEST_FILE="tests/unit_tests -- -k mongo" make test
19+
export MONGODB_ATLAS_URI=$($atlas deployments connect $DIR --connectWith connectionString)
20+
21+
make test
22+
23+
make integration_test

0 commit comments

Comments
 (0)