diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py index 382d0d7efa9..b9e4e37fd70 100644 --- a/libs/core/langchain_core/runnables/base.py +++ b/libs/core/langchain_core/runnables/base.py @@ -1491,6 +1491,18 @@ class Runnable(Generic[Input, Output], ABC): """ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. + + Example: + + .. code-block:: python + + from langchain_core.runnables import RunnableLambda + + def _lambda(x: int) -> int: + return x + 1 + + runnable = RunnableLambda(_lambda) + print(runnable.map().invoke([1, 2, 3])) # [2, 3, 4] """ return RunnableEach(bound=self)