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
)
| 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, |