Skip to content

PYTHON-4679 Fixes all Langchain Tests #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ buildvariants:
display_name: Langchain RHEL Python
expansions:
DIR: langchain-python
REPO_NAME: langchain
CLONE_URL: https://github.com/langchain-ai/langchain.git
REPO_NAME: langchain # TODO [PYTHON-4679] Merge change in this branch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add your LangChain PR to the JIRA ticket?

CLONE_URL: -b ci-on-local-atlas --single-branch https://github.com/caseyclements/langchain.git
DATABASE: langchain_test_db
run_on:
- rhel87-small
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ mongo-c-driver-*
# Benchmark and test output files
results/*
xunit-results/

# Miscellaneous
.DS_Store

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions langchain-python/database/langchain_test_from_texts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions langchain-python/database/langchain_test_retrievers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"fields": [
{
"numDimensions": 1536,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
}
],
"name": "langchain-test-chain-example-vector-index",
"type": "vectorSearch",
"database": "langchain_test_db",
"collectionName": "langchain_test_chain_example"
}
14 changes: 14 additions & 0 deletions langchain-python/indexes/langchain_test_from_documents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"fields": [
{
"numDimensions": 5,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
}
],
"name": "langchain-test-index-from-documents",
"type": "vectorSearch",
"database": "langchain_test_db",
"collectionName": "langchain_test_from_documents"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fields": [
{
"numDimensions": 1536,
"numDimensions": 5,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"mappings": {
"dynamic": false,
"fields": {
"text": [
{
"type": "string"
}
]
}
},
"name": "text_index",
"type": "search",
"database": "langchain_test_db",
"collectionName": "langchain_test_retrievers"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"fields": [
{
"numDimensions": 1536,
"path": "embedding",
"similarity": "dotProduct",
"type": "vector"
},
{
"path": "c",
"type": "filter"
}
],
"name": "vector_index",
"type": "vectorSearch",
"database": "langchain_test_db",
"collectionName": "langchain_test_retrievers"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"fields": [
{
"numDimensions": 5,
Copy link
Collaborator

@Jibola Jibola Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some tests now have 5 dimensions whilst others have 1536. Any hesitation to making them all use 5?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ones that use 5 are that way because we're not testing the quality of the search. If not, anything to make it faster.

"path": "embedding",
"similarity": "dotProduct",
"type": "vector"
},
{
"path": "c",
"type": "filter"
}
],
"name": "langchain-test-index-from-texts",
"type": "vectorSearch",
"database": "langchain_test_db",
"collectionName": "langchain_test_from_texts"
}
9 changes: 6 additions & 3 deletions langchain-python/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ PYTHON_BINARY=$(find_python3)

cd libs/partners/mongodb

$PYTHON_BINARY -m venv .
source ./bin/activate
$PYTHON_BINARY -m venv venv_pipeline
source venv_pipeline/bin/activate

pip install poetry

poetry install --with test
poetry lock --no-update

poetry install --with test --with test_integration

export MONGODB_ATLAS_URI=$(fetch_local_atlas_uri)
export OPENAI_API_KEY=$openai_api_key

make test

Expand Down