o
    lWi                     @   sP   d dl Z d dlmZ d dlmZ d dlmZ G dd deZG dd deZdS )	    N)SpeechToTextClient)AsyncSpeechToTextClient)ScribeRealtimec                       >   e Zd ZdZdejddf fddZedefddZ	  Z
S )	r   z
    A client to handle ElevenLabs speech-to-text functionality.
    Extends the autogenerated client to include realtime transcription.
    kwargsreturnNc                       t  jdi | d | _d S N super__init__	_realtimeselfr   	__class__r
   d/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/speech_to_text_custom.pyr         
zSpeechToTextClient.__init__c                 C   6   | j s| j dd}| j }t||d| _ | j S )aB  
        Access the realtime speech-to-text transcription API.

        Returns:
            ScribeRealtime instance for creating WebSocket connections

        Example:
            ```python
            from elevenlabs import ElevenLabs, RealtimeEvents, AudioFormat

            client = ElevenLabs(api_key="your-api-key")

            # URL-based streaming
            connection = await client.speech_to_text.realtime.connect({
                "url": "https://stream.example.com/audio.mp3"
            })

            connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(data))

            # Manual audio chunks
            connection = await client.speech_to_text.realtime.connect({
                "audio_format": AudioFormat.PCM_16000,
                "sample_rate": 16000
            })
            ```
        
xi-api-key api_keybase_urlr   _client_wrapperget_headersgetget_base_urlr   r   r   r   r
   r
   r   realtime   
   
zSpeechToTextClient.realtime__name__
__module____qualname____doc__typingAnyr   propertyr   r!   __classcell__r
   r
   r   r   r      
    r   c                       r   )	r   z
    An async client to handle ElevenLabs speech-to-text functionality.
    Extends the autogenerated async client to include realtime transcription.
    r   r   Nc                    r   r	   r   r   r   r
   r   r   =   r   z AsyncSpeechToTextClient.__init__c                 C   r   )aL  
        Access the realtime speech-to-text transcription API.

        Returns:
            ScribeRealtime instance for creating WebSocket connections

        Example:
            ```python
            from elevenlabs import AsyncElevenLabs, RealtimeEvents, AudioFormat

            client = AsyncElevenLabs(api_key="your-api-key")

            # URL-based streaming
            connection = await client.speech_to_text.realtime.connect({
                "url": "https://stream.example.com/audio.mp3"
            })

            connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(data))

            # Manual audio chunks
            connection = await client.speech_to_text.realtime.connect({
                "audio_format": AudioFormat.PCM_16000,
                "sample_rate": 16000
            })
            ```
        r   r   r   r   r    r
   r
   r   r!   A   r"   z AsyncSpeechToTextClient.realtimer#   r
   r
   r   r   r   7   r,   r   )r(    elevenlabs.speech_to_text.clientr   AutogeneratedSpeechToTextClientr   $AutogeneratedAsyncSpeechToTextClientelevenlabs.realtimer   r
   r
   r
   r   <module>   s    /