Home / Function/ _acall_with_config() — langchain Function Reference

_acall_with_config() — langchain Function Reference

Architecture documentation for the _acall_with_config() function in base.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  ff3f8c90_5747_1a07_b1bc_281329a48e05["_acall_with_config()"]
  4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"]
  ff3f8c90_5747_1a07_b1bc_281329a48e05 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6
  7fed436b_52e0_4f79_f598_6f60f32e841c["ainvoke()"]
  7fed436b_52e0_4f79_f598_6f60f32e841c -->|calls| ff3f8c90_5747_1a07_b1bc_281329a48e05
  edf9c318_99c3_0d74_c0ca_494e69f2dd47["ainvoke()"]
  edf9c318_99c3_0d74_c0ca_494e69f2dd47 -->|calls| ff3f8c90_5747_1a07_b1bc_281329a48e05
  255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"]
  ff3f8c90_5747_1a07_b1bc_281329a48e05 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5
  style ff3f8c90_5747_1a07_b1bc_281329a48e05 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 2076–2117

    async def _acall_with_config(
        self,
        func: Callable[[Input], Awaitable[Output]]
        | Callable[[Input, AsyncCallbackManagerForChainRun], Awaitable[Output]]
        | Callable[
            [Input, AsyncCallbackManagerForChainRun, RunnableConfig], Awaitable[Output]
        ],
        input_: Input,
        config: RunnableConfig | None,
        run_type: str | None = None,
        serialized: dict[str, Any] | None = None,
        **kwargs: Any | None,
    ) -> Output:
        """Async call with config.

        Helper method to transform an `Input` value to an `Output` value,
        with callbacks.

        Use this method to implement `ainvoke` in subclasses.
        """
        config = ensure_config(config)
        callback_manager = get_async_callback_manager_for_config(config)
        run_manager = await callback_manager.on_chain_start(
            serialized,
            input_,
            run_type=run_type,
            name=config.get("run_name") or self.get_name(),
            run_id=config.pop("run_id", None),
        )
        try:
            child_config = patch_config(config, callbacks=run_manager.get_child())
            with set_config_context(child_config) as context:
                coro = acall_func_with_variable_args(
                    func, input_, config, run_manager, **kwargs
                )
                output: Output = await coro_with_context(coro, context)
        except BaseException as e:
            await run_manager.on_chain_error(e)
            raise
        else:
            await run_manager.on_chain_end(output)
            return output

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does _acall_with_config() do?
_acall_with_config() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is _acall_with_config() defined?
_acall_with_config() is defined in libs/core/langchain_core/runnables/base.py at line 2076.
What does _acall_with_config() call?
_acall_with_config() calls 1 function(s): get_name.
What calls _acall_with_config()?
_acall_with_config() is called by 2 function(s): ainvoke, ainvoke.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free