Skip to content

The agent engineering platform.

langchain[patch]: Turn on all deprecations for 0.2 (#21999)

Eugene Yurtsev90f4d8842fab
diff --git a/libs/langchain/langchain/_api/module_import.py b/libs/langchain/langchain/_api/module_import.py
index 48b69ba55c..d9a541e595 100644
--- a/libs/langchain/langchain/_api/module_import.py
+++ b/libs/langchain/langchain/_api/module_import.py
@@ -12,33 +12,6 @@ ALLOWED_TOP_LEVEL_PKGS = {
}
-# For 0.1 releases keep this here
-# Remove for 0.2 release so that deprecation warnings will
-# be raised for all the new namespaces.
-_NAMESPACES_WITH_DEPRECATION_WARNINGS_IN_0_1 = {
- "langchain",
- "langchain.adapters.openai",
- "langchain.agents.agent_toolkits",
- "langchain.callbacks",
- "langchain.chat_models",
- "langchain.docstore",
- "langchain.document_loaders",
- "langchain.document_transformers",
- "langchain.embeddings",
- "langchain.llms",
- "langchain.memory.chat_message_histories",
- "langchain.storage",
- "langchain.tools",
- "langchain.utilities",
- "langchain.vectorstores",
-}
-
-
-def _should_deprecate_for_package(package: str) -> bool:
- """Should deprecate for this package?"""
- return bool(package in _NAMESPACES_WITH_DEPRECATION_WARNINGS_IN_0_1)
-
-
def create_importer(
package: str,
*,
@@ -109,7 +82,6 @@ def create_importer(
not is_interactive_env()
and deprecated_lookups
and name in deprecated_lookups
- and _should_deprecate_for_package(package)
):
# Depth 3:
# internal.py
@@ -127,6 +99,9 @@ def create_importer(
f">> from {package} import {name}\n\n"
"with new imports of:\n\n"
f">> from {new_module} import {name}\n"
+ "You can use the langchain cli to **automatically** "
+ "upgrade many imports. Please see documentation here "
+ "https://python.langchain.com/v0.2/docs/versions/v0_2/ "
),
)
return result
@@ -139,7 +114,7 @@ def create_importer(
try:
module = importlib.import_module(fallback_module)
result = getattr(module, name)
- if not is_interactive_env() and _should_deprecate_for_package(package):
+ if not is_interactive_env():
# Depth 3:
# internal.py
# module_import.py
@@ -156,6 +131,9 @@ def create_importer(
f">> from {package} import {name}\n\n"
"with new imports of:\n\n"
f">> from {fallback_module} import {name}\n"
+ "You can use the langchain cli to **automatically** "
+ "upgrade many imports. Please see documentation here "
+ "https://python.langchain.com/v0.2/docs/versions/v0_2/ "
),
)
return result