Home / Function/ ainvoke() — langchain Function Reference

ainvoke() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b48e63b1_c802_57f5_1432_79f235cc1161["ainvoke()"]
  4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"]
  b48e63b1_c802_57f5_1432_79f235cc1161 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6
  3e736ea3_30ef_68c3_5f32_b8a49b37d501["abatch()"]
  3e736ea3_30ef_68c3_5f32_b8a49b37d501 -->|calls| b48e63b1_c802_57f5_1432_79f235cc1161
  aaebaa03_c6a9_8f68_e4f1_dc9021075b9a["abatch_as_completed()"]
  aaebaa03_c6a9_8f68_e4f1_dc9021075b9a -->|calls| b48e63b1_c802_57f5_1432_79f235cc1161
  d04ee734_b887_f11d_7551_064b5b024357["astream()"]
  d04ee734_b887_f11d_7551_064b5b024357 -->|calls| b48e63b1_c802_57f5_1432_79f235cc1161
  style b48e63b1_c802_57f5_1432_79f235cc1161 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 844–865

    async def ainvoke(
        self,
        input: Input,
        config: RunnableConfig | None = None,
        **kwargs: Any,
    ) -> Output:
        """Transform a single input into an output.

        Args:
            input: The input to the `Runnable`.
            config: A config to use when invoking the `Runnable`.

                The config supports standard keys like `'tags'`, `'metadata'` for
                tracing purposes, `'max_concurrency'` for controlling how much work to
                do in parallel, and other keys.

                Please refer to `RunnableConfig` for more details.

        Returns:
            The output of the `Runnable`.
        """
        return await run_in_executor(config, self.invoke, input, config, **kwargs)

Domain

Subdomains

Frequently Asked Questions

What does ainvoke() do?
ainvoke() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is ainvoke() defined?
ainvoke() is defined in libs/core/langchain_core/runnables/base.py at line 844.
What calls ainvoke()?
ainvoke() is called by 3 function(s): abatch, abatch_as_completed, astream.

Analyze Your Own Codebase

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

Try Supermodel Free