Home / Function/ close() — langchain Function Reference

close() — langchain Function Reference

Architecture documentation for the close() function in memory_stream.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb5a6b4f_2632_0263_f468_8f47c97e899b["close()"]
  c43da4ed_d8f0_59cc_df49_f7213014b828["_SendStream"]
  bb5a6b4f_2632_0263_f468_8f47c97e899b -->|defined in| c43da4ed_d8f0_59cc_df49_f7213014b828
  3328c663_3336_3009_899f_e83481594b28["aclose()"]
  3328c663_3336_3009_899f_e83481594b28 -->|calls| bb5a6b4f_2632_0263_f468_8f47c97e899b
  style bb5a6b4f_2632_0263_f468_8f47c97e899b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/memory_stream.py lines 70–83

    def close(self) -> None:
        """Schedule the done object write the queue using the original loop.

        This is a non-blocking call.

        Raises:
            RuntimeError: If the event loop is already closed when trying to write to
                the queue.
        """
        try:
            self._reader_loop.call_soon_threadsafe(self._queue.put_nowait, self._done)
        except RuntimeError:
            if not self._reader_loop.is_closed():
                raise  # Raise the exception if the loop is not closed

Domain

Subdomains

Called By

Frequently Asked Questions

What does close() do?
close() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/memory_stream.py.
Where is close() defined?
close() is defined in libs/core/langchain_core/tracers/memory_stream.py at line 70.
What calls close()?
close() is called by 1 function(s): aclose.

Analyze Your Own Codebase

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

Try Supermodel Free