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
  e697c020_636b_ddca_335e_eb267f23e9db["__or__()"]
  c4bf8d59_69f9_f8e5_efba_837c20df2360["RunnableSequence"]
  e697c020_636b_ddca_335e_eb267f23e9db -->|defined in| c4bf8d59_69f9_f8e5_efba_837c20df2360
  24b30490_4fa3_041b_f903_38cad0c9ae9b["coerce_to_runnable()"]
  e697c020_636b_ddca_335e_eb267f23e9db -->|calls| 24b30490_4fa3_041b_f903_38cad0c9ae9b
  style e697c020_636b_ddca_335e_eb267f23e9db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 3077–3101

    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]:
        if isinstance(other, RunnableSequence):
            return RunnableSequence(
                self.first,
                *self.middle,
                self.last,
                other.first,
                *other.middle,
                other.last,
                name=self.name or other.name,
            )
        return RunnableSequence(
            self.first,
            *self.middle,
            self.last,
            coerce_to_runnable(other),
            name=self.name,
        )

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 3077.
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