__call__() — langchain Function Reference
Architecture documentation for the __call__() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3e884c1e_b5b9_62f5_9953_83e5f43a0de9["__call__()"] 878fd31a_61cf_3199_2764_5308cc207a9b["TextAccessor"] 3e884c1e_b5b9_62f5_9953_83e5f43a0de9 -->|defined in| 878fd31a_61cf_3199_2764_5308cc207a9b 100b1f91_cae4_8f2d_9794_0b9d1badef48["text()"] 3e884c1e_b5b9_62f5_9953_83e5f43a0de9 -->|calls| 100b1f91_cae4_8f2d_9794_0b9d1badef48 style 3e884c1e_b5b9_62f5_9953_83e5f43a0de9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/base.py lines 68–90
def __call__(self) -> str:
"""Enable method-style text access for backward compatibility.
This method exists solely to support legacy code that calls `.text()`
as a method. New code should use property access (`.text`) instead.
!!! deprecated
As of `langchain-core` 1.0.0, calling `.text()` as a method is deprecated.
Use `.text` as a property instead. This method will be removed in 2.0.0.
Returns:
The string content, identical to property access.
"""
warn_deprecated(
since="1.0.0",
message=(
"Calling .text() as a method is deprecated. "
"Use .text as a property instead (e.g., message.text)."
),
removal="2.0.0",
)
return str(self)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does __call__() do?
__call__() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/base.py.
Where is __call__() defined?
__call__() is defined in libs/core/langchain_core/messages/base.py at line 68.
What does __call__() call?
__call__() calls 1 function(s): text.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free