Home / Class/ _StreamingCallbackHandler Class — langchain Architecture

_StreamingCallbackHandler Class — langchain Architecture

Architecture documentation for the _StreamingCallbackHandler class in _streaming.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f3c4d153_ffb6_fec0_fa1f_e6051f9d0ac9["_StreamingCallbackHandler"]
  218cf17b_0c3f_5d2b_3f80_2250567424b6["_streaming.py"]
  f3c4d153_ffb6_fec0_fa1f_e6051f9d0ac9 -->|defined in| 218cf17b_0c3f_5d2b_3f80_2250567424b6
  adbfd2f7_1ea1_c2fb_4284_5a5c0030defe["tap_output_aiter()"]
  f3c4d153_ffb6_fec0_fa1f_e6051f9d0ac9 -->|method| adbfd2f7_1ea1_c2fb_4284_5a5c0030defe
  782defcd_382a_a7a3_e636_fd1ccdd1881c["tap_output_iter()"]
  f3c4d153_ffb6_fec0_fa1f_e6051f9d0ac9 -->|method| 782defcd_382a_a7a3_e636_fd1ccdd1881c

Relationship Graph

Source Code

libs/core/langchain_core/tracers/_streaming.py lines 12–28

class _StreamingCallbackHandler(typing.Protocol[T]):
    """Types for streaming callback handlers.

    This is a common mixin that the callback handlers for both astream events and
    astream log inherit from.

    The `tap_output_aiter` method is invoked in some contexts to produce callbacks for
    intermediate results.
    """

    def tap_output_aiter(
        self, run_id: UUID, output: AsyncIterator[T]
    ) -> AsyncIterator[T]:
        """Used for internal astream_log and astream events implementations."""

    def tap_output_iter(self, run_id: UUID, output: Iterator[T]) -> Iterator[T]:
        """Used for internal astream_log and astream events implementations."""

Frequently Asked Questions

What is the _StreamingCallbackHandler class?
_StreamingCallbackHandler is a class in the langchain codebase, defined in libs/core/langchain_core/tracers/_streaming.py.
Where is _StreamingCallbackHandler defined?
_StreamingCallbackHandler is defined in libs/core/langchain_core/tracers/_streaming.py at line 12.

Analyze Your Own Codebase

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

Try Supermodel Free