__init__() — langchain Function Reference
Architecture documentation for the __init__() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ec934977_7e1f_106e_289e_bc5d17bc0941["__init__()"] 9a777f9f_fc96_a4c7_ebd5_632b655b53ae["RunnableBindingBase"] ec934977_7e1f_106e_289e_bc5d17bc0941 -->|defined in| 9a777f9f_fc96_a4c7_ebd5_632b655b53ae style ec934977_7e1f_106e_289e_bc5d17bc0941 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 5577–5621
def __init__(
self,
*,
bound: Runnable[Input, Output],
kwargs: Mapping[str, Any] | None = None,
config: RunnableConfig | None = None,
config_factories: list[Callable[[RunnableConfig], RunnableConfig]]
| None = None,
custom_input_type: type[Input] | BaseModel | None = None,
custom_output_type: type[Output] | BaseModel | None = None,
**other_kwargs: Any,
) -> None:
"""Create a `RunnableBinding` from a `Runnable` and kwargs.
Args:
bound: The underlying `Runnable` that this `Runnable` delegates calls
to.
kwargs: optional kwargs to pass to the underlying `Runnable`, when running
the underlying `Runnable` (e.g., via `invoke`, `batch`,
`transform`, or `stream` or async variants)
config: optional config to bind to the underlying `Runnable`.
config_factories: optional list of config factories to apply to the
config before binding to the underlying `Runnable`.
custom_input_type: Specify to override the input type of the underlying
`Runnable` with a custom type.
custom_output_type: Specify to override the output type of the underlying
`Runnable` with a custom type.
**other_kwargs: Unpacked into the base class.
"""
super().__init__(
bound=bound,
kwargs=kwargs or {},
config=config or {},
config_factories=config_factories or [],
custom_input_type=custom_input_type,
custom_output_type=custom_output_type,
**other_kwargs,
)
# if we don't explicitly set config to the TypedDict here,
# the pydantic init above will strip out any of the "extra"
# fields even though total=False on the typed dict.
self.config = config or {}
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/runnables/base.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/runnables/base.py at line 5577.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free