Fix: Add langchain-core dependency to resolve deprecated import issue #17341
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: ModuleNotFoundError for langchain.docstore
Description
This PR fixes the CI/CD test failure caused by a deprecated langchain import path in the PaddleX dependency.
Problem
The test suite was failing with:
This error occurs in PaddleX's retriever module at
paddlex/inference/pipelines/components/retriever/base.py:25, which uses the deprecated import:Root Cause
The langchain library deprecated the
langchain.docstore.documentimport path and moved it tolangchain_core.documents. The PaddleX dependency still uses the old import path.Reference: https://reference.langchain.com/python/integrations/langchain_google_community/?h=document#langchain_google_community.DocumentAIWarehouseRetriever
Solution
Added
langchain-core>=0.1.0to the project dependencies inpyproject.toml. This provides the new import path that the updated langchain ecosystem expects while maintaining backward compatibility with PaddleX until it updates its import statements.Changes
pyproject.toml:langchain-core>=0.1.0to dependencies listTesting
The fix ensures that:
Impact
Related Issues
Additional Notes
This is a compatibility fix. The long-term solution would be for PaddleX to update its import statements to use the new langchain_core path. Once PaddleX releases an updated version, this dependency addition will remain harmless as it's part of the langchain ecosystem.