_warn_on_import() — langchain Function Reference
Architecture documentation for the _warn_on_import() function in __init__.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2c858696_fa56_c9a4_8065_2adce730d3e7["_warn_on_import()"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b["__init__.py"] 2c858696_fa56_c9a4_8065_2adce730d3e7 -->|defined in| 74c9c18b_11c5_b8f7_0fac_e554bc0a732b 5c16336d_ebc3_1ea4_2769_5c082ddcc648["__getattr__()"] 5c16336d_ebc3_1ea4_2769_5c082ddcc648 -->|calls| 2c858696_fa56_c9a4_8065_2adce730d3e7 style 2c858696_fa56_c9a4_8065_2adce730d3e7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/__init__.py lines 17–38
def _warn_on_import(name: str, replacement: str | None = None) -> None:
"""Warn on import of deprecated module."""
from langchain_classic._api.interactive_env import is_interactive_env
if is_interactive_env():
# No warnings for interactive environments.
# This is done to avoid polluting the output of interactive environments
# where users rely on auto-complete and may trigger this warning
# even if they are not using any deprecated modules
return
if replacement:
warnings.warn(
f"Importing {name} from langchain root module is no longer supported. "
f"Please use {replacement} instead.",
stacklevel=3,
)
else:
warnings.warn(
f"Importing {name} from langchain root module is no longer supported.",
stacklevel=3,
)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _warn_on_import() do?
_warn_on_import() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/__init__.py.
Where is _warn_on_import() defined?
_warn_on_import() is defined in libs/langchain/langchain_classic/__init__.py at line 17.
What calls _warn_on_import()?
_warn_on_import() is called by 1 function(s): __getattr__.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free