o
    lWi#i                     @  s
  d dl mZ d dlZd dlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ejrddlmZmZ dd	lmZmZ dd
lmZmZ ddlmZmZ ddlmZmZ ddlmZm Z  ddl!m"Z"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@mAZA ddlBmCZCmDZD ddlEmFZFmGZG ddlHmIZImJZJ ddlKmLZLmMZM ddlNmOZOmPZP ddlQmRZRmSZS ddlTmUZUmVZV G d d! d!ZWG d"d# d#ZXdd$d-d+d,ZYdS ).    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ElevenLabsEnvironment)AsyncRawBaseElevenLabsRawBaseElevenLabs)AsyncAudioIsolationClientAudioIsolationClient)AsyncAudioNativeClientAudioNativeClient)AsyncConversationalAiClientConversationalAiClient)AsyncDubbingClientDubbingClient)AsyncForcedAlignmentClientForcedAlignmentClient)AsyncHistoryClientHistoryClient)AsyncModelsClientModelsClient)AsyncMusicClientMusicClient)$AsyncPronunciationDictionariesClientPronunciationDictionariesClient)AsyncSamplesClientSamplesClient)AsyncServiceAccountsClientServiceAccountsClient)AsyncSpeechToSpeechClientSpeechToSpeechClient)AsyncSpeechToTextClientSpeechToTextClient)AsyncStudioClientStudioClient)AsyncTextToDialogueClientTextToDialogueClient)AsyncTextToSoundEffectsClientTextToSoundEffectsClient)AsyncTextToSpeechClientTextToSpeechClient)AsyncTextToVoiceClientTextToVoiceClient)AsyncTokensClientTokensClient)AsyncUsageClientUsageClient)AsyncUserClient
UserClient)AsyncVoicesClientVoicesClient)AsyncWebhooksClientWebhooksClient)AsyncWorkspaceClientWorkspaceClientc                   @  l  e Zd ZdZdejdddddddNddZedOddZdddPddZ	edd Z
ed d! Zed"d# Zed$d% Zed&d' Zed(d) Zed*d+ Zed,d- Zed.d/ Zed0d1 Zed2d3 Zed4d5 Zed6d7 Zed8d9 Zed:d; Zed<d= Zed>d? Zed@dA ZedBdC ZedDdE ZedFdG ZedHdI ZedJdK Z edLdM Z!dS )QBaseElevenLabsa~  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : typing.Optional[str]
        The base url to use for requests from the client.

    environment : ElevenLabsEnvironment
        The environment to use for requests from the client. from .environment import ElevenLabsEnvironment



        Defaults to ElevenLabsEnvironment.PRODUCTION



    api_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 240 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.Client]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from elevenlabs import ElevenLabs

    client = ElevenLabs(
        api_key="YOUR_API_KEY",
    )
    NTbase_urlenvironmentapi_keyheaderstimeoutfollow_redirectshttpx_clientr=   typing.Optional[str]r>   r   r?   r@   &typing.Optional[typing.Dict[str, str]]rA   typing.Optional[float]rB   typing.Optional[bool]rC   typing.Optional[httpx.Client]c          	      C    |d ur|n	|d u rdn|j j}tt||d|||d ur|n|d ur)tj||dntj|d|d| _t| jd| _d | _	d | _
d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _d | _ d S N   r=   r>   )rA   rB   )rA   )r=   r?   r@   rC   rA   client_wrapper)!rA   readr   _get_base_urlhttpxClient_client_wrapperr	   _raw_client_history_text_to_sound_effects_audio_isolation_samples_text_to_speech_text_to_dialogue_speech_to_speech_text_to_voice_user_voices_studio_dubbing_models_audio_native_usage_pronunciation_dictionaries_service_accounts	_webhooks_speech_to_text_forced_alignment_conversational_ai_music_tokens
_workspace	selfr=   r>   r?   r@   rA   rB   rC   _defaulted_timeout rp   Z/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/base_client.py__init__P   L   


zBaseElevenLabs.__init__returnr	   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawBaseElevenLabs
        rT   rn   rp   rp   rq   with_raw_response      	z BaseElevenLabs.with_raw_responserequest_optionsr{   typing.Optional[RequestOptions]Nonec                C  s   | j j|d}|jS )a  
        Add a generated voice to the voice library.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.save_a_voice_preview()
        rz   rT   save_a_voice_previewdatarn   r{   	_responserp   rp   rq   r      s   z#BaseElevenLabs.save_a_voice_previewc                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   rM   )rU   history.clientr   rS   )rn   r   rp   rp   rq   history      
zBaseElevenLabs.historyc                 C  r   )Nr   )r)   rM   )rV   text_to_sound_effects.clientr)   rS   )rn   r)   rp   rp   rq   text_to_sound_effects   r   z$BaseElevenLabs.text_to_sound_effectsc                 C  r   )Nr   )r   rM   )rW   audio_isolation.clientr   rS   )rn   r   rp   rp   rq   audio_isolation   r   zBaseElevenLabs.audio_isolationc                 C  r   )Nr   )r   rM   )rX   samples.clientr   rS   )rn   r   rp   rp   rq   samples   r   zBaseElevenLabs.samplesc                 C  r   )Nr   )r+   rM   )rY   text_to_speech.clientr+   rS   )rn   r+   rp   rp   rq   text_to_speech   r   zBaseElevenLabs.text_to_speechc                 C  r   )Nr   )r'   rM   )rZ   text_to_dialogue.clientr'   rS   )rn   r'   rp   rp   rq   text_to_dialogue   r   zBaseElevenLabs.text_to_dialoguec                 C  r   )Nr   )r!   rM   )r[   speech_to_speech.clientr!   rS   )rn   r!   rp   rp   rq   speech_to_speech   r   zBaseElevenLabs.speech_to_speechc                 C  r   )Nr   )r-   rM   )r\   text_to_voice.clientr-   rS   )rn   r-   rp   rp   rq   text_to_voice   r   zBaseElevenLabs.text_to_voicec                 C  r   )Nr   )r3   rM   )r]   user.clientr3   rS   )rn   r3   rp   rp   rq   user   r   zBaseElevenLabs.userc                 C  r   )Nr   )r5   rM   )r^   voices.clientr5   rS   )rn   r5   rp   rp   rq   voices   r   zBaseElevenLabs.voicesc                 C  r   )Nr   )r%   rM   )r_   studio.clientr%   rS   )rn   r%   rp   rp   rq   studio   r   zBaseElevenLabs.studioc                 C  r   )Nr   )r   rM   )r`   dubbing.clientr   rS   )rn   r   rp   rp   rq   dubbing   r   zBaseElevenLabs.dubbingc                 C  r   )Nr   )r   rM   )ra   models.clientr   rS   )rn   r   rp   rp   rq   models  r   zBaseElevenLabs.modelsc                 C  r   )Nr   )r   rM   )rb   audio_native.clientr   rS   )rn   r   rp   rp   rq   audio_native  r   zBaseElevenLabs.audio_nativec                 C  r   )Nr   )r1   rM   )rc   usage.clientr1   rS   )rn   r1   rp   rp   rq   usage  r   zBaseElevenLabs.usagec                 C  r   )Nr   )r   rM   )rd   !pronunciation_dictionaries.clientr   rS   )rn   r   rp   rp   rq   pronunciation_dictionaries  r   z)BaseElevenLabs.pronunciation_dictionariesc                 C  r   )Nr   )r   rM   )re   service_accounts.clientr   rS   )rn   r   rp   rp   rq   service_accounts'  r   zBaseElevenLabs.service_accountsc                 C  r   )Nr   )r7   rM   )rf   webhooks.clientr7   rS   )rn   r7   rp   rp   rq   webhooks/  r   zBaseElevenLabs.webhooksc                 C  r   )Nr   )r#   rM   )rg   speech_to_text.clientr#   rS   )rn   r#   rp   rp   rq   speech_to_text7  r   zBaseElevenLabs.speech_to_textc                 C  r   )Nr   )r   rM   )rh   forced_alignment.clientr   rS   )rn   r   rp   rp   rq   forced_alignment?  r   zBaseElevenLabs.forced_alignmentc                 C  r   )Nr   )r   rM   )ri   conversational_ai.clientr   rS   )rn   r   rp   rp   rq   conversational_aiG  r   z BaseElevenLabs.conversational_aic                 C  r   )Nr   )r   rM   )rj   music.clientr   rS   )rn   r   rp   rp   rq   musicO  r   zBaseElevenLabs.musicc                 C  r   )Nr   )r/   rM   )rk   tokens.clientr/   rS   )rn   r/   rp   rp   rq   tokensW  r   zBaseElevenLabs.tokensc                 C  r   )Nr   )r9   rM   )rl   workspace.clientr9   rS   )rn   r9   rp   rp   rq   	workspace_  r   zBaseElevenLabs.workspace)r=   rD   r>   r   r?   rD   r@   rE   rA   rF   rB   rG   rC   rH   )rt   r	   r{   r|   rt   r}   "__name__
__module____qualname____doc__r   
PRODUCTIONrr   propertyrx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rp   rp   rp   rq   r;   (   sz    *3























r;   c                   @  r:   )QAsyncBaseElevenLabsa  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : typing.Optional[str]
        The base url to use for requests from the client.

    environment : ElevenLabsEnvironment
        The environment to use for requests from the client. from .environment import ElevenLabsEnvironment



        Defaults to ElevenLabsEnvironment.PRODUCTION



    api_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 240 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.AsyncClient]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from elevenlabs import AsyncElevenLabs

    client = AsyncElevenLabs(
        api_key="YOUR_API_KEY",
    )
    NTr<   r=   rD   r>   r   r?   r@   rE   rA   rF   rB   rG   rC   "typing.Optional[httpx.AsyncClient]c          	      C  rI   rJ   )!rA   rO   r   rP   rQ   AsyncClientrS   r   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rp   rp   rq   rr     rs   zAsyncBaseElevenLabs.__init__rt   r   c                 C  ru   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawBaseElevenLabs
        rv   rw   rp   rp   rq   rx     ry   z%AsyncBaseElevenLabs.with_raw_responserz   r{   r|   r}   c                  s   | j j|dI dH }|jS )a%  
        Add a generated voice to the voice library.

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.save_a_voice_preview()


        asyncio.run(main())
        rz   Nr~   r   rp   rp   rq   r     s   z(AsyncBaseElevenLabs.save_a_voice_previewc                 C  r   )Nr   )r   rM   )rU   r   r   rS   )rn   r   rp   rp   rq   r     r   zAsyncBaseElevenLabs.historyc                 C  r   )Nr   )r(   rM   )rV   r   r(   rS   )rn   r(   rp   rp   rq   r     r   z)AsyncBaseElevenLabs.text_to_sound_effectsc                 C  r   )Nr   )r
   rM   )rW   r   r
   rS   )rn   r
   rp   rp   rq   r     r   z#AsyncBaseElevenLabs.audio_isolationc                 C  r   )Nr   )r   rM   )rX   r   r   rS   )rn   r   rp   rp   rq   r     r   zAsyncBaseElevenLabs.samplesc                 C  r   )Nr   )r*   rM   )rY   r   r*   rS   )rn   r*   rp   rp   rq   r     r   z"AsyncBaseElevenLabs.text_to_speechc                 C  r   )Nr   )r&   rM   )rZ   r   r&   rS   )rn   r&   rp   rp   rq   r     r   z$AsyncBaseElevenLabs.text_to_dialoguec                 C  r   )Nr   )r    rM   )r[   r   r    rS   )rn   r    rp   rp   rq   r     r   z$AsyncBaseElevenLabs.speech_to_speechc                 C  r   )Nr   )r,   rM   )r\   r   r,   rS   )rn   r,   rp   rp   rq   r   '  r   z!AsyncBaseElevenLabs.text_to_voicec                 C  r   )Nr   )r2   rM   )r]   r   r2   rS   )rn   r2   rp   rp   rq   r   /  r   zAsyncBaseElevenLabs.userc                 C  r   )Nr   )r4   rM   )r^   r   r4   rS   )rn   r4   rp   rp   rq   r   7  r   zAsyncBaseElevenLabs.voicesc                 C  r   )Nr   )r$   rM   )r_   r   r$   rS   )rn   r$   rp   rp   rq   r   ?  r   zAsyncBaseElevenLabs.studioc                 C  r   )Nr   )r   rM   )r`   r   r   rS   )rn   r   rp   rp   rq   r   G  r   zAsyncBaseElevenLabs.dubbingc                 C  r   )Nr   )r   rM   )ra   r   r   rS   )rn   r   rp   rp   rq   r   O  r   zAsyncBaseElevenLabs.modelsc                 C  r   )Nr   )r   rM   )rb   r   r   rS   )rn   r   rp   rp   rq   r   W  r   z AsyncBaseElevenLabs.audio_nativec                 C  r   )Nr   )r0   rM   )rc   r   r0   rS   )rn   r0   rp   rp   rq   r   _  r   zAsyncBaseElevenLabs.usagec                 C  r   )Nr   )r   rM   )rd   r   r   rS   )rn   r   rp   rp   rq   r   g  r   z.AsyncBaseElevenLabs.pronunciation_dictionariesc                 C  r   )Nr   )r   rM   )re   r   r   rS   )rn   r   rp   rp   rq   r   o  r   z$AsyncBaseElevenLabs.service_accountsc                 C  r   )Nr   )r6   rM   )rf   r   r6   rS   )rn   r6   rp   rp   rq   r   w  r   zAsyncBaseElevenLabs.webhooksc                 C  r   )Nr   )r"   rM   )rg   r   r"   rS   )rn   r"   rp   rp   rq   r     r   z"AsyncBaseElevenLabs.speech_to_textc                 C  r   )Nr   )r   rM   )rh   r   r   rS   )rn   r   rp   rp   rq   r     r   z$AsyncBaseElevenLabs.forced_alignmentc                 C  r   )Nr   )r   rM   )ri   r   r   rS   )rn   r   rp   rp   rq   r     r   z%AsyncBaseElevenLabs.conversational_aic                 C  r   )Nr   )r   rM   )rj   r   r   rS   )rn   r   rp   rp   rq   r     r   zAsyncBaseElevenLabs.musicc                 C  r   )Nr   )r.   rM   )rk   r   r.   rS   )rn   r.   rp   rp   rq   r     r   zAsyncBaseElevenLabs.tokensc                 C  r   )Nr   )r8   rM   )rl   r   r8   rS   )rn   r8   rp   rp   rq   r     r   zAsyncBaseElevenLabs.workspace)r=   rD   r>   r   r?   rD   r@   rE   rA   rF   rB   rG   rC   r   )rt   r   r   r   rp   rp   rp   rq   r   h  sz    *3
!






















r   )r=   r=   rD   r>   r   rt   strc                 C  s"   | d ur| S |d ur|j S td)NzEPlease pass in either base_url or environment to construct the client)value	ExceptionrL   rp   rp   rq   rP     s
   rP   )r=   rD   r>   r   rt   r   )Z
__future__r   typingrQ   core.client_wrapperr   r   core.request_optionsr   r>   r   raw_base_clientr   r	   TYPE_CHECKINGr   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r   r"   r#   r   r$   r%   r   r&   r'   r   r(   r)   r   r*   r+   r   r,   r-   r   r.   r/   r   r0   r1   r   r2   r3   r   r4   r5   r   r6   r7   r   r8   r9   r;   r   rP   rp   rp   rp   rq   <module>   sN     B  J