fix(deps): update dependency langchain to v1#2730
Conversation
|
f2ad1d3 to
5186db1
Compare
f00e2c3 to
e0508f7
Compare
deb5787 to
1fc8817
Compare
06e4e63 to
3d7d30f
Compare
OpenAPI ChangesShow/hide No detectable change.Unexpected changes? Ensure your branch is up-to-date with |
pyproject.toml
Outdated
| langchain = "^1.0.0" | ||
| langchain-experimental = "^0.3.4" |
There was a problem hiding this comment.
Bug: The langchain upgrade to ^1.0.0 is incompatible with langchain-experimental at ^0.3.4. This will cause a runtime error if the SemanticChunker feature is enabled.
Severity: MEDIUM
Suggested Fix
The poetry.lock file is stale and needs to be regenerated after the pyproject.toml changes. Additionally, investigate upgrading langchain-experimental to a version compatible with langchain v1.0. If no compatible version exists, the usage of SemanticChunker should be removed or replaced with an alternative from the langchain v1.0 ecosystem.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L60-L61
Potential issue: The upgrade of `langchain` to version `^1.0.0` introduces a version
incompatibility with `langchain-experimental`, which remains at `^0.3.4`. The
`langchain-experimental` package at this version is designed for the `langchain` v0.3
ecosystem and is not compatible with the architectural changes in v1.0. If semantic
chunking is enabled via the `CONTENT_FILE_EMBEDDING_SEMANTIC_CHUNKING_ENABLED` setting,
the application will raise a runtime error when attempting to instantiate
`SemanticChunker` from `langchain-experimental`. This will prevent content embeddings
from being generated. The feature is disabled by default, so the bug will only manifest
in environments where it has been explicitly activated.
pyproject.toml
Outdated
| isodate = "^0.7.2" | ||
| jedi = "^0.19.0" | ||
| langchain = "^0.3.11" | ||
| langchain = "^1.0.0" |
There was a problem hiding this comment.
Bug: The langchain upgrade to ^1.0.0 conflicts with langchain-community@^0.3.24's dependency requirements, which will likely cause dependency resolution to fail. The code also uses a deprecated ChatLiteLLM.
Severity: HIGH
Suggested Fix
Update the langchain-community package in pyproject.toml to a version compatible with langchain v1.0. Additionally, migrate the usage of the deprecated ChatLiteLLM from langchain_community to the recommended langchain_litellm.ChatLiteLLM to ensure compatibility and avoid known issues.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L60
Potential issue: The upgrade to `langchain` version `^1.0.0` creates a dependency
conflict with `langchain-community`, which is specified at `^0.3.24`. The
`langchain-community` package at this version has a dependency constraint requiring
`langchain <1.0.0`. This will likely cause a dependency resolution failure when running
`poetry install` or `poetry lock`. Furthermore, the code uses `ChatLiteLLM` from this
older `langchain-community` version, which is deprecated and has known issues with
`with_structured_output()`. While existing error handling would prevent a server crash,
the feature would fail to generate flashcards.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The code imports ChatLiteLLM from langchain_litellm, but this package is not listed as a dependency in pyproject.toml, which will cause a runtime ModuleNotFoundError.
Severity: HIGH
Suggested Fix
Add langchain_litellm as an explicit dependency to the [tool.poetry.dependencies] section of the pyproject.toml file to ensure it is installed and available at runtime.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The application imports `ChatLiteLLM` from the `langchain_litellm`
package in `learning_resources/content_summarizer.py` to support content summarization
and flashcard generation. However, `langchain_litellm` is not declared as a dependency
in `pyproject.toml`. While this may have worked previously due to transitive
dependencies, it is not a transitive dependency of `langchain>=1.2.10`. Because the
import occurs during runtime when these features are used, not at application startup,
any attempt to generate summaries, flashcards, or embeddings will result in a
`ModuleNotFoundError`, breaking these features.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: Upgrading langchain to v1.2.10 introduces a known incompatibility with langchain-litellm, causing with_structured_output() to fail during flashcard generation.
Severity: HIGH
Suggested Fix
The langchain-litellm library does not fully support with_structured_output in langchain v1. Consider pinning langchain to a version known to be compatible, or refactor the flashcard generation logic to avoid using with_structured_output() until langchain-litellm is updated.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The upgrade to `langchain` version `>=1.2.10` introduces a runtime
error due to a known incompatibility with the `langchain-litellm` library. The
`ChatLiteLLM.with_structured_output()` method is documented to fail when used with a
structured type, such as the `FlashcardsResponse` `TypedDict` used in
`content_summarizer.py`. This will cause an exception to be thrown whenever the
flashcard generation feature is invoked, leading to a complete failure of that
functionality.
pyproject.toml
Outdated
| "langchain>=1.2.10,<1.3", | ||
| "langchain-experimental>=0.3.4,<0.4", |
There was a problem hiding this comment.
Bug: Updating langchain to v1.2.10 without updating langchain-experimental creates a dependency conflict with langchain-core, which will break the installation process.
Severity: CRITICAL
Suggested Fix
To resolve the dependency conflict, update langchain-experimental to a version compatible with langchain>=1.2.10. After updating the dependencies in pyproject.toml, regenerate the uv.lock file by running uv lock and commit the updated lock file to the repository.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56-L57
Potential issue: The `pyproject.toml` file was updated to require `langchain>=1.2.10`,
but the `uv.lock` file was not regenerated. The new `langchain` version requires
`langchain-core>=1.x`, while the existing `langchain-experimental` dependency requires
`langchain-core<0.4`. This creates a mutually incompatible dependency requirement. As a
result, any attempt to regenerate the lock file (e.g., via `uv lock`) or sync
dependencies will fail due to a resolution error, preventing developers from installing
the project's dependencies and breaking the build pipeline.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The import for RecursiveCharacterTextSplitter uses an outdated path that is incompatible with the newly updated langchain v1.2.10, which will cause an ImportError.
Severity: CRITICAL
Suggested Fix
Update the import statement in vector_search/utils.py to use the correct path for langchain v1.x. Change from langchain.text_splitter import RecursiveCharacterTextSplitter to from langchain_text_splitters import RecursiveCharacterTextSplitter.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The project's dependency on `langchain` has been updated to version
1.2.10. However, the import for `RecursiveCharacterTextSplitter` in
`vector_search/utils.py` still uses the outdated path `from langchain.text_splitter
import RecursiveCharacterTextSplitter`, which was valid for `langchain` v0.x. In
`langchain` v1.x, this module has been moved to a separate package. This discrepancy
will cause an `ImportError` when the `_chunk_documents()` function is called during
content embedding operations, leading to a failure in that part of the application.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The langchain upgrade requires updating an import path for RecursiveCharacterTextSplitter and adding the new langchain-text-splitters package to dependencies to prevent a startup crash.
Severity: CRITICAL
Suggested Fix
Update the import in vector_search/utils.py from langchain.text_splitter to langchain_text_splitters. Then, add langchain-text-splitters as an explicit dependency in pyproject.toml.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The upgrade of `langchain` to v1.2.10 moves text splitter functionality
to a separate package, `langchain_text_splitters`. The code in `vector_search/utils.py`
attempts to import `RecursiveCharacterTextSplitter` from the old, now-removed
`langchain.text_splitter` module. Additionally, the new required package,
`langchain-text-splitters`, is not declared as a dependency in `pyproject.toml`. This
combination will cause a fatal `ImportError` when the application initializes,
preventing it from starting.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The langchain upgrade breaks an import in vector_search/utils.py. The path langchain.text_splitter no longer exists, which will cause a ModuleNotFoundError during embedding operations.
Severity: CRITICAL
Suggested Fix
In vector_search/utils.py, change the import from from langchain.text_splitter import RecursiveCharacterTextSplitter to from langchain_text_splitters import RecursiveCharacterTextSplitter. It is also recommended to add langchain_text_splitters as an explicit dependency in pyproject.toml.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The upgrade to `langchain` v1.2.10 removes the
`langchain.text_splitter` module. However, `vector_search/utils.py` at line 9 still
attempts to import `RecursiveCharacterTextSplitter` from this old, now non-existent,
path. This will cause a `ModuleNotFoundError` at runtime whenever embedding-related
Celery tasks (e.g., `generate_embeddings`) are executed, as they depend on functions
within `vector_search.utils`. This will cause all vector search and content embedding
operations to fail.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The pyproject.toml dependency for langchain was updated, but the uv.lock file was not regenerated. This mismatch will cause CI/CD and deployment builds to fail.
Severity: CRITICAL
Suggested Fix
Regenerate the uv.lock file to align it with the updated dependencies in pyproject.toml. This can be done by running the appropriate lock file generation command, such as uv lock.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The `pyproject.toml` file was updated to require `langchain` version
`>=1.2.10,<1.3`, but the `uv.lock` file was not updated and still pins `langchain` to
`0.3.27`. The project's CI/CD and Docker build processes use the `uv sync --frozen`
command, which strictly enforces the versions specified in the lock file. Because the
pinned version in `uv.lock` does not satisfy the new constraint in `pyproject.toml`, the
build process will fail, preventing deployments and breaking the CI pipeline.
pyproject.toml
Outdated
| "isodate>=0.7.2,<0.8", | ||
| "jedi>=0.19.0,<0.20", | ||
| "langchain>=0.3.11,<0.4", | ||
| "langchain>=1.2.10,<1.3", |
There was a problem hiding this comment.
Bug: The langchain dependency upgrade introduces a breaking change. The import for RecursiveCharacterTextSplitter in vector_search/utils.py is outdated and will cause a runtime ModuleNotFoundError.
Severity: CRITICAL
Suggested Fix
In vector_search/utils.py, change the import from from langchain.text_splitter import RecursiveCharacterTextSplitter to from langchain_text_splitters import RecursiveCharacterTextSplitter. Additionally, add the new langchain-text-splitters package to the project dependencies.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: pyproject.toml#L56
Potential issue: The `langchain` dependency is being upgraded from version `<0.4` to
`>=1.2.10`, which is a major version update. This new version introduces a breaking
change where `RecursiveCharacterTextSplitter` was moved from the
`langchain.text_splitter` module to a new package, `langchain_text_splitters`. The code
in `vector_search/utils.py` still uses the old import path. This will lead to a
`ModuleNotFoundError` at runtime whenever vector search or embedding functionalities are
triggered via API calls, Celery tasks, or management commands, breaking this entire
subsystem.
This PR contains the following updates:
>=0.3.11,<0.4→>=1.2.11,<1.3Configuration
📅 Schedule: Branch creation - "every weekend" in timezone US/Eastern, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.