__getattr__() — langchain Function Reference
Architecture documentation for the __getattr__() function in __init__.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 982d66a9_b1db_d53e_2a6b_dd75e1cb73ab["__getattr__()"] 2c74953f_f09a_25b9_cd49_d2b3d6fed35a["__init__.py"] 982d66a9_b1db_d53e_2a6b_dd75e1cb73ab -->|defined in| 2c74953f_f09a_25b9_cd49_d2b3d6fed35a 4f9a38f1_df10_1e30_d622_27578eaf8c4f["get_type_to_cls_dict()"] 982d66a9_b1db_d53e_2a6b_dd75e1cb73ab -->|calls| 4f9a38f1_df10_1e30_d622_27578eaf8c4f style 982d66a9_b1db_d53e_2a6b_dd75e1cb73ab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/llms/__init__.py lines 530–551
def __getattr__(name: str) -> Any:
from langchain_community import llms
# If not in interactive env, raise warning.
if not is_interactive_env():
warnings.warn(
"Importing LLMs from langchain is deprecated. Importing from "
"langchain will no longer be supported as of langchain==0.2.0. "
"Please import from langchain-community instead:\n\n"
f"`from langchain_community.llms import {name}`.\n\n"
"To install langchain-community run `pip install -U langchain-community`.",
stacklevel=2,
category=LangChainDeprecationWarning,
)
if name == "type_to_cls_dict":
# for backwards compatibility
type_to_cls_dict: dict[str, type[BaseLLM]] = {
k: v() for k, v in get_type_to_cls_dict().items()
}
return type_to_cls_dict
return getattr(llms, name)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does __getattr__() do?
__getattr__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/llms/__init__.py.
Where is __getattr__() defined?
__getattr__() is defined in libs/langchain/langchain_classic/llms/__init__.py at line 530.
What does __getattr__() call?
__getattr__() calls 1 function(s): get_type_to_cls_dict.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free