The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
cli[patch]: Update migrations file manually (#21021)
Eugene Yurtsev4f4ee8e2cfcc
diff --git a/libs/cli/langchain_cli/namespaces/migrate/codemods/migrations/langchain_to_core.json b/libs/cli/langchain_cli/namespaces/migrate/codemods/migrations/langchain_to_core.jsonindex 8396df3a2e..970cc2dce1 100644--- a/libs/cli/langchain_cli/namespaces/migrate/codemods/migrations/langchain_to_core.json+++ b/libs/cli/langchain_cli/namespaces/migrate/codemods/migrations/langchain_to_core.json@@ -1569,7 +1569,7 @@],["langchain.schema.runnable.RunnableMap",- "langchain_core.runnables.RunnableParallel"+ "langchain_core.runnables.RunnableMap"],["langchain.schema.runnable.RunnableParallel",@@ -1629,7 +1629,7 @@],["langchain.schema.runnable.base.RunnableMap",- "langchain_core.runnables.RunnableParallel"+ "langchain_core.runnables.RunnableMap"],["langchain.schema.runnable.base.coerce_to_runnable",diff --git a/libs/cli/langchain_cli/namespaces/migrate/generate/generic.py b/libs/cli/langchain_cli/namespaces/migrate/generate/generic.pyindex 03df8aa3db..12c97147ff 100644--- a/libs/cli/langchain_cli/namespaces/migrate/generate/generic.py+++ b/libs/cli/langchain_cli/namespaces/migrate/generate/generic.py@@ -106,7 +106,7 @@ def generate_top_level_imports(pkg: str) -> List[Tuple[str, str]]:# Only iterate through top-level modules/packagesfor finder, modname, ispkg in pkgutil.iter_modules(- package.__path__, package.__name__ + "."+ package.__path__, package.__name__ + "."):if ispkg:try:diff --git a/libs/cli/tests/unit_tests/migrate/cli_runner/cases/imports_with_alias_changes.py b/libs/cli/tests/unit_tests/migrate/cli_runner/cases/imports_with_alias_changes.pynew file mode 100644index 0000000000..28c6be51f0--- /dev/null+++ b/libs/cli/tests/unit_tests/migrate/cli_runner/cases/imports_with_alias_changes.py@@ -0,0 +1,29 @@+"""Handle a test case where the import is updated and may involve an alias change."""+from tests.unit_tests.migrate.cli_runner.case import Case+from tests.unit_tests.migrate.cli_runner.file import File++# The test case right now make sure that if we update the import+# of RunnableMap to RunnableParallel then the code that's using RunnableMap+# should be updated as well (or else we keep importing RunnableMap.)+cases = [+ Case(+ name="Imports",+ source=File(+ "app.py",+ content=[+ "from langchain.runnables import RunnableMap",+ "",+ "chain = RunnableMap({})",+ ],+ ),+ expected=File(+ "app.py",+ content=[+ "from langchain_core.runnables import RunnableMap",+ "",+ "chain = RunnableMap({})",+ ],+ ),+ ),+]+""