LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coreutilsaiterpy_anext
    Function●Since v0.1Deprecated

    py_anext

    Copy
    py_anext(
      iterator: AsyncIterator[T],
      default: T | Any = _no_default
    View source on GitHub
    )
    ->
    Awaitable
    [
    T
    |
    Any
    |
    None
    ]

    Parameters

    NameTypeDescription
    iterator*AsyncIterator[T]
    defaultT | Any
    Default:_no_default

    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.

    The async iterator to advance.

    The value to return if the iterator is exhausted.

    If not provided, a StopAsyncIteration exception is raised.