Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in passthrough.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a7395c9a_16f3_faf2_a9ed_1f53beec94c4["__init__()"]
  915f0e72_2130_6a8d_6929_3a7528446033["RunnablePassthrough"]
  a7395c9a_16f3_faf2_a9ed_1f53beec94c4 -->|defined in| 915f0e72_2130_6a8d_6929_3a7528446033
  style a7395c9a_16f3_faf2_a9ed_1f53beec94c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/passthrough.py lines 153–178

    def __init__(
        self,
        func: Callable[[Other], None]
        | Callable[[Other, RunnableConfig], None]
        | Callable[[Other], Awaitable[None]]
        | Callable[[Other, RunnableConfig], Awaitable[None]]
        | None = None,
        afunc: Callable[[Other], Awaitable[None]]
        | Callable[[Other, RunnableConfig], Awaitable[None]]
        | None = None,
        *,
        input_type: type[Other] | None = None,
        **kwargs: Any,
    ) -> None:
        """Create a `RunnablePassthrough`.

        Args:
            func: Function to be called with the input.
            afunc: Async function to be called with the input.
            input_type: Type of the input.
        """
        if inspect.iscoroutinefunction(func):
            afunc = func
            func = None

        super().__init__(func=func, afunc=afunc, input_type=input_type, **kwargs)

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/passthrough.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/runnables/passthrough.py at line 153.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free