internal.py — langchain Source File
Architecture documentation for internal.py, a python file in the langchain codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 290f5681_b84a_eee0_617a_5338bac15f9f["internal.py"] 614e7b9f_ed51_0780_749c_ff40b74963fc["inspect"] 290f5681_b84a_eee0_617a_5338bac15f9f --> 614e7b9f_ed51_0780_749c_ff40b74963fc 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 290f5681_b84a_eee0_617a_5338bac15f9f --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 style 290f5681_b84a_eee0_617a_5338bac15f9f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import inspect
from typing import cast
def is_caller_internal(depth: int = 2) -> bool:
"""Return whether the caller at `depth` of this function is internal."""
try:
frame = inspect.currentframe()
except AttributeError:
return False
if frame is None:
return False
try:
for _ in range(depth):
frame = frame.f_back
if frame is None:
return False
# Directly access the module name from the frame's global variables
module_globals = frame.f_globals
caller_module_name = cast("str", module_globals.get("__name__", ""))
return caller_module_name.startswith("langchain")
finally:
del frame
Domain
Subdomains
Functions
Dependencies
- inspect
- typing
Source
Frequently Asked Questions
What does internal.py do?
internal.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in internal.py?
internal.py defines 1 function(s): is_caller_internal.
What does internal.py depend on?
internal.py imports 2 module(s): inspect, typing.
Where is internal.py in the architecture?
internal.py is located at libs/core/langchain_core/_api/internal.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/_api).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free