Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  03b5faf2_3e8a_cb97_542d_fe082c169caa["__init__()"]
  5ebe56ae_0ac8_cb13_b5a9_ee567b924009["BaseTool"]
  03b5faf2_3e8a_cb97_542d_fe082c169caa -->|defined in| 5ebe56ae_0ac8_cb13_b5a9_ee567b924009
  style 03b5faf2_3e8a_cb97_542d_fe082c169caa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 533–551

    def __init__(self, **kwargs: Any) -> None:
        """Initialize the tool.

        Raises:
            TypeError: If `args_schema` is not a subclass of pydantic `BaseModel` or
                `dict`.
        """
        if (
            "args_schema" in kwargs
            and kwargs["args_schema"] is not None
            and not is_basemodel_subclass(kwargs["args_schema"])
            and not isinstance(kwargs["args_schema"], dict)
        ):
            msg = (
                "args_schema must be a subclass of pydantic BaseModel or "
                f"a JSON schema dict. Got: {kwargs['args_schema']}."
            )
            raise TypeError(msg)
        super().__init__(**kwargs)

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/tools/base.py at line 533.

Analyze Your Own Codebase

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

Try Supermodel Free