
    b6i                     \    d dl Z d dlmZ d dlmZ d dlmZ  G d de      Z G d de      Zy)	    N)SpeechToTextClient)AsyncSpeechToTextClient)ScribeRealtimec                   V     e Zd ZdZdej
                  ddf fdZedefd       Z	 xZ
S )r   z
    A client to handle ElevenLabs speech-to-text functionality.
    Extends the autogenerated client to include realtime transcription.
    kwargsreturnNc                 2    t        |   di | d | _        y N super__init__	_realtimeselfr   	__class__s     k/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/speech_to_text_custom.pyr   zSpeechToTextClient.__init__       "6":>    c                     | j                   sV| j                  j                         j                  dd      }| j                  j	                         }t        ||      | _         | 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   s      r   realtimezSpeechToTextClient.realtime   X    8 ~~**668<<\2NG++88:H+GhODN~~r   __name__
__module____qualname____doc__typingAnyr   propertyr   r"   __classcell__r   s   @r   r   r      :    
? ? ? !. ! !r   r   c                   V     e Zd ZdZdej
                  ddf fdZedefd       Z	 xZ
S )r   z
    An async client to handle ElevenLabs speech-to-text functionality.
    Extends the autogenerated async client to include realtime transcription.
    r   r   Nc                 2    t        |   di | d | _        y r
   r   r   s     r   r   z AsyncSpeechToTextClient.__init__=   r   r   c                     | j                   sV| j                  j                         j                  dd      }| j                  j	                         }t        ||      | _         | j                   S )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!   s      r   r"   z AsyncSpeechToTextClient.realtimeA   r#   r   r$   r-   s   @r   r   r   7   r.   r   r   )r)    elevenlabs.speech_to_text.clientr   AutogeneratedSpeechToTextClientr   $AutogeneratedAsyncSpeechToTextClientelevenlabs.realtimer   r   r   r   <module>r6      s,     b l .,8 ,^,B ,r   