Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 8 additions & 10 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
pull_request:
# Only run this workflow if the following directories have changed.
paths:
- "langchain/**"
- "langchain-core/**"
- "libs/**"
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI

Expand Down Expand Up @@ -50,7 +48,7 @@ jobs:
langchain-latest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain/') || contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-openai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-textsplitters/')
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain/') || contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-openai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-textsplitters/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand Down Expand Up @@ -81,7 +79,7 @@ jobs:
# community-latest-deps:
# runs-on: ubuntu-latest
# needs: get-changed-files
# if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-openai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-community/')
# if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-openai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-community/')
# steps:
# - uses: actions/checkout@v4
# - name: Use Node.js ${{ env.NODE_VERSION }}
Expand Down Expand Up @@ -136,7 +134,7 @@ jobs:
openai-latest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-openai/')
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-openai/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand All @@ -156,7 +154,7 @@ jobs:
openai-lowest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-openai/')
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-openai/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand Down Expand Up @@ -218,7 +216,7 @@ jobs:
google-vertexai-latest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-google-vertexai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-google-gauth/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-google-common/')
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-google-vertexai/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-google-gauth/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-google-common/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand All @@ -238,7 +236,7 @@ jobs:
google-vertexai-lowest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-google-vertexai/')
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-google-vertexai/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand All @@ -259,7 +257,7 @@ jobs:
cohere-latest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-cohere/')
if: contains(needs.get-changed-files.outputs.changed_files, 'langchain-core/') || contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-cohere/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand All @@ -279,7 +277,7 @@ jobs:
cohere-lowest-deps:
runs-on: ubuntu-latest
needs: get-changed-files
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/langchain-cohere/')
if: contains(needs.get-changed-files.outputs.changed_files, 'libs/providers/langchain-cohere/')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
pull_request:
# Only run workflow if files in these directories are changed
paths:
- "langchain/**"
- "langchain-core/**"
- "libs/langchain-anthropic/**"
- "libs/langchain/**"
- "libs/langchain-core/**"
- "libs/langchain-community/**"
- "libs/langchain-openai/**"
- "libs/providers/langchain-anthropic/**"
- "libs/providers/langchain-openai/**"
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,
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ We aim to keep the same core APIs between the Python and JS versions of LangChai

### Want to add a specific integration?

LangChain supports several different types of integrations with third-party providers and frameworks, including LLM providers (e.g. [OpenAI](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-openai/src/chat_models.ts)), vector stores (e.g. [FAISS](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/faiss.ts), document loaders (e.g. [Apify](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/document_loaders/web/apify_dataset.ts)) persistent message history stores (e.g. [Redis](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-redis/src/caches.ts)), and more.
LangChain supports several different types of integrations with third-party providers and frameworks, including LLM providers (e.g. [OpenAI](https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-openai/src/chat_models.ts)), vector stores (e.g. [FAISS](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/faiss.ts), document loaders (e.g. [Apify](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/document_loaders/web/apify_dataset.ts)) persistent message history stores (e.g. [Redis](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-redis/src/caches.ts)), and more.

We welcome such contributions, but ask that you read our dedicated [integration contribution guide](https://github.com/langchain-ai/langchainjs/blob/main/.github/contributing/INTEGRATIONS.md) for specific details and patterns to consider before opening a pull request.

Expand Down
16 changes: 8 additions & 8 deletions dependency_range_tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/openai/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-openai:/libs/langchain-openai
- ../libs/providers/langchain-openai:/libs/providers/langchain-openai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/openai/test-with-latest-deps.sh
openai-lowest-deps:
Expand All @@ -98,7 +98,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/openai/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-openai:/libs/langchain-openai
- ../libs/providers/langchain-openai:/libs/providers/langchain-openai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/openai/test-with-lowest-deps.sh

Expand All @@ -115,7 +115,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/anthropic/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ../libs/providers/langchain-anthropic:/libs/providers/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-latest-deps.sh
anthropic-lowest-deps:
Expand All @@ -130,7 +130,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/anthropic/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-anthropic:/libs/langchain-anthropic
- ../libs/providers/langchain-anthropic:/libs/providers/langchain-anthropic
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/anthropic/test-with-lowest-deps.sh

Expand All @@ -147,7 +147,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/google-vertexai/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ../libs/providers/langchain-google-vertexai:/libs/providers/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/google-vertexai/test-with-latest-deps.sh
google-vertexai-lowest-deps:
Expand All @@ -162,7 +162,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/google-vertexai/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-google-vertexai:/libs/langchain-google-vertexai
- ../libs/providers/langchain-google-vertexai:/libs/providers/langchain-google-vertexai
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/google-vertexai/test-with-lowest-deps.sh

Expand All @@ -179,7 +179,7 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/cohere/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-cohere:/libs/langchain-cohere
- ../libs/providers/langchain-cohere:/libs/providers/langchain-cohere
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/cohere/test-with-latest-deps.sh
cohere-lowest-deps:
Expand All @@ -194,6 +194,6 @@ services:
- ../turbo.json:/turbo.json
- ./scripts/with_standard_tests/cohere/node/package.json:/package.json
- ../libs/langchain-standard-tests:/libs/langchain-standard-tests
- ../libs/langchain-cohere:/libs/langchain-cohere
- ../libs/providers/langchain-cohere:/libs/providers/langchain-cohere
- ./scripts:/scripts
command: bash /scripts/with_standard_tests/cohere/test-with-lowest-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ cp -r /scripts/langchain/node/!(node_modules|dist|dist-cjs|dist-esm|build|.next|

cd /updater_script

pnpm install --production
pnpm install --prod

cd /app

corepack enable
node /updater_script/update_resolutions_latest.js

pnpm install --production
pnpm install
pnpm add @langchain/core

# Check the test command completes successfully
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cp -r /scripts/langchain/node/!(node_modules|dist|dist-cjs|dist-esm|build|.next|

cd /updater_script

pnpm install --production
pnpm install --prod

cd /app

Expand All @@ -26,7 +26,7 @@ node /updater_script/update_resolutions_lowest.js
# Read the @langchain/core version from peerDependencies
core_version=$(node -p "require('./package.json').peerDependencies?.['@langchain/core']")

pnpm install --production
pnpm install
pnpm add @langchain/core@$core_version

# Check the test command completes successfully
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"description": "Tests dependency ranges for LangChain.",
"dependencies": {
"semver": "^7.5.4"
}
},
"packageManager": "[email protected]+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require("fs");

const communityPackageJsonPath =
"/app/monorepo/libs/langchain-anthropic/package.json";
"/app/monorepo/libs/providers/langchain-anthropic/package.json";
const currentPackageJson = JSON.parse(
fs.readFileSync(communityPackageJsonPath)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs");
const semver = require("semver");

const communityPackageJsonPath =
"/app/monorepo/libs/langchain-anthropic/package.json";
"/app/monorepo/libs/providers/langchain-anthropic/package.json";

const currentPackageJson = JSON.parse(
fs.readFileSync(communityPackageJsonPath)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const fs = require("fs");

const communityPackageJsonPath = "/app/monorepo/libs/langchain-anthropic/package.json";
const currentPackageJson = JSON.parse(fs.readFileSync(communityPackageJsonPath));
const communityPackageJsonPath =
"/app/monorepo/libs/providers/langchain-anthropic/package.json";
const currentPackageJson = JSON.parse(
fs.readFileSync(communityPackageJsonPath)
);

// Anthropic has other workspaces as devDependencies, but tagged as `workspace:*` for the version.
// Update these to be `latest` for the test.
Expand All @@ -12,4 +15,7 @@ if (currentPackageJson.devDependencies["@langchain/community"]) {
};
}

fs.writeFileSync(communityPackageJsonPath, JSON.stringify(currentPackageJson, null, 2));
fs.writeFileSync(
communityPackageJsonPath,
JSON.stringify(currentPackageJson, null, 2)
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ corepack enable

# New monorepo directory paths
monorepo_dir="/app/monorepo"
monorepo_anthropic_dir="/app/monorepo/libs/langchain-anthropic"
monorepo_anthropic_dir="/app/monorepo/libs/providers/langchain-anthropic"

# Updater script will not live inside the monorepo
updater_script_dir="/app/updater_script"
Expand All @@ -17,7 +17,7 @@ updater_script_dir="/app/updater_script"
original_updater_script_dir="/scripts/with_standard_tests/anthropic/node"

# Run the shared script to copy all necessary folders/files
bash /scripts/with_standard_tests/shared.sh anthropic
bash /scripts/with_standard_tests/shared.sh providers/langchain-anthropic

mkdir -p "$updater_script_dir"
cp "$original_updater_script_dir"/* "$updater_script_dir/"
Expand All @@ -30,7 +30,7 @@ node "update_resolutions_latest.js"

# Navigate back to monorepo root and install dependencies
cd "$monorepo_dir"
pnpm install --prod
pnpm install

# Navigate into `@langchain/anthropic` to build and run tests
# We need to run inside the anthropic directory so turbo repo does
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ set -euxo pipefail
export CI=true

monorepo_dir="/app/monorepo"
monorepo_anthropic_dir="/app/monorepo/libs/langchain-anthropic"
monorepo_anthropic_dir="/app/monorepo/libs/providers/langchain-anthropic"
updater_script_dir="/app/updater_script"
original_updater_script_dir="/scripts/with_standard_tests/anthropic/node"

# Run the shared script to copy all necessary folders/files
bash /scripts/with_standard_tests/shared.sh anthropic
bash /scripts/with_standard_tests/shared.sh providers/langchain-anthropic

# Copy the updater script to the monorepo
mkdir -p "$updater_script_dir"
cp "$original_updater_script_dir"/* "$updater_script_dir/"

# Install deps (e.g semver) for the updater script
cd "$updater_script_dir"
pnpm install --production
pnpm install
# Run the updater script
node "update_workspace_deps.js"
node "update_resolutions_lowest.js"

# Navigate back to monorepo root and install dependencies
cd "$monorepo_dir"
touch pnpm.lock
pnpm install --production
pnpm install

# Navigate into `@langchain/anthropic` to build and run tests
# We need to run inside the package directory so turbo repo does
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"description": "Tests dependency ranges for LangChain.",
"dependencies": {
"semver": "^7.5.4"
}
},
"packageManager": "[email protected]+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require("fs");

const communityPackageJsonPath =
"/app/monorepo/libs/langchain-cohere/package.json";
"/app/monorepo/libs/providers/langchain-cohere/package.json";
const currentPackageJson = JSON.parse(
fs.readFileSync(communityPackageJsonPath)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs");
const semver = require("semver");

const communityPackageJsonPath =
"/app/monorepo/libs/langchain-cohere/package.json";
"/app/monorepo/libs/providers/langchain-cohere/package.json";

const currentPackageJson = JSON.parse(
fs.readFileSync(communityPackageJsonPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ corepack enable

# New monorepo directory paths
monorepo_dir="/app/monorepo"
monorepo_cohere_dir="/app/monorepo/libs/langchain-cohere"
monorepo_cohere_dir="/app/monorepo/libs/providers/langchain-cohere"

# Updater script will not live inside the monorepo
updater_script_dir="/app/updater_script"
Expand All @@ -17,7 +17,7 @@ updater_script_dir="/app/updater_script"
original_updater_script_dir="/scripts/with_standard_tests/cohere/node"

# Run the shared script to copy all necessary folders/files
bash /scripts/with_standard_tests/shared.sh cohere
bash /scripts/with_standard_tests/shared.sh providers/langchain-cohere

mkdir -p "$updater_script_dir"
cp "$original_updater_script_dir"/* "$updater_script_dir/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ set -euxo pipefail
export CI=true

monorepo_dir="/app/monorepo"
monorepo_cohere_dir="/app/monorepo/libs/langchain-cohere"
monorepo_cohere_dir="/app/monorepo/libs/providers/langchain-cohere"
updater_script_dir="/app/updater_script"
updater_script_dir="/app/updater_script"
original_updater_script_dir="/scripts/with_standard_tests/cohere/node"

# Run the shared script to copy all necessary folders/files
bash /scripts/with_standard_tests/shared.sh cohere
bash /scripts/with_standard_tests/shared.sh providers/langchain-cohere

# Copy the updater script to the monorepo
mkdir -p "$updater_script_dir"
cp "$original_updater_script_dir"/* "$updater_script_dir/"

# Install deps (e.g semver) for the updater script
cd "$updater_script_dir"
pnpm install --production
pnpm install
# Run the updater script
node "update_resolutions_lowest.js"


# Navigate back to monorepo root and install dependencies
cd "$monorepo_dir"
pnpm install --production
pnpm install

# Navigate into `@langchain/cohere` to build and run tests
# We need to run inside the cohere directory so turbo repo does
Expand Down
Loading
Loading