diff --git a/.evergreen/config.yml b/.evergreen/config.yml index a9bb287..ff3d1a3 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -250,6 +250,25 @@ tasks: - func: "fetch repo" - func: "execute tests" + - name: test-langchain-js-local + tags: [local] + commands: + - func: "fetch repo" + - func: "execute tests" + - command: attach.xunit_results + params: + file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml + + - name: test-langchain-js-remote + tags: [remote] + commands: + - func: "fetch repo" + - func: "setup remote atlas" + - func: "execute tests" + - command: attach.xunit_results + params: + file: src/langchain-js/langchainjs/libs/langchain-mongodb/results.xml + buildvariants: - name: test-semantic-kernel-python-rhel display_name: Semantic-Kernel RHEL Python @@ -369,3 +388,13 @@ buildvariants: - ubuntu2204-small tasks: - name: test-langchaingo-local + + - name: test-langchain-js-ubuntu + display_name: LangchainJS Ubuntu2204 + expansions: + DIR: langchain-js + run_on: + - ubuntu2204-small + tasks: + - name: test-langchain-js-local + - name: test-langchain-js-remote diff --git a/.evergreen/setup-remote.sh b/.evergreen/setup-remote.sh index 41237b5..10691d3 100644 --- a/.evergreen/setup-remote.sh +++ b/.evergreen/setup-remote.sh @@ -41,6 +41,9 @@ case $DIR in pymongo-voyageai) MONGODB_URI=$VOYAGEAI_MONGODB_URI ;; + langchain-js) + MONGODB_URI=$LANGCHAIN_MONGODB_URI + ;; *) echo "Missing config in setup-remote.sh for DIR: $DIR" exit 1 diff --git a/README.md b/README.md index f384b81..2f28ce6 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ Test execution flow is defined in `.evergreen/config.yml`. The test pipeline's c - `DIR` -- The subdirectory where the tasks will run -- `run_on` -- Specified platform to run on. `rhel87-small` should be used by default. Any other distro may fail Atlas CLI setup. +- `run_on` -- Specified platform to run on. `rhel87-small` or `ubuntu2204-small` should be used by default. Any other distro may fail Atlas CLI setup. - `tasks` -- Tasks to run. See below for more details - `cron` -- The tests are run via a cron job on a nightly cadence. This can be modified by setting a different cadence. Cron jobs can be scheduled using [cron syntax](https://crontab.guru/#0_0_*_*_*) diff --git a/langchain-js/config.env b/langchain-js/config.env new file mode 100644 index 0000000..fdb4833 --- /dev/null +++ b/langchain-js/config.env @@ -0,0 +1,3 @@ +REPO_NAME=langchainjs +REPO_ORG=langchain-ai +DATABASE=langchain_test_db diff --git a/langchain-js/indexes/langchain_test.json b/langchain-js/indexes/langchain_test.json new file mode 100644 index 0000000..ff9864f --- /dev/null +++ b/langchain-js/indexes/langchain_test.json @@ -0,0 +1,18 @@ +{ + "name": "default", + "type": "search", + "mappings": { + "fields": { + "e": { + "type": "number" + }, + "embedding": { + "dimensions": 1536, + "similarity": "euclidean", + "type": "knnVector" + } + } + }, + "database": "langchain", + "collectionName": "test" +} \ No newline at end of file diff --git a/langchain-js/run.sh b/langchain-js/run.sh new file mode 100644 index 0000000..41d639c --- /dev/null +++ b/langchain-js/run.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -o errexit + +setup_remote_atlas() { + # Get the MONGODB_URI and OPENAI_API_KEY. + SCRIPT_DIR=$(realpath "$(dirname ${BASH_SOURCE[0]})") + ROOT_DIR=$(dirname $SCRIPT_DIR) + + if [[ -f "$ROOT_DIR/env.sh" ]]; then + echo "Sourcing $ROOT_DIR/env.sh" + source $ROOT_DIR/env.sh + fi + + bash "$ROOT_DIR/.evergreen/fetch-secrets.sh" + source secrets-export.sh + + if [[ -n "$MONGODB_URI" ]]; then + export MONGODB_ATLAS_URI=$MONGODB_URI + fi +} + +setup_node_and_yarn() { + # setup node, npm and yarn + PATH=/opt/devtools/node22/bin:$(pwd)/bin:$PATH + npm_config_prefix=$(pwd) + export PATH + export npm_config_prefix + + npm install --global yarn +} + +setup_langchain_integration() { + cd libs/langchain-mongodb + + yarn install + yarn build + + yarn add --dev jest-junit + export JEST_JUNIT_OUTPUT_NAME=results.xml + + # optionally enable to debug local atlas in CI. + # export DEBUG=testcontainers* +} + +setup_remote_atlas +setup_node_and_yarn +setup_langchain_integration + +yarn test:int --reporters=default --reporters=jest-junit