
    qi_                        d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
  G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z)Configuration for the Gladia STT service.    )AnyDictListOptionalUnion)	BaseModel)Languagec                   @    e Zd ZU dZdZeee      ed<   dZ	ee
   ed<   y)LanguageConfigzConfiguration for language detection and handling.

    Parameters:
        languages: List of language codes to use for transcription
        code_switching: Whether to auto-detect language changes during transcription
    N	languagescode_switching)__name__
__module____qualname____doc__r   r   r   str__annotations__r   bool     P/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/services/gladia/config.pyr   r      s*     &*IxS	")%)NHTN)r   r   c                   :    e Zd ZU dZdZee   ed<   dZee	   ed<   y)PreProcessingConfigzConfiguration for audio pre-processing options.

    Parameters:
        audio_enhancer: Apply pre-processing to the audio stream to enhance quality
        speech_threshold: Sensitivity for speech detection (0-1)
    Naudio_enhancerspeech_threshold)
r   r   r   r   r   r   r   r   r   floatr   r   r   r   r      s&     &*NHTN)(,huo,r   r   c                   T    e Zd ZU dZeed<   eed<   dZee	e      ed<   dZ
ee   ed<   y)CustomVocabularyItema  Represents a custom vocabulary item with an intensity value.

    Parameters:
        value: The vocabulary word or phrase
        intensity: The bias intensity for this vocabulary item (0-1)
        pronunciations: The pronunciations used in the transcription.
        language: Specify the language in which it will be pronounced when sound comparison occurs. Default to transcription language.
    value	intensityNpronunciationslanguage)r   r   r   r   r   r   r   r!   r   r   r"   r   r   r   r   r   (   s5     J*.NHT#Y'."Hhsm"r   r   c                   J    e Zd ZU dZdZeeeee	f         e
d<   dZee   e
d<   y)CustomVocabularyConfigzConfiguration for custom vocabulary.

    Parameters:
        vocabulary: List of words/phrases or CustomVocabularyItem objects
        default_intensity: Default intensity for simple string vocabulary items
    N
vocabularydefault_intensity)r   r   r   r   r%   r   r   r   r   r   r   r&   r   r   r   r   r$   r$   8   s9     DHJeC)=$=>?@G)-x-r   r$   c                   6    e Zd ZU dZdZeeeee   f      e	d<   y)CustomSpellingConfigzConfiguration for custom spelling rules.

    Parameters:
        spelling_dictionary: Mapping of correct spellings to phonetic variations
    Nspelling_dictionary)
r   r   r   r   r)   r   r   r   r   r   r   r   r   r(   r(   D   s&     ;?$sDI~"67>r   r(   c                       e Zd ZU dZdZeee      ed<   dZ	ee   ed<   dZ
ee   ed<   dZee   ed<   dZee   ed<   dZee   ed<   dZee   ed	<   y)
TranslationConfigaA  Configuration for real-time translation.

    Parameters:
        target_languages: List of target language codes for translation
        model: Translation model to use ("base" or "enhanced")
        match_original_utterances: Whether to align translations with original utterances
        lipsync: Whether to enable lip-sync optimization for translations
        context_adaptation: Whether to enable context-aware translation adaptation
        context: Additional context to help with translation accuracy
        informal: Force informal language forms when available
    Ntarget_languagesmodelmatch_original_utteranceslipsynccontext_adaptationcontextinformal)r   r   r   r   r,   r   r   r   r   r-   r.   r   r/   r0   r1   r2   r   r   r   r+   r+   N   ss    
 -1htCy)0E8C=04x~4"GXd^")--!GXc]!#Hhtn#r   r+   c                       e Zd ZU dZdZee   ed<   dZee   ed<   dZ	ee
   ed<   dZee   ed<   dZee   ed<   dZee   ed<   dZee   ed	<   dZee   ed
<   dZee   ed<   y)RealtimeProcessingConfiga  Configuration for real-time processing features.

    Parameters:
        words_accurate_timestamps: Whether to provide per-word timestamps
        custom_vocabulary: Whether to enable custom vocabulary
        custom_vocabulary_config: Custom vocabulary configuration
        custom_spelling: Whether to enable custom spelling
        custom_spelling_config: Custom spelling configuration
        translation: Whether to enable translation
        translation_config: Translation configuration
        named_entity_recognition: Whether to enable named entity recognition
        sentiment_analysis: Whether to enable sentiment analysis
    Nwords_accurate_timestampscustom_vocabularycustom_vocabulary_configcustom_spellingcustom_spelling_configtranslationtranslation_confignamed_entity_recognitionsentiment_analysis)r   r   r   r   r5   r   r   r   r6   r7   r$   r8   r9   r(   r:   r;   r+   r<   r=   r   r   r   r4   r4   d   s     15x~4(,x~,AEh'=>E&*OXd^*=AH%9:A"&K$&6:!23:/3htn3)--r   r4   c                       e Zd ZU dZdZee   ed<   dZee   ed<   dZ	ee   ed<   dZ
ee   ed<   dZee   ed<   dZee   ed<   dZee   ed	<   dZee   ed
<   dZee   ed<   y)MessagesConfiga  Configuration for controlling which message types are sent via WebSocket.

    Parameters:
        receive_partial_transcripts: Whether to receive intermediate transcription results
        receive_final_transcripts: Whether to receive final transcription results
        receive_speech_events: Whether to receive speech begin/end events
        receive_pre_processing_events: Whether to receive pre-processing events
        receive_realtime_processing_events: Whether to receive real-time processing events
        receive_post_processing_events: Whether to receive post-processing events
        receive_acknowledgments: Whether to receive acknowledgment messages
        receive_errors: Whether to receive error messages
        receive_lifecycle_events: Whether to receive lifecycle events
    Nreceive_partial_transcriptsreceive_final_transcriptsreceive_speech_eventsreceive_pre_processing_events"receive_realtime_processing_eventsreceive_post_processing_eventsreceive_acknowledgmentsreceive_errorsreceive_lifecycle_events)r   r   r   r   r@   r   r   r   rA   rB   rC   rD   rE   rF   rG   rH   r   r   r   r?   r?   ~   s     37$604x~4,08D>048!8D>89=&=59"HTN9.2Xd^2%)NHTN)/3htn3r   r?   c                      e Zd ZU dZdZee   ed<   dZee	   ed<   dZ
ee	   ed<   dZeeeef      ed	<   dZee   ed
<   dZee	   ed<   dZee   ed<   dZee   ed<   dZee   ed<   dZee   ed<   dZee   ed<   dZeed<   y)GladiaInputParamsa  Configuration parameters for the Gladia STT service.

    .. deprecated:: 0.0.105
        Use ``settings=GladiaSTTSettings(...)`` for runtime-updatable
        fields and direct init parameters for encoding/bit_depth/channels.

    Parameters:
        encoding: Audio encoding format
        bit_depth: Audio bit depth
        channels: Number of audio channels
        custom_metadata: Additional metadata to include with requests
        endpointing: Silence duration in seconds to mark end of speech
        maximum_duration_without_endpointing: Maximum utterance duration without silence
        language: Language code for transcription

            .. deprecated:: 0.0.62
                The 'language' parameter is deprecated and will be removed in a future version.
                Use 'language_config' instead.

        language_config: Detailed language configuration
        pre_processing: Audio pre-processing options
        realtime_processing: Real-time processing features
        messages_config: WebSocket message filtering options
        enable_vad: Enable VAD to trigger end of utterance detection. This should be used
            without any other VAD enabled in the agent and will emit the speaker started
            and stopped frames. Defaults to False.
    zwav/pcmencoding   	bit_depth   channelsNcustom_metadataendpointing   $maximum_duration_without_endpointingr"   language_configpre_processingrealtime_processingmessages_configF
enable_vad)r   r   r   r   rK   r   r   r   rM   intrO   rP   r   r   rQ   r   rS   r"   r	   rT   r   rU   r   rV   r4   rW   r?   rX   r   r   r   r   rJ   rJ      s    8 (Hhsm'!Ix}!Hhsm04OXd38n-4#'K%':;((3-;#'Hhx '04OXn-448NH018>B":;B04OXn-4Jr   rJ   N)r   typingr   r   r   r   r   pydanticr   pipecat.transcriptions.languager	   r   r   r   r$   r(   r+   r4   r?   rJ   r   r   r   <module>r]      s    0 3 3  4	*Y 	*	-) 	-#9 # 	.Y 	.?9 ?$	 $,.y .44Y 44(	 (r   