diff --git a/libs/core/langchain_core/runnables/__init__.py b/libs/core/langchain_core/runnables/__init__.py index 518d5c38c9..9c4362c9c8 100644 --- a/libs/core/langchain_core/runnables/__init__.py +++ b/libs/core/langchain_core/runnables/__init__.py @@ -36,7 +36,6 @@ from langchain_core.runnables.config import ( run_in_executor, ) from langchain_core.runnables.fallbacks import RunnableWithFallbacks -from langchain_core.runnables.history import RunnableWithMessageHistory from langchain_core.runnables.passthrough import ( RunnableAssign, RunnablePassthrough, @@ -79,7 +78,6 @@ __all__ = [ "RunnablePick", "RunnableSequence", "RunnableWithFallbacks", - "RunnableWithMessageHistory", "get_config_list", "aadd", "add", diff --git a/libs/core/tests/unit_tests/runnables/test_imports.py b/libs/core/tests/unit_tests/runnables/test_imports.py index 12b1a80d1b..48098aa6db 100644 --- a/libs/core/tests/unit_tests/runnables/test_imports.py +++ b/libs/core/tests/unit_tests/runnables/test_imports.py @@ -26,7 +26,6 @@ EXPECTED_ALL = [ "RunnablePick", "RunnableSequence", "RunnableWithFallbacks", - "RunnableWithMessageHistory", "get_config_list", "aadd", "add", diff --git a/libs/core/tests/unit_tests/test_imports.py b/libs/core/tests/unit_tests/test_imports.py index d4b49d2392..7d64113378 100644 --- a/libs/core/tests/unit_tests/test_imports.py +++ b/libs/core/tests/unit_tests/test_imports.py @@ -1,7 +1,10 @@ import glob import importlib +import subprocess from pathlib import Path +import pytest + def test_importable_all() -> None: for path in glob.glob("../core/langchain_core/*"): @@ -13,3 +16,12 @@ def test_importable_all() -> None: all_ = getattr(module, "__all__", []) for cls_ in all_: getattr(module, cls_) + + # Test import in isolation + # Note: ImportErrors due to circular imports can be raised + # for one sequence of imports but not another. + result = subprocess.run( + ["python", "-c", f"import langchain_core.{module_name}"], + ) + if result.returncode != 0: + pytest.fail(f"Failed to import {module_name}.")