
    qi                         d Z ddlmZ ddlmZ ddlmZ ddlmZ erddl	m
Z
mZ e G d d             Ze G d	 d
             Z G d de      Zy)a$  Base observer classes for monitoring frame flow in the Pipecat pipeline.

This module provides the foundation for observing frame transfers between
processors without modifying the pipeline structure. Observers can be used
for logging, debugging, analytics, and monitoring pipeline behavior.
    )	dataclass)TYPE_CHECKING)Frame)
BaseObject)FrameDirectionFrameProcessorc                   :    e Zd ZU dZded<   eed<   ded<   eed<   y)	FrameProcesseda/  Event data for frame processing in the pipeline.

    Represents an event where a frame is being processed by a processor. This
    data structure is typically used by observers to track the flow of frames
    through the pipeline for logging, debugging, or analytics purposes.

    Parameters:
        processor: The processor processing the frame.
        frame: The frame being processed.
        direction: The direction of the frame (e.g., downstream or upstream).
        timestamp: The time when the frame was pushed, based on the pipeline clock.

    r   	processorframer   	direction	timestampN__name__
__module____qualname____doc____annotations__r   int     Q/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/observers/base_observer.pyr
   r
      s      LNr   r
   c                   D    e Zd ZU dZded<   ded<   eed<   ded<   eed<   y	)
FramePusheda  Event data for frame transfers between processors in the pipeline.

    Represents an event where a frame is pushed from one processor to another
    within the pipeline. This data structure is typically used by observers
    to track the flow of frames through the pipeline for logging, debugging,
    or analytics purposes.

    Parameters:
        source: The processor sending the frame.
        destination: The processor receiving the frame.
        frame: The frame being transferred.
        direction: The direction of the transfer (e.g., downstream or upstream).
        timestamp: The time when the frame was pushed, based on the pipeline clock.
    r   sourcedestinationr   r   r   r   Nr   r   r   r   r   r   /   s%     !!LNr   r   c                   .    e Zd ZdZdefdZdefdZd Zy)BaseObserveraB  Base class for pipeline frame observers.

    Observers can view all frames that flow through the pipeline without
    needing to inject processors into the pipeline structure. This enables
    non-intrusive monitoring capabilities such as frame logging, debugging,
    performance analysis, and analytics collection.
    datac                    K   yw)ad  Handle the event when a frame is being processed by a processor.

        This method should be implemented by subclasses to define specific
        behavior (e.g., logging, monitoring, debugging) when a frame is
        being processed by a processor.

        Args:
            data: The event data containing details about the frame processing.
        Nr   selfr   s     r   on_process_framezBaseObserver.on_process_frameP         	   c                    K   yw)aj  Handle the event when a frame is pushed from one processor to another.

        This method should be implemented by subclasses to define specific
        behavior (e.g., logging, monitoring, debugging) when a frame is
        transferred through the pipeline.

        Args:
            data: The event data containing details about the frame transfer.
        Nr   r!   s     r   on_push_framezBaseObserver.on_push_frame\   r$   r%   c                    K   yw)zCalled when the pipeline has fully started.

        Fired after the ``StartFrame`` has been processed by all processors
        in the pipeline, including nested ``ParallelPipeline`` branches.
        Nr   )r"   s    r   on_pipeline_startedz BaseObserver.on_pipeline_startedh   s      	r%   N)	r   r   r   r   r
   r#   r   r'   r)   r   r   r   r   r   G   s$    
> 

 
r   r   N)r   dataclassesr   typing_extensionsr   pipecat.frames.framesr   pipecat.utils.base_objectr   "pipecat.processors.frame_processorr   r   r
   r   r   r   r   r   <module>r/      s\    " + ' 0Q   *   .': 'r   