langchain_core.utils.iter
.tee_peerΒΆ
- langchain_core.utils.iter.tee_peer(iterator: Iterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: ContextManager[Any]) Generator[T, None, 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 (Iterator[T]) β The shared iterator.
buffer (Deque[T]) β The buffer for this peer.
peers (List[Deque[T]]) β The buffers of all peers.
lock (ContextManager[Any]) β The lock to synchronise access to the shared buffers.
- Yields
The next item from the shared iterator.
- Return type
Generator[T, None, None]