Home / Function/ _ainvoke() — langchain Function Reference

_ainvoke() — langchain Function Reference

Architecture documentation for the _ainvoke() function in retry.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2547348e_7cd5_195f_d5d3_cbe68344929a["_ainvoke()"]
  dcb89960_9531_c0ae_7764_c192a29f52c0["RunnableRetry"]
  2547348e_7cd5_195f_d5d3_cbe68344929a -->|defined in| dcb89960_9531_c0ae_7764_c192a29f52c0
  a05cbbdd_13ef_9d8b_5022_8f9b0a46c86a["_async_retrying()"]
  2547348e_7cd5_195f_d5d3_cbe68344929a -->|calls| a05cbbdd_13ef_9d8b_5022_8f9b0a46c86a
  9efc1d1c_fe0c_3ced_4e9c_39e7311c06af["_patch_config()"]
  2547348e_7cd5_195f_d5d3_cbe68344929a -->|calls| 9efc1d1c_fe0c_3ced_4e9c_39e7311c06af
  8602ffdb_2ded_ea4a_3459_0b066c02e2bf["ainvoke()"]
  2547348e_7cd5_195f_d5d3_cbe68344929a -->|calls| 8602ffdb_2ded_ea4a_3459_0b066c02e2bf
  style 2547348e_7cd5_195f_d5d3_cbe68344929a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/retry.py lines 203–219

    async def _ainvoke(
        self,
        input_: Input,
        run_manager: "AsyncCallbackManagerForChainRun",
        config: RunnableConfig,
        **kwargs: Any,
    ) -> Output:
        async for attempt in self._async_retrying(reraise=True):
            with attempt:
                result = await super().ainvoke(
                    input_,
                    self._patch_config(config, run_manager, attempt.retry_state),
                    **kwargs,
                )
            if attempt.retry_state.outcome and not attempt.retry_state.outcome.failed:
                attempt.retry_state.set_result(result)
        return result

Domain

Subdomains

Frequently Asked Questions

What does _ainvoke() do?
_ainvoke() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/retry.py.
Where is _ainvoke() defined?
_ainvoke() is defined in libs/core/langchain_core/runnables/retry.py at line 203.
What does _ainvoke() call?
_ainvoke() calls 3 function(s): _async_retrying, _patch_config, ainvoke.

Analyze Your Own Codebase

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

Try Supermodel Free