Upgrade to LangChain 1.0
Recipe ID
org.openrewrite.python.migrate.langchain.UpgradeToLangChain1Artifactopenrewrite-migrate-pythonMigrate to LangChain 1.0 by applying all v0.2 migrations and then moving legacy functionality to langchain_classic.
Composite recipepython1.0langchainmigrationProprietary
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.UpgradeToLangChain1If 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.
- Upgrade to LangChain 0.2
org.openrewrite.python.migrate.langchain.UpgradeToLangChain02 - Replace
langchainlegacy imports withlangchain_classicorg.openrewrite.python.migrate.langchain.ReplaceLangchainClassicImports - Find
create_react_agentusage (replace withcreate_agent)org.openrewrite.python.migrate.langchain.FindLangchainCreateReactAgent - Find deprecated LangChain agent patterns
org.openrewrite.python.migrate.langchain.FindDeprecatedLangchainAgents