map() — langchain Function Reference
Architecture documentation for the map() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cb51eea6_993b_93b2_5bc8_da36e6fac2df["map()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] cb51eea6_993b_93b2_5bc8_da36e6fac2df -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 2826dfcf_5024_bd4d_0268_8f909fbbae0c["batch()"] 2826dfcf_5024_bd4d_0268_8f909fbbae0c -->|calls| cb51eea6_993b_93b2_5bc8_da36e6fac2df 3e736ea3_30ef_68c3_5f32_b8a49b37d501["abatch()"] 3e736ea3_30ef_68c3_5f32_b8a49b37d501 -->|calls| cb51eea6_993b_93b2_5bc8_da36e6fac2df style cb51eea6_993b_93b2_5bc8_da36e6fac2df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 1924–1945
def map(self) -> Runnable[list[Input], list[Output]]:
"""Return a new `Runnable` that maps a list of inputs to a list of outputs.
Calls `invoke` with each input.
Returns:
A new `Runnable` that maps a list of inputs to a list of outputs.
Example:
```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)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does map() do?
map() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is map() defined?
map() is defined in libs/core/langchain_core/runnables/base.py at line 1924.
What calls map()?
map() is called by 2 function(s): abatch, batch.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free