mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
docs: Add in code documentation to core Runnable map methods (docs only) (#19517)
- **Issue:** #18804 - @baskaryan, @eyurtsev
This commit is contained in:
parent
0199b73188
commit
c93d4ea91c
@ -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,
|
Return a new Runnable that maps a list of inputs to a list of outputs,
|
||||||
by calling invoke() with each input.
|
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)
|
return RunnableEach(bound=self)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user