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-coreutilsaitertee_peer
    Function●Since v0.1

    tee_peer

    Copy
    tee_peer(
      iterator: AsyncIterator[T],
      buffer: deque[T],
      peers: 
    View source on GitHub
    list
    [
    deque
    [
    T
    ]
    ]
    ,
    lock
    :
    AbstractAsyncContextManager
    [
    Any
    ]
    )
    ->
    AsyncGenerator
    [
    T
    ,
    None
    ]

    Parameters

    NameTypeDescription
    iterator*AsyncIterator[T]

    The shared iterator.

    buffer*deque[T]

    The buffer for this peer.

    peers*list[deque[T]]
    lock*AbstractAsyncContextManager[Any]

    An individual iterator of a tee.

    This function is a generator that yields items from the shared iterator iterator. It buffers items until the least advanced iterator has yielded them as well.

    The buffer is shared with all other peers.

    The buffers of all peers.

    The lock to synchronise access to the shared buffers.