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
  a2a604be_cc09_7f07_e108_c5ebabcf6c97["__getattr__()"]
  f7733e37_7bc2_27d0_0a65_938fa3eb8ccd["__init__.py"]
  a2a604be_cc09_7f07_e108_c5ebabcf6c97 -->|defined in| f7733e37_7bc2_27d0_0a65_938fa3eb8ccd
  style a2a604be_cc09_7f07_e108_c5ebabcf6c97 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/__init__.py lines 99–118

def __getattr__(name: str) -> Any:
    """Get attr name."""
    if name in DEPRECATED_CODE:
        # Get directory of langchain package
        here = Path(__file__).parents[1]
        relative_path = as_import_path(
            Path(__file__).parent,
            suffix=name,
            relative_to=here,
        )
        old_path = "langchain_classic." + relative_path
        new_path = "langchain_experimental." + relative_path
        msg = (
            f"{name} has been moved to langchain_experimental. "
            "See https://github.com/langchain-ai/langchain/discussions/11680"
            "for more information.\n"
            f"Please update your import statement from: `{old_path}` to `{new_path}`."
        )
        raise ImportError(msg)
    return _import_attribute(name)

Subdomains

Frequently Asked Questions

What does __getattr__() do?
__getattr__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/__init__.py.
Where is __getattr__() defined?
__getattr__() is defined in libs/langchain/langchain_classic/agents/__init__.py at line 99.

Analyze Your Own Codebase

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

Try Supermodel Free