Toggle Menu
Prev Up Next

# `langchain_core.utils.aiter`.py_anext

langchain_core.utils.aiter.py_anext(iterator: ~typing.AsyncIterator[~langchain_core.utils.aiter.T], default: ~typing.Union[~langchain_core.utils.aiter.T, ~typing.Any] = <object object>) → Awaitable[Union[T, None, Any]]

  Pure-Python implementation of anext() for testing purposes.

  Closely matches the builtin anext() C implementation. Can be used to compare the built-in implementation of the inner coroutines machinery to C-implementation of __anext__() and send() or throw() on the returned generator.

  Parameters

    - iterator (AsyncIterator[T]) –

    - default (Union[T, Any]) –

  Return type

    Awaitable[Union[T, None, Any]]