Home / Function/ __getattr__() — langchain Function Reference

__getattr__() — langchain Function Reference

Architecture documentation for the __getattr__() function in __init__.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  73c496e4_20e9_8b20_0d00_6df4ab5e4713["__getattr__()"]
  e6fb3243_0be2_18e8_1940_6ba98918b322["__init__.py"]
  73c496e4_20e9_8b20_0d00_6df4ab5e4713 -->|defined in| e6fb3243_0be2_18e8_1940_6ba98918b322
  00ec255b_380b_5f24_c759_90bab4b450cc["_import_python_tool_python_ast_repl_tool()"]
  73c496e4_20e9_8b20_0d00_6df4ab5e4713 -->|calls| 00ec255b_380b_5f24_c759_90bab4b450cc
  2d8ed320_2777_4356_7df1_a84df3ddc544["_import_python_tool_python_repl_tool()"]
  73c496e4_20e9_8b20_0d00_6df4ab5e4713 -->|calls| 2d8ed320_2777_4356_7df1_a84df3ddc544
  style 73c496e4_20e9_8b20_0d00_6df4ab5e4713 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/tools/__init__.py lines 52–72

def __getattr__(name: str) -> Any:
    if name == "PythonAstREPLTool":
        return _import_python_tool_python_ast_repl_tool()
    if name == "PythonREPLTool":
        return _import_python_tool_python_repl_tool()
    from langchain_community import tools

    # If not in interactive env, raise warning.
    if not is_interactive_env():
        warnings.warn(
            "Importing tools 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.tools import {name}`.\n\n"
            "To install langchain-community run "
            "`pip install -U langchain-community`.",
            stacklevel=2,
            category=LangChainDeprecationWarning,
        )

    return getattr(tools, name)

Domain

Subdomains

Frequently Asked Questions

What does __getattr__() do?
__getattr__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/tools/__init__.py.
Where is __getattr__() defined?
__getattr__() is defined in libs/langchain/langchain_classic/tools/__init__.py at line 52.
What does __getattr__() call?
__getattr__() calls 2 function(s): _import_python_tool_python_ast_repl_tool, _import_python_tool_python_repl_tool.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free