_arun_chain() — langchain Function Reference
Architecture documentation for the _arun_chain() function in runner_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9b0e22db_68ee_87da_3140_8fa034a95ee3["_arun_chain()"] 8253c602_7d0c_9195_a7e1_3e9b19304131["runner_utils.py"] 9b0e22db_68ee_87da_3140_8fa034a95ee3 -->|defined in| 8253c602_7d0c_9195_a7e1_3e9b19304131 f3487723_0da7_fd94_b3c8_cdac21cf7e23["_arun_llm_or_chain()"] f3487723_0da7_fd94_b3c8_cdac21cf7e23 -->|calls| 9b0e22db_68ee_87da_3140_8fa034a95ee3 style 9b0e22db_68ee_87da_3140_8fa034a95ee3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/smith/evaluation/runner_utils.py lines 767–800
async def _arun_chain(
chain: Chain | Runnable,
inputs: dict[str, Any],
callbacks: Callbacks,
*,
tags: list[str] | None = None,
input_mapper: Callable[[dict], Any] | None = None,
metadata: dict[str, Any] | None = None,
) -> dict | str:
"""Run a chain asynchronously on inputs."""
inputs_ = inputs if input_mapper is None else input_mapper(inputs)
if (
isinstance(chain, Chain)
and isinstance(inputs_, dict)
and len(inputs_) == 1
and chain.input_keys
):
val = next(iter(inputs_.values()))
output = await chain.ainvoke(
val,
config=RunnableConfig(
callbacks=callbacks,
tags=tags or [],
metadata=metadata or {},
),
)
else:
runnable_config = RunnableConfig(
tags=tags or [],
callbacks=callbacks,
metadata=metadata or {},
)
output = await chain.ainvoke(inputs_, config=runnable_config)
return output
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _arun_chain() do?
_arun_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/smith/evaluation/runner_utils.py.
Where is _arun_chain() defined?
_arun_chain() is defined in libs/langchain/langchain_classic/smith/evaluation/runner_utils.py at line 767.
What calls _arun_chain()?
_arun_chain() is called by 1 function(s): _arun_llm_or_chain.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free