Skip to content

Commit

Permalink
Merge branch 'langchain-ai:master' into codespace-cuddly-guide-97j7vq…
Browse files Browse the repository at this point in the history
…547qqgh7wv9
  • Loading branch information
coldheartai committed Sep 27, 2024
2 parents 1018e0e + b2c3159 commit 2ef76d0
Show file tree
Hide file tree
Showing 782 changed files with 27,053 additions and 49,284 deletions.
25 changes: 15 additions & 10 deletions .github/DISCUSSION_TEMPLATE/q-a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,27 @@ body:
- type: textarea
id: system-info
attributes:
label: System Info
description: |
Please share your system info with us. Do NOT skip this step and please don't trim
the output. Most users don't include enough information here and it makes it harder
for us to help you.
Please share your system info with us.
Run the following command in your terminal and paste the output here:
"pip freeze | grep langchain"
platform (windows / linux / mac)
python version
python -m langchain_core.sys_info
OR if you're on a recent version of langchain-core you can paste the output of:
or if you have an existing python interpreter running:
python -m langchain_core.sys_info
placeholder: |
"pip freeze | grep langchain"
platform
python version
from langchain_core import sys_info
sys_info.print_sys_info()
Alternatively, if you're on a recent version of langchain-core you can paste the output of:
alternatively, put the entire output of `pip freeze` here.
placeholder: |
python -m langchain_core.sys_info
These will only surface LangChain packages, don't forget to include any other relevant
packages you're using (if you're not sure what's relevant, you can paste the entire output of `pip freeze`).
validations:
required: true
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Thank you for contributing to LangChain!

- [ ] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core, experimental, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes.
- Where "package" is whichever of langchain, community, core, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes.
- Example: "community: add foobar LLM"


Expand Down
20 changes: 12 additions & 8 deletions .github/scripts/check_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"libs/text-splitters",
"libs/langchain",
"libs/community",
"libs/experimental",
]

# when set to True, we are ignoring core dependents
Expand Down Expand Up @@ -153,14 +152,19 @@ def _get_pydantic_test_configs(
core_min_pydantic_version = get_min_version_from_toml(
"./libs/core/pyproject.toml", "release", python_version, include=["pydantic"]
)["pydantic"]
core_min_pydantic_minor = core_min_pydantic_version.split(".")[1] if "." in core_min_pydantic_version else "0"
dir_min_pydantic_version = (
get_min_version_from_toml(
f"./{dir_}/pyproject.toml", "release", python_version, include=["pydantic"]
)
.get("pydantic", "0.0.0")
core_min_pydantic_minor = (
core_min_pydantic_version.split(".")[1]
if "." in core_min_pydantic_version
else "0"
)
dir_min_pydantic_version = get_min_version_from_toml(
f"./{dir_}/pyproject.toml", "release", python_version, include=["pydantic"]
).get("pydantic", "0.0.0")
dir_min_pydantic_minor = (
dir_min_pydantic_version.split(".")[1]
if "." in dir_min_pydantic_version
else "0"
)
dir_min_pydantic_minor = dir_min_pydantic_version.split(".")[1] if "." in dir_min_pydantic_version else "0"

custom_mins = {
# depends on pydantic-settings 2.4 which requires pydantic 2.7
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LLM_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LLM_DEPLOYMENT_NAME }}
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LLM_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LLM_DEPLOYMENT_NAME }}
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME }}
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_test_doc_imports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Install langchain editable
run: |
poetry run pip install -e libs/core libs/langchain libs/community libs/experimental
poetry run pip install langchain-experimental -e libs/core libs/langchain libs/community
- name: Check doc imports
shell: bash
Expand Down
141 changes: 141 additions & 0 deletions .github/workflows/api_doc_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: API docs build

on:
workflow_dispatch:
schedule:
- cron: '0 13 * * *'
env:
POETRY_VERSION: "1.8.1"
PYTHON_VERSION: "3.11"

jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
path: langchain
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-api-docs-html
path: langchain-api-docs-html
token: ${{ secrets.TOKEN_GITHUB_API_DOCS_HTML }}
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-google
path: langchain-google
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-datastax
path: langchain-datastax
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-nvidia
path: langchain-nvidia
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-cohere
path: langchain-cohere
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-elastic
path: langchain-elastic
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-postgres
path: langchain-postgres
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-aws
path: langchain-aws
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-weaviate
path: langchain-weaviate
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-ai21
path: langchain-ai21
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-together
path: langchain-together
- uses: actions/checkout@v4
with:
repository: langchain-ai/langchain-experimental
path: langchain-experimental


- name: Set Git config
working-directory: langchain
run: |
git config --local user.email "actions@github.com"
git config --local user.name "Github Actions"
- name: Move google libs
run: |
rm -rf \
langchain/libs/partners/google-genai \
langchain/libs/partners/google-vertexai \
langchain/libs/partners/astradb \
langchain/libs/partners/nvidia-trt \
langchain/libs/partners/nvidia-ai-endpoints \
langchain/libs/partners/cohere \
langchain/libs/partners/elasticsearch \
langchain/libs/partners/upstage \
langchain/libs/partners/ai21 \
langchain/libs/partners/together \
langchain/libs/standard-tests \
langchain/libs/experimental
mv langchain-google/libs/genai langchain/libs/partners/google-genai
mv langchain-google/libs/vertexai langchain/libs/partners/google-vertexai
mv langchain-google/libs/community langchain/libs/partners/google-community
# mv langchain-datastax/libs/astradb langchain/libs/partners/astradb
# mv langchain-nvidia/libs/ai-endpoints langchain/libs/partners/nvidia-ai-endpoints
mv langchain-cohere/libs/cohere langchain/libs/partners/cohere
mv langchain-elastic/libs/elasticsearch langchain/libs/partners/elasticsearch
mv langchain-postgres langchain/libs/partners/postgres
mv langchain-aws/libs/aws langchain/libs/partners/aws
mv langchain-weaviate/libs/weaviate langchain/libs/partners/weaviate
mv langchain-ai21/libs/ai21 langchain/libs/partners/ai21
mv langchain-together/libs/together langchain/libs/partners/together
mv langchain-experimental/libs/experimental langchain/libs/experimental
- name: Rm old html
run:
rm -rf langchain-api-docs-html/api_reference_build/html

- name: Set up Python ${{ env.PYTHON_VERSION }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./langchain/.github/actions/poetry_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: api-docs
working-directory: langchain

- name: Install dependencies
working-directory: langchain
run: |
python -m pip install -U uv
python -m uv pip install --upgrade --no-cache-dir pip setuptools
# skip airbyte and ibm due to pandas dependency issue
python -m uv pip install $(ls ./libs/partners | grep -vE "airbyte|ibm" | xargs -I {} echo "./libs/partners/{}")
python -m uv pip install libs/core libs/langchain libs/text-splitters libs/community libs/experimental
python -m uv pip install -r docs/api_reference/requirements.txt
- name: Build docs
working-directory: langchain
run: |
python docs/api_reference/create_api_rst.py
python -m sphinx -T -E -b html -d ../langchain-api-docs-html/_build/doctrees -c docs/api_reference docs/api_reference ../langchain-api-docs-html/api_reference_build/html -j auto
python docs/api_reference/scripts/custom_formatter.py ../langchain-api-docs-html/api_reference_build/html
# Default index page is blank so we copy in the actual home page.
cp ../langchain-api-docs-html/api_reference_build/html/{reference,index}.html
rm -rf ../langchain-api-docs-html/_build/
# https://github.com/marketplace/actions/add-commit
- uses: EndBug/add-and-commit@v9
with:
cwd: langchain-api-docs-html
message: 'Update API docs build'
63 changes: 63 additions & 0 deletions .github/workflows/run_notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run notebooks

on:
workflow_dispatch:
inputs:
python_version:
description: 'Python version'
required: false
default: '3.11'
working-directory:
description: 'Working directory or subset (e.g., docs/docs/tutorials/llm_chain.ipynb)'
required: false
default: 'all'
schedule:
- cron: '0 13 * * *'

env:
POETRY_VERSION: "1.7.1"

jobs:
build:
runs-on: ubuntu-latest

name: "Test docs"
steps:
- uses: actions/checkout@v4

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ github.event.inputs.python_version || '3.11' }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: run-notebooks

- name: Install dependencies
run: |
pip install -e libs/core
pip install -e libs/langchain
pip install -e libs/community
pip install --upgrade langchain-experimental
pip install -e libs//partners/anthropic
pip install -e libs//partners/chroma
pip install -e libs//partners/openai
pip install -e libs//partners/mistralai
pip install jupyter langgraph click pypdf vcrpy
- name: Pre-download tiktoken files
run: |
python docs/scripts/download_tiktoken.py
- name: Prepare notebooks
run: |
python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells
- name: Run notebooks
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }}
run: |
./docs/scripts/execute_notebooks.sh ${{ github.event.inputs.working-directory || 'all' }}
1 change: 1 addition & 0 deletions .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LEGACY_CHAT_DEPLOYMENT_NAME }}
AZURE_OPENAI_LLM_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_LLM_DEPLOYMENT_NAME }}
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME }}
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
Expand Down
Loading

0 comments on commit 2ef76d0

Please sign in to comment.