langchain_core.runnables.config.run_in_executor

async langchain_core.runnables.config.run_in_executor(executor_or_config: ~typing.Optional[~typing.Union[~concurrent.futures._base.Executor, ~langchain_core.runnables.config.RunnableConfig]], func: ~typing.Callable[[~P], ~langchain_core.runnables.config.T], *args: ~typing.~P, **kwargs: ~typing.~P) T[source]

Run a function in an executor.

Parameters
  • executor (Executor) – The executor.

  • func (Callable[P, Output]) – The function.

  • *args (Any) – The positional arguments to the function.

  • **kwargs (Any) – The keyword arguments to the function.

  • executor_or_config (Optional[Union[Executor, RunnableConfig]]) –

Returns

The output of the function.

Return type

Output

Examples using run_in_executor