__init__() — langchain Function Reference
Architecture documentation for the __init__() function in chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c459ef0a_6231_646f_10d2_50f7028a3e0d["__init__()"] c5f45b6e_9126_7fa3_ba5a_e6a86d45b6d5["MessagesPlaceholder"] c459ef0a_6231_646f_10d2_50f7028a3e0d -->|defined in| c5f45b6e_9126_7fa3_ba5a_e6a86d45b6d5 style c459ef0a_6231_646f_10d2_50f7028a3e0d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/chat.py lines 144–161
def __init__(
self, variable_name: str, *, optional: bool = False, **kwargs: Any
) -> None:
"""Create a messages placeholder.
Args:
variable_name: Name of variable to use as messages.
optional: Whether `format_messages` must be provided.
If `True` format_messages can be called with no arguments and will
return an empty list.
If `False` then a named argument with name `variable_name` must be
passed in, even if the value is an empty list.
"""
# mypy can't detect the init which is defined in the parent class
# b/c these are BaseModel classes.
super().__init__(variable_name=variable_name, optional=optional, **kwargs) # type: ignore[call-arg,unused-ignore]
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/chat.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/prompts/chat.py at line 144.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free