Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deps): bump supported LangChain package versions to latest #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,34 @@ jobs:
- name: Test build
run: |
poetry build

backwards-compatibility:
runs-on: ubuntu-latest
name: Minimum versions compatibility test
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-compatibility

- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: poetry install --no-interaction

- name: Test compatibility with minimum versions
env:
LAKERA_GUARD_API_KEY: ${{ secrets.LAKERA_GUARD_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: ./scripts/test_compatibility.sh
5 changes: 3 additions & 2 deletions lakera_chainguard/lakera_chainguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

import requests
from langchain.agents import AgentExecutor
from langchain.schema import BaseMessage, PromptValue
from langchain_core.messages import BaseMessage
from langchain_core.prompt_values import PromptValue
from langchain.tools import BaseTool
from langchain_core.agents import AgentStep
from langchain.callbacks.manager import (
CallbackManagerForLLMRun,
CallbackManagerForChainRun,
)
from langchain.schema.agent import AgentFinish, AgentAction
from langchain_core.agents import AgentFinish, AgentAction
from langchain_core.language_models import BaseChatModel, BaseLLM
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_core.outputs import ChatResult, LLMResult
Expand Down
148 changes: 103 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ keywords = ["llm", "langchain", "prompt-injection", "llm-security", "lakera-guar
[tool.poetry.dependencies]
python = "^3.10"
requests = "^2.31.0"
langchain = "^0.2.10"
langchain-core = "^0.2.22"
langchain = ">=0.2.10,<0.4.0"
langchain-core = ">=0.2.43,<0.4.0"
Copy link
Author

@vnord vnord Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lower bound was slightly raised here, as I got dependency conflicts when using original version. It's just a patch bump, though, so it shouldn't be breaking.

langchain-community = ">=0.2.5,<0.4.0"
Comment on lines +17 to +19
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff via

poetry add "langchain>=0.2.10,<0.4.0" "langchain-core>=0.2.43,<0.4.0" "langchain-community>=0.2.5,<0.4.0"

(and poetry add --group dev "langchain-openai>=0.1.25,<0.4.0"below)

types-requests = "^2.31.0.20240106"
griffe = "0.49.0"
langchain-community = "0.2.5"


[tool.poetry.group.dev.dependencies]
Expand All @@ -28,10 +28,10 @@ black = "^23.12.1"
pre-commit = "^3.6.0"
ipykernel = "^6.28.0"
openai = "^1.6.1"
langchain-openai = "0.1.25"
mkdocs = "^1.5.3"
mkdocstrings = {extras = ["python"], version = "^0.24.0"}
mkdocs-material = "^9.5.3"
langchain-openai = ">=0.1.25,<0.4.0"


[build-system]
Expand Down
Loading