langchain_core.runnables.utils.gather_with_concurrency¶

async langchain_core.runnables.utils.gather_with_concurrency(n: Optional[int], *coros: Coroutine) list[source]¶

Gather coroutines with a limit on the number of concurrent coroutines.

Parameters
  • n (Optional[int]) – The number of coroutines to run concurrently.

  • coros (Coroutine) – The coroutines to run.

Returns

The results of the coroutines.

Return type

list