
    qi                     V    d Z ddlmZ ddlmZmZ ddlmZmZ ddl	m
Z
  G d de      Zy)	zTranscription logging observer for Pipecat.

This module provides an observer that logs transcription frames to the console,
allowing developers to monitor speech-to-text activity in real-time.
    )logger)InterimTranscriptionFrameTranscriptionFrame)BaseObserverFramePushed)
STTServicec                       e Zd ZdZdefdZy)TranscriptionLogObservera  Observer to log transcription activity to the console.

    Monitors and logs all transcription frames from STT services, including
    both final transcriptions and interim results. This allows developers
    to track speech recognition activity and debug transcription issues.

    Only processes frames from STTService instances to avoid logging
    unrelated transcription frames from other sources.
    datac                   K   |j                   }|j                  }|j                  }t        |t              sy|dz  }d}t        |t
              r;t        j                  d| d| d|j                  d|j                  d|d	d
       yt        |t              r;t        j                  d| d| d|j                  d|j                  d|d	d
       yyw)a-  Handle frame push events and log transcription frames.

        Logs TranscriptionFrame and InterimTranscriptionFrame instances
        with timestamps and user information for debugging purposes.

        Args:
            data: Frame push event data containing source, frame, and timestamp.
        Ni ʚ;u   →u   💬  z TRANSCRIPTION: z from z at z.2fsz INTERIM TRANSCRIPTION: )sourceframe	timestamp
isinstancer   r   r   debugtextuser_idr   )selfr   srcr   r   time_secarrows          f/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/observers/loggers/transcription_log_observer.pyon_push_framez&TranscriptionLogObserver.on_push_frame"   s      kk

NN	#z*},e/0LLuAeW$4UZZN&HYY]^fgj]kklm 89LLuAeW$<UZZN&QVQ^Q^Paaefnoresstu :s   CCN)__name__
__module____qualname____doc__r   r        r   r
   r
      s     r!   r
   N)r   logurur   pipecat.frames.framesr   r   pipecat.observers.base_observerr   r   pipecat.services.stt_servicer   r
   r    r!   r   <module>r&      s)     F 3&| &r!   