Home / Function/ __or__() — langchain Function Reference

__or__() — langchain Function Reference

Architecture documentation for the __or__() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d60be540_bbc7_8c3f_b60e_e79e1b91c9c5["__or__()"]
  4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"]
  d60be540_bbc7_8c3f_b60e_e79e1b91c9c5 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6
  24b30490_4fa3_041b_f903_38cad0c9ae9b["coerce_to_runnable()"]
  d60be540_bbc7_8c3f_b60e_e79e1b91c9c5 -->|calls| 24b30490_4fa3_041b_f903_38cad0c9ae9b
  style d60be540_bbc7_8c3f_b60e_e79e1b91c9c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 618–637

    def __or__(
        self,
        other: Runnable[Any, Other]
        | Callable[[Iterator[Any]], Iterator[Other]]
        | Callable[[AsyncIterator[Any]], AsyncIterator[Other]]
        | Callable[[Any], Other]
        | Mapping[str, Runnable[Any, Other] | Callable[[Any], Other] | Any],
    ) -> RunnableSerializable[Input, Other]:
        """Runnable "or" operator.

        Compose this `Runnable` with another object to create a
        `RunnableSequence`.

        Args:
            other: Another `Runnable` or a `Runnable`-like object.

        Returns:
            A new `Runnable`.
        """
        return RunnableSequence(self, coerce_to_runnable(other))

Domain

Subdomains

Frequently Asked Questions

What does __or__() do?
__or__() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is __or__() defined?
__or__() is defined in libs/core/langchain_core/runnables/base.py at line 618.
What does __or__() call?
__or__() calls 1 function(s): coerce_to_runnable.

Analyze Your Own Codebase

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

Try Supermodel Free