MCPcopy
hub / github.com/langchain-ai/langchain / map

Method map

libs/core/langchain_core/runnables/base.py:1495–1512  ·  view source on GitHub ↗

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:

(self)

Source from the content-addressed store, hash-verified

1493 )
1494
1495 def map(self) -> Runnable[List[Input], List[Output]]:
1496 """
1497 Return a new Runnable that maps a list of inputs to a list of outputs,
1498 by calling invoke() with each input.
1499
1500 Example:
1501
1502 .. code-block:: python
1503
1504 from langchain_core.runnables import RunnableLambda
1505
1506 def _lambda(x: int) -> int:
1507 return x + 1
1508
1509 runnable = RunnableLambda(_lambda)
1510 print(runnable.map().invoke([1, 2, 3])) # [2, 3, 4]
1511 """
1512 return RunnableEach(bound=self)
1513
1514 def with_fallbacks(
1515 self,

Callers 15

chain.pyFile · 0.45
web.pyFile · 0.45
chain.pyFile · 0.45
web.pyFile · 0.45
test_runnable_eachFunction · 0.45
test_runnable_eachFunction · 0.45
test_schemasFunction · 0.45
test_each_simpleFunction · 0.45
test_eachFunction · 0.45
test_listenersFunction · 0.45
test_listeners_asyncFunction · 0.45
batchMethod · 0.45

Calls 1

RunnableEachClass · 0.85

Tested by 7

test_runnable_eachFunction · 0.36
test_runnable_eachFunction · 0.36
test_schemasFunction · 0.36
test_each_simpleFunction · 0.36
test_eachFunction · 0.36
test_listenersFunction · 0.36
test_listeners_asyncFunction · 0.36