o
    i                     @   s   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
mZmZ ddlmZmZmZ dee	 fdd	Zdee fd
dZeG dd dZeG dd deZdS )z"Turn start strategy configuration.    )	dataclass)ListOptional)LocalSmartTurnAnalyzerV3)BaseUserTurnStartStrategyExternalUserTurnStartStrategy"TranscriptionUserTurnStartStrategyVADUserTurnStartStrategy)BaseUserTurnStopStrategyExternalUserTurnStopStrategy TurnAnalyzerUserTurnStopStrategyreturnc                   C   s   t  t gS )a  Return the default user turn start strategies.

    Returns ``[VADUserTurnStartStrategy, TranscriptionUserTurnStartStrategy]``.
    Useful when building a custom strategy list that extends the defaults.

    Example::

        start_strategies = [
            WakePhraseUserTurnStartStrategy(phrases=["hey pipecat"]),
            *default_user_turn_start_strategies(),
        ]
    )r	   r    r   r   V/home/ubuntu/.local/lib/python3.10/site-packages/pipecat/turns/user_turn_strategies.py"default_user_turn_start_strategies   s   r   c                   C   s   t t dgS )zReturn the default user turn stop strategies.

    Returns ``[TurnAnalyzerUserTurnStopStrategy(LocalSmartTurnAnalyzerV3)]``.
    Useful when building a custom strategy list that extends the defaults.
    )turn_analyzer)r   r   r   r   r   r   !default_user_turn_stop_strategies*   s   r   c                   @   sB   e Zd ZU dZdZeee  ed< dZ	eee
  ed< dd ZdS )UserTurnStrategiesa  Container for user turn start and stop strategies.

    If no strategies are specified, the following defaults are used:

        start: [VADUserTurnStartStrategy, TranscriptionUserTurnStartStrategy]
         stop: [TurnAnalyzerUserTurnStopStrategy(LocalSmartTurnAnalyzerV3)]

    Attributes:
        start: A list of user turn start strategies used to detect when
            the user starts speaking.
        stop: A list of user turn stop strategies used to decide when
            the user stops speaking.

    Nstartstopc                 C   s$   | j st | _ | jst | _d S d S N)r   r   r   r   selfr   r   r   __post_init__G   s
   z UserTurnStrategies.__post_init__)__name__
__module____qualname____doc__r   r   r   r   __annotations__r   r
   r   r   r   r   r   r   3   s
   
 r   c                   @   s   e Zd ZdZdd ZdS )ExternalUserTurnStrategiesar  Default container for external user turn start and stop strategies.

    This class provides a convenience default for configuring external turn
    control. It preconfigures `UserTurnStrategies` with
    `ExternalUserTurnStartStrategy` and `ExternalUserTurnStopStrategy`, allowing
    external processors (such as services) to control when user turn starts and
    stops.

    When using this container, the user aggregator does not push
    `UserStartedSpeakingFrame` or `UserStoppedSpeakingFrame` frames, and does
    not generate interruptions. These signals are expected to be provided by an
    external processor.

    c                 C   s   t  g| _t g| _d S r   )r   r   r   r   r   r   r   r   r   _   s   
z(ExternalUserTurnStrategies.__post_init__N)r   r   r   r   r   r   r   r   r   r   N   s    r   N)r   dataclassesr   typingr   r   1pipecat.audio.turn.smart_turn.local_smart_turn_v3r   pipecat.turns.user_startr   r   r   r	   pipecat.turns.user_stopr
   r   r   r   r   r   r   r   r   r   r   <module>   s   	