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)
| 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, |