forked from langchain-ai/langchainjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,227 changed files
with
22,094 additions
and
6,782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Dependency compatibility tests | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
# Do not run this workflow if only docs changed. | ||
paths-ignore: | ||
- 'docs/**' | ||
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI | ||
|
||
# If another push to the same PR or branch happens while this workflow is still running, | ||
# cancel the earlier run in favor of the next run. | ||
# | ||
# There's no point in testing an outdated version of the code. GitHub only allows | ||
# a limited number of job runners to be active at the same time, so it's better to cancel | ||
# pointless jobs early so that more useful jobs can run sooner. | ||
concurrency: | ||
group: exports-${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PUPPETEER_SKIP_DOWNLOAD: "true" | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" | ||
NODE_VERSION: "18.x" | ||
|
||
# Run a separate job for each check in the docker-compose file, | ||
# so that they run in parallel instead of overwhelming the default 2 CPU runner. | ||
jobs: | ||
test-langchain-with-latest-deps: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "yarn" | ||
- name: Test LangChain with latest deps | ||
run: docker compose -f dependency_range_tests/docker-compose.yml run test-langchain-with-latest-deps | ||
|
||
test-langchain-with-lowest-deps: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "yarn" | ||
- name: Test LangChain with lowest deps | ||
run: docker compose -f dependency_range_tests/docker-compose.yml run test-langchain-with-lowest-deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3" | ||
services: | ||
test-langchain-with-latest-deps: | ||
image: node:18 | ||
environment: | ||
PUPPETEER_SKIP_DOWNLOAD: "true" | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" | ||
working_dir: /app | ||
volumes: | ||
- ../langchain:/langchain | ||
- ./scripts:/scripts | ||
command: bash /scripts/test-langchain-with-latest-deps.sh | ||
test-langchain-with-lowest-deps: | ||
image: node:18 | ||
environment: | ||
PUPPETEER_SKIP_DOWNLOAD: "true" | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true" | ||
working_dir: /app | ||
volumes: | ||
- ../langchain:/langchain | ||
- ./scripts:/scripts | ||
command: bash /scripts/test-langchain-with-lowest-deps.sh | ||
success: | ||
image: alpine:3.14 | ||
command: echo "Success" | ||
depends_on: | ||
test-langchain-with-latest-deps: | ||
condition: service_completed_successfully | ||
test-langchain-with-lowest-deps: | ||
condition: service_completed_successfully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "dependency-range-tests", | ||
"version": "0.0.0", | ||
"private": true, | ||
"description": "Tests dependency ranges for LangChain.", | ||
"dependencies": { | ||
"semver": "^7.5.4" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
dependency_range_tests/scripts/node/update_resolutions_lowest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const fs = require("fs"); | ||
const semver = require("semver"); | ||
|
||
const currentPackageJson = JSON.parse(fs.readFileSync("./package.json")); | ||
|
||
if (currentPackageJson.dependencies["@langchain/core"]) { | ||
const minVersion = semver.minVersion( | ||
currentPackageJson.dependencies["@langchain/core"] | ||
).version; | ||
currentPackageJson.resolutions = { | ||
...currentPackageJson.resolutions, | ||
"@langchain/core": minVersion, | ||
}; | ||
currentPackageJson.dependencies = { | ||
...currentPackageJson.dependencies, | ||
"@langchain/core": minVersion, | ||
}; | ||
} | ||
|
||
if (currentPackageJson.dependencies["@langchain/community"]) { | ||
const minVersion = semver.minVersion( | ||
currentPackageJson.dependencies["@langchain/community"] | ||
).version; | ||
currentPackageJson.resolutions = { | ||
...currentPackageJson.resolutions, | ||
"@langchain/community": minVersion, | ||
}; | ||
currentPackageJson.dependencies = { | ||
...currentPackageJson.dependencies, | ||
"@langchain/community": minVersion, | ||
}; | ||
} | ||
|
||
fs.writeFileSync("./package.json", JSON.stringify(currentPackageJson, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
lru-cache@^6.0.0: | ||
version "6.0.0" | ||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" | ||
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== | ||
dependencies: | ||
yallist "^4.0.0" | ||
|
||
semver@^7.5.4: | ||
version "7.5.4" | ||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" | ||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== | ||
dependencies: | ||
lru-cache "^6.0.0" | ||
|
||
yallist@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" | ||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== |
16 changes: 16 additions & 0 deletions
16
dependency_range_tests/scripts/test-langchain-with-latest-deps.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
export CI=true | ||
|
||
# enable extended globbing for omitting build artifacts | ||
shopt -s extglob | ||
|
||
# avoid copying build artifacts from the host | ||
cp -r ../langchain/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./ | ||
|
||
yarn | ||
|
||
# Check the test command completes successfully | ||
NODE_OPTIONS=--experimental-vm-modules yarn run jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50% |
27 changes: 27 additions & 0 deletions
27
dependency_range_tests/scripts/test-langchain-with-lowest-deps.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
export CI=true | ||
|
||
# enable extended globbing for omitting build artifacts | ||
shopt -s extglob | ||
|
||
# avoid copying build artifacts from the host | ||
cp -r ../langchain/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) ./ | ||
|
||
mkdir -p /updater_script | ||
cp -r /scripts/node/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) /updater_script/ | ||
|
||
cd /updater_script | ||
|
||
yarn | ||
|
||
cd /app | ||
|
||
node /updater_script/update_resolutions_lowest.js | ||
|
||
yarn | ||
|
||
# Check the test command completes successfully | ||
NODE_OPTIONS=--experimental-vm-modules yarn run jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50% |
Oops, something went wrong.