Upgrade to LangChain 0.2
Recipe ID
org.openrewrite.python.migrate.langchain.UpgradeToLangChain02Artifactopenrewrite-migrate-pythonMigrate to LangChain 0.2 by updating imports from langchain to langchain_community and provider-specific packages.
Composite recipepython0.2langchainmigrationProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.langchain.UpgradeToLangChain02If the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-pythonDefinition
This recipe runs the following recipes in order.
- Replace
langchainimports withlangchain_communityorg.openrewrite.python.migrate.langchain.ReplaceLangchainCommunityImports - Replace
langchain_communityimports with provider packagesorg.openrewrite.python.migrate.langchain.ReplaceLangchainProviderImports