tee_peer#
- async langchain_core.utils.aiter.tee_peer(iterator: AsyncIterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: AsyncContextManager[Any]) AsyncGenerator[T, None] [source]#
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.- Parameters:
iterator (AsyncIterator[T]) – The shared iterator.
buffer (Deque[T]) – The buffer for this peer.
peers (List[Deque[T]]) – The buffers of all peers.
lock (AsyncContextManager[Any]) – The lock to synchronise access to the shared buffers.
- Yields:
The next item from the shared iterator.
- Return type:
AsyncGenerator[T, None]