__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR e6fb3243_0be2_18e8_1940_6ba98918b322["__init__.py"] f3365e3c_fb7a_bb9a_bc79_059b06cb7024["warnings"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> f3365e3c_fb7a_bb9a_bc79_059b06cb7024 feec1ec4_6917_867b_d228_b134d0ff8099["typing"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> feec1ec4_6917_867b_d228_b134d0ff8099 2485b66a_3839_d0b6_ad9c_a4ff40457dc6["langchain_core._api"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> 2485b66a_3839_d0b6_ad9c_a4ff40457dc6 121262a1_0bd6_d637_bce3_307ab6b3ecd4["langchain_core.tools"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> 121262a1_0bd6_d637_bce3_307ab6b3ecd4 c5649f9c_3563_1d74_faa0_63080cd4757e["langchain_core.tools.convert"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> c5649f9c_3563_1d74_faa0_63080cd4757e 064a3e08_287a_0c59_7629_2417af02571b["langchain_classic._api.interactive_env"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> 064a3e08_287a_0c59_7629_2417af02571b 79b89fb5_5abc_b897_6fdc_8f992e452824["langchain_community"] e6fb3243_0be2_18e8_1940_6ba98918b322 --> 79b89fb5_5abc_b897_6fdc_8f992e452824 style e6fb3243_0be2_18e8_1940_6ba98918b322 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""**Tools** are classes that an Agent uses to interact with the world.
Each tool has a **description**. Agent uses the description to choose the right
tool for the job.
"""
import warnings
from typing import Any
from langchain_core._api import LangChainDeprecationWarning
from langchain_core.tools import (
BaseTool as BaseTool,
)
from langchain_core.tools import (
StructuredTool as StructuredTool,
)
from langchain_core.tools import (
Tool as Tool,
)
from langchain_core.tools.convert import tool as tool
from langchain_classic._api.interactive_env import is_interactive_env
# Used for internal purposes
_DEPRECATED_TOOLS = {"PythonAstREPLTool", "PythonREPLTool"}
def _import_python_tool_python_ast_repl_tool() -> Any:
msg = (
"This tool has been moved to langchain_experimental. "
"This tool has access to a python REPL. "
"For best practices make sure to sandbox this tool. "
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
"To keep using this code as is, install langchain_experimental and "
"update relevant imports replacing 'langchain' with 'langchain_experimental'"
)
raise ImportError(msg)
def _import_python_tool_python_repl_tool() -> Any:
msg = (
"This tool has been moved to langchain_experimental. "
"This tool has access to a python REPL. "
"For best practices make sure to sandbox this tool. "
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
"To keep using this code as is, install langchain_experimental and "
"update relevant imports replacing 'langchain' with 'langchain_experimental'"
)
raise ImportError(msg)
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():
// ... (136 more lines)
Domain
Subdomains
Functions
Dependencies
- langchain_classic._api.interactive_env
- langchain_community
- langchain_core._api
- langchain_core.tools
- langchain_core.tools.convert
- typing
- warnings
Source
Frequently Asked Questions
What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in __init__.py?
__init__.py defines 3 function(s): __getattr__, _import_python_tool_python_ast_repl_tool, _import_python_tool_python_repl_tool.
What does __init__.py depend on?
__init__.py imports 7 module(s): langchain_classic._api.interactive_env, langchain_community, langchain_core._api, langchain_core.tools, langchain_core.tools.convert, typing, warnings.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/tools/__init__.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/langchain/langchain_classic/tools).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free