Home / Class/ _ReceiveStream Class — langchain Architecture

_ReceiveStream Class — langchain Architecture

Architecture documentation for the _ReceiveStream class in memory_stream.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4e85fdb3_7485_e6f8_5530_4f66c4e5ca5a["_ReceiveStream"]
  3f0634aa_cb85_70ef_d7c0_8f2e7cb923b8["memory_stream.py"]
  4e85fdb3_7485_e6f8_5530_4f66c4e5ca5a -->|defined in| 3f0634aa_cb85_70ef_d7c0_8f2e7cb923b8
  57fefa52_1b69_5234_a232_cc530d2d3b2f["__init__()"]
  4e85fdb3_7485_e6f8_5530_4f66c4e5ca5a -->|method| 57fefa52_1b69_5234_a232_cc530d2d3b2f
  1b4a8135_249c_e861_7544_55eaacf09ce1["__aiter__()"]
  4e85fdb3_7485_e6f8_5530_4f66c4e5ca5a -->|method| 1b4a8135_249c_e861_7544_55eaacf09ce1

Relationship Graph

Source Code

libs/core/langchain_core/tracers/memory_stream.py lines 86–103

class _ReceiveStream(Generic[T]):
    def __init__(self, queue: Queue, done: object) -> None:
        """Create a reader for the queue and done object.

        This reader should be used in the same loop as the loop that was passed to the
        channel.
        """
        self._queue = queue
        self._done = done
        self._is_closed = False

    async def __aiter__(self) -> AsyncIterator[T]:
        while True:
            item = await self._queue.get()
            if item is self._done:
                self._is_closed = True
                break
            yield item

Frequently Asked Questions

What is the _ReceiveStream class?
_ReceiveStream is a class in the langchain codebase, defined in libs/core/langchain_core/tracers/memory_stream.py.
Where is _ReceiveStream defined?
_ReceiveStream is defined in libs/core/langchain_core/tracers/memory_stream.py at line 86.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free