Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hwchase17/langchainjs into …
Browse files Browse the repository at this point in the history
…feat/deepinfra-llm-and-chat
  • Loading branch information
jacoblee93 committed Jun 11, 2024
2 parents 1ce74c4 + ef9b85c commit 765e75e
Show file tree
Hide file tree
Showing 112 changed files with 2,734 additions and 1,830 deletions.
141 changes: 137 additions & 4 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ env:
# 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:
# LangChain
langchain-latest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -38,9 +39,9 @@ jobs:
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
run: docker compose -f dependency_range_tests/docker-compose.yml run langchain-latest-deps

test-langchain-with-lowest-deps:
langchain-lowest-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -50,4 +51,136 @@ jobs:
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
run: docker compose -f dependency_range_tests/docker-compose.yml run langchain-lowest-deps

# Community
community-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/community` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run community-latest-deps

community-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/community` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run community-lowest-deps

# OpenAI
openai-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/openai` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run openai-latest-deps

openai-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/openai` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run openai-lowest-deps

# Anthropic
anthropic-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/anthropic` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run anthropic-latest-deps

anthropic-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/anthropic` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run anthropic-lowest-deps

# Google VertexAI
google-vertexai-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/google-vertexai` with latest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run google-vertexai-latest-deps

google-vertexai-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: Install dependencies
run: yarn install --immutable
- name: Build `@langchain/standard-tests`
run: yarn build --filter=@langchain/standard-tests
- name: Test `@langchain/google-vertexai` with lowest deps
run: docker compose -f dependency_range_tests/docker-compose.yml run google-vertexai-lowest-deps
137 changes: 125 additions & 12 deletions dependency_range_tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: "3"
services:
test-langchain-with-latest-deps:
# LangChain
langchain-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -10,8 +11,8 @@ services:
volumes:
- ../langchain:/langchain
- ./scripts:/scripts
command: bash /scripts/test-langchain-with-latest-deps.sh
test-langchain-with-lowest-deps:
command: bash /scripts/langchain/test-with-latest-deps.sh
langchain-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
Expand All @@ -21,12 +22,124 @@ services:
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
command: bash /scripts/langchain/test-with-lowest-deps.sh

# Community
community-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-community:/libs/langchain-community
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/community/test-with-latest-deps.sh
community-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-community:/libs/langchain-community
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/community/test-with-lowest-deps.sh

# OpenAI
openai-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-openai:/libs/langchain-openai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/openai/test-with-latest-deps.sh
openai-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-openai:/libs/langchain-openai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/openai/test-with-lowest-deps.sh

# Anthropic
anthropic-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-latest-deps.sh
anthropic-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-lowest-deps.sh

# Google VertexAI
google-vertexai-latest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh
google-vertexai-lowest-deps:
image: node:18
environment:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
COHERE_API_KEY: ${COHERE_API_KEY}
working_dir: /app
volumes:
- ../turbo.json:/turbo.json
- ../package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const fs = require("fs");
const semver = require("semver");

const communityPackageJsonPath = "package.json";

const currentPackageJson = JSON.parse(fs.readFileSync(communityPackageJsonPath));

if (currentPackageJson.dependencies["@langchain/core"] && !currentPackageJson.dependencies["@langchain/core"].includes("rc")) {
const minVersion = semver.minVersion(
currentPackageJson.dependencies["@langchain/core"]
).version;
currentPackageJson.overrides = {
...currentPackageJson.overrides,
"@langchain/core": minVersion,
};
currentPackageJson.dependencies = {
...currentPackageJson.dependencies,
"@langchain/core": minVersion,
};
}

if (currentPackageJson.dependencies["@langchain/openai"] && !currentPackageJson.dependencies["@langchain/openai"].includes("rc")) {
const minVersion = semver.minVersion(
currentPackageJson.dependencies["@langchain/openai"]
).version;
currentPackageJson.overrides = {
...currentPackageJson.overrides,
"@langchain/openai": minVersion,
};
currentPackageJson.dependencies = {
...currentPackageJson.dependencies,
"@langchain/openai": minVersion,
};
}

if (currentPackageJson.dependencies["@langchain/textsplitters"] && !currentPackageJson.dependencies["@langchain/textsplitters"].includes("rc")) {
const minVersion = semver.minVersion(
currentPackageJson.dependencies["@langchain/textsplitters"]
).version;
currentPackageJson.overrides = {
...currentPackageJson.overrides,
"@langchain/textsplitters": minVersion,
};
currentPackageJson.dependencies = {
...currentPackageJson.dependencies,
"@langchain/textsplitters": minVersion,
};
}

fs.writeFileSync(communityPackageJsonPath, JSON.stringify(currentPackageJson, null, 2));
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ shopt -s extglob
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/
cp -r /scripts/langchain/node/!(node_modules|dist|dist-cjs|dist-esm|build|.next|.turbo) /updater_script/

cd /updater_script

Expand Down
Loading

0 comments on commit 765e75e

Please sign in to comment.