MCPcopy
hub / github.com/langchain-ai/langchain / ainvoke

Method ainvoke

libs/core/langchain_core/runnables/base.py:596–606  ·  view source on GitHub ↗

Default implementation of ainvoke, calls invoke from a thread. The default implementation allows usage of async code even if the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously.

(
        self, input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

594 """
595
596 async def ainvoke(
597 self, input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any
598 ) -> Output:
599 """Default implementation of ainvoke, calls invoke from a thread.
600
601 The default implementation allows usage of async code even if
602 the runnable did not implement a native async version of invoke.
603
604 Subclasses should override this method if they can run asynchronously.
605 """
606 return await run_in_executor(config, self.invoke, input, config, **kwargs)
607
608 def batch(
609 self,

Callers 5

astreamMethod · 0.95
ainvokeMethod · 0.45
ainvokeMethod · 0.45
_ainvokeMethod · 0.45
ainvokeMethod · 0.45

Calls 1

run_in_executorFunction · 0.90

Tested by

no test coverage detected