
    >|h/?                    Z   d dl Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ d dlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$ d dl%Z%ddlm&Z&  e jN                  e jP                  d      Z) G d d      Z* G d d      Z+y)    N   )SyncClientWrapper)OutputFormat)VoiceSettings)%PronunciationDictionaryVersionLocator   )?BodyTextToSpeechV1TextToSpeechVoiceIdPostApplyTextNormalization)RequestOptions)jsonable_encoder)'convert_and_respect_annotation_metadata)UnprocessableEntityError)HttpValidationError)construct_type)JSONDecodeError)ApiError)[BodyTextToSpeechWithTimestampsV1TextToSpeechVoiceIdWithTimestampsPostApplyTextNormalization) AudioWithTimestampsResponseModel)NBodyTextToSpeechStreamingV1TextToSpeechVoiceIdStreamPostApplyTextNormalization)jBodyTextToSpeechStreamingWithTimestampsV1TextToSpeechVoiceIdStreamWithTimestampsPostApplyTextNormalization).StreamingAudioChunkWithTimestampsResponseModel)AsyncClientWrapper.c            &       ~	   e Zd ZdefdZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   def$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZy)TextToSpeechClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     _/var/www/html/test/engine/venv/lib/python3.12/site-packages/elevenlabs/text_to_speech/client.py__init__zTextToSpeechClient.__init__&   
    -    Nenable_loggingoptimize_streaming_latencyoutput_formatmodel_idlanguage_codevoice_settings!pronunciation_dictionary_locatorsseedprevious_text	next_textprevious_request_idsnext_request_idsuse_pvc_as_ivcapply_text_normalizationrequest_optionsvoice_idtextr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   returnc             #   4  K   | j                   j                  j                  dt        |       d|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||dddi|t        	      5 }	 d
|j                  cxk  rdk  r>n n;||j                  dd      nd}|j                  |      D ]  }|  	 ddd       y|j                          |j                  dk(  r@t        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  |      # t&        $ r" t)        |j                  |j*                        w xY w# 1 sw Y   yxY ww)a  
        Converts text into speech using a voice of your choice and returns audio.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechV1TextToSpeechVoiceIdPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Yields
        ------
        typing.Iterator[bytes]
            The generated audio file

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.text_to_speech.convert(
            voice_id="JBFqnCBsd6RMkjVDRZzb",
            output_format="mp3_44100_128",
            text="The first move is what sets everything in motion.",
            model_id="eleven_multilingual_v2",
        )
        v1/text-to-speech/POSTr&   r'   r(   writeobject_
annotation	directionr6   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   content-typeapplication/jsonmethodparamsjsonheadersr4   omit   ,  N
chunk_size   rL     type_r>   status_codebodyr   httpx_clientstreamr   r   r   typingSequencer   OMITrS   get
iter_bytesreadr   castr   r   rG   r   r   r6   r    r5   r6   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   	_response_chunk_size_chunk_response_jsons                         r!   convertzTextToSpeechClient.convert)   s    V !!..55 !1(!; <="0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A 6 !
 6	SB W)//5#5M\Mh/"5"5lD"InrK"+"6"6+"6"N %$%O6	S 6	SP  ((C/2/*&9(1(8  "+!1 y'<'<>RR # W9+@+@y~~VVWi6	S 6	Ss>   BFFA	E	FA/EF+F		FFFc                   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
      }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                                     S |j                  dk(  r@t        t        j                  t         t        t         |j                                           |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Generate speech from text with precise character-level timing information for audio-text synchronization.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechWithTimestampsV1TextToSpeechVoiceIdWithTimestampsPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

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

        Returns
        -------
        AudioWithTimestampsResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.text_to_speech.convert_with_timestamps(
            voice_id="21m00Tcm4TlvDq8ikWAM",
            text="This is a test for the API of ElevenLabs.",
        )
        r9   /with-timestampsr:   r;   r<   r=   rA   rB   rC   rD   rJ   rK   rP   rO   rR   r   rV   requestr   r   r   rX   rY   r   rZ   rS   r^   r   r   rG   r   r   r   r   r6   r    r5   r6   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r`   rc   s                       r!   convert_with_timestampsz*TextToSpeechClient.convert_with_timestamps   s   R ((55== !1(!; <<LM"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A > !
	D	Si++1c1{{4"> ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AE AE +E3c             #   6  K   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
      5 }	 d|j                  cxk  rdk  r>n n;||j                  dd      nd}|j                  |      D ]  }|  	 ddd       y|j                          |j                  dk(  r@t        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  |      # t&        $ r" t)        |j                  |j*                        w xY w# 1 sw Y   yxY ww)a7  
        Converts text into speech using a voice of your choice and returns audio as an audio stream.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechStreamingV1TextToSpeechVoiceIdStreamPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Yields
        ------
        typing.Iterator[bytes]
            Streaming audio data

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.text_to_speech.convert_as_stream(
            voice_id="JBFqnCBsd6RMkjVDRZzb",
            output_format="mp3_44100_128",
            text="The first move is what sets everything in motion.",
            model_id="eleven_multilingual_v2",
        )
        r9   /streamr:   r;   r<   r=   rA   rB   rC   rD   rJ   rK   NrL   rM   rN   rO   rP   rR   rU   r_   s                         r!   convert_as_streamz$TextToSpeechClient.convert_as_streamo  s    V !!..55 !1(!; <GD"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A 6 !
 6	SB W)//5#5M\Mh/"5"5lD"InrK"+"6"6+"6"N %$%O6	S 6	SP  ((C/2/*&9(1(8  "+!1 y'<'<>RR # W9+@+@y~~VVWi6	S 6	Ss>   BFFA	E	FA/EF+F

FFFc             #     K   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
      5 }	 d|j                  cxk  rdk  rpn nm|j                         D ]P  }	 t        |      dk(  rt        j                  t        t        t        t!        j"                  |                   R 	 ddd       y|j%                          |j                  dk(  r@t'        t        j                  t(        t        t(        |j!                                           |j!                         }t-        |j                  |      #  Y xY w# t*        $ r" t-        |j                  |j.                        w xY w# 1 sw Y   yxY ww)a  
        Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechStreamingWithTimestampsV1TextToSpeechVoiceIdStreamWithTimestampsPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

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

        Yields
        ------
        typing.Iterator[StreamingAudioChunkWithTimestampsResponseModel]
            Stream of JSON objects containing audio chunks and character timing information

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        response = client.text_to_speech.stream_with_timestamps(
            voice_id="JBFqnCBsd6RMkjVDRZzb",
            output_format="mp3_44100_128",
            text="The first move is what sets everything in motion.",
            model_id="eleven_multilingual_v2",
        )
        for chunk in response:
            yield chunk
        r9   /stream/with-timestampsr:   r;   r<   r=   rA   rB   rC   rD   rJ   rK   r   rP   NrO   rR   )r   rV   rW   r   r   r   rX   rY   r   rZ   rS   
iter_lineslenr^   r   r   rG   loadsr]   r   r   r   r   r6   r    r5   r6   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r`   _textrc   s                        r!   stream_with_timestampsz)TextToSpeechClient.stream_with_timestamps  s    Z !!..55 !1(!; <<ST"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A 6 !
 @	SB W)//5#5!*!5!5!7 !!"5zQ ("(++ N .*X,0JJu,=!"# 	! c@	S @	Sd  ((C/2/*&9(1(8  "+!1 y'<'<>RR#!  # W9+@+@y~~VVW}@	S @	Ssa   BGG+F2F F>F?F	GA/F:GFF+GGGG)__name__
__module____qualname__r   r"   rZ   strrX   Optionalboolintr   r   rY   r   r	   r
   Iteratorbytesrd   r   r   rj   r   rm   r   r   ru    r$   r!   r   r   %   s   .*; . 15;?7;)-.29= %).2*.FJBF04 ;?/aSaS 	aS
 -aS %+OOC$8aS |4aS //#&aS s+aS 6aS ,2??OOAB,
aS ooc"aS s+aS  ??3'!aS" %oofooc.BC#aS$ !//&//#*>?%aS& -'aS( #)//K#
)aS.  8/aS0 
	1aSP 15;?7;)-.29= %).2*.FJBF04 ;?/aOaO 	aO
 -aO %+OOC$8aO |4aO //#&aO s+aO 6aO ,2??OOAB,
aO ooc"aO s+aO  ??3'!aO" %oofooc.BC#aO$ !//&//#*>?%aO& -'aO( #)//g#
)aO.  8/aO0 
*1aOP 15;?7;)-.29= %).2*.FJBF04 ;?/aSaS 	aS
 -aS %+OOC$8aS |4aS //#&aS s+aS 6aS ,2??OOAB,
aS ooc"aS s+aS  ??3'!aS" %oofooc.BC#aS$ !//&//#*>?%aS& -'aS( #)//Z#
)aS.  8/aS0 
	1aSP 15;?7;)-.29= %).2*.FJBF04 ;?/mSmS 	mS
 -mS %+OOC$8mS |4mS //#&mS s+mS 6mS ,2??OOAB,
mS ooc"mS s+mS  ??3'!mS" %oofooc.BC#mS$ !//&//#*>?%mS& -'mS( #)//v#
)mS.  8/mS0 
G	H1mSr$   r   c            &       ~	   e Zd ZdefdZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   def$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZdddeeeeeeeeeeedddededej                  e	   dej                  e
   d	ej                  e   d
ej                  e   dej                  e   dej                  e   dej                  ej                  e      dej                  e
   dej                  e   dej                  e   dej                  ej                  e      dej                  ej                  e      dej                  e	   dej                  e   dej                  e   dej"                  e   f$dZy)AsyncTextToSpeechClientr   c                    || _         y r   r   r   s     r!   r"   z AsyncTextToSpeechClient.__init__  r#   r$   Nr%   r5   r6   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r7   c                 K   | j                   j                  j                  dt        |       d|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||dddi|t        	      4 d
{   }	 d|j                  cxk  rdk  r:n n7||j                  dd      nd}|j                  |      2 3 d
{   }| |j                          d
{    |j                  dk(  r@t        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  |      7 7 6 	 d
d
d
      d
{  7   y
7 # t&        $ r" t)        |j                  |j*                        w xY w# 1 d
{  7  sw Y   y
xY ww)a  
        Converts text into speech using a voice of your choice and returns audio.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechV1TextToSpeechVoiceIdPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Yields
        ------
        typing.AsyncIterator[bytes]
            The generated audio file

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_speech.convert(
                voice_id="JBFqnCBsd6RMkjVDRZzb",
                output_format="mp3_44100_128",
                text="The first move is what sets everything in motion.",
                model_id="eleven_multilingual_v2",
            )


        asyncio.run(main())
        r9   r:   r;   r<   r=   rA   rB   rC   rD   NrJ   rK   rL   rM   rN   rO   rP   rR   r   rV   rW   r   r   r   rX   rY   r   rZ   rS   r[   aiter_bytesareadr   r^   r   r   rG   r   r   r6   r_   s                         r!   rd   zAsyncTextToSpeechClient.convert  s    f ''44;; !1(!; <="0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A < !
 6	S 6	SB W)//5#5M\Mh/"5"5lD"InrK(1(=(=(=(U % %f$oo'''((C/2/*&9(1(8  "+!1 y'<'<>RRm6	SJ%(UO6	S 6	S 6	SP ( # W9+@+@y~~VVWi6	S 6	S 6	Ss   BGE*GF2A FE.E,E.F/F0A#FF2*G,E..F0G;E><GF+F//F22G8F;9G Gc                  K   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
       d{   }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                                     S |j                  dk(  r@t        t        j                  t         t        t         |j                                           |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a  
        Generate speech from text with precise character-level timing information for audio-text synchronization.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechWithTimestampsV1TextToSpeechVoiceIdWithTimestampsPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

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

        Returns
        -------
        AudioWithTimestampsResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_speech.convert_with_timestamps(
                voice_id="21m00Tcm4TlvDq8ikWAM",
                text="This is a test for the API of ElevenLabs.",
            )


        asyncio.run(main())
        r9   rf   r:   r;   r<   r=   rA   rB   rC   rD   NrJ   rK   rP   rO   rR   rg   ri   s                       r!   rj   z/AsyncTextToSpeechClient.convert_with_timestampsq  s    b ..;;CC !1(!; <<LM"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A D !
 !
	D	Si++1c1{{4"> ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNq!
l  	Sy'<'<9>>RR	Ss8   BFEFAE FAE ;F+E??Fc                 K   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
      4 d{   }	 d|j                  cxk  rdk  r:n n7||j                  dd      nd}|j                  |      2 3 d{   }| |j                          d{    |j                  dk(  r@t        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  |      7 7 6 	 ddd      d{  7   y7 # t&        $ r" t)        |j                  |j*                        w xY w# 1 d{  7  sw Y   yxY ww)a  
        Converts text into speech using a voice of your choice and returns audio as an audio stream.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechStreamingV1TextToSpeechVoiceIdStreamPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Yields
        ------
        typing.AsyncIterator[bytes]
            Streaming audio data

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_speech.convert_as_stream(
                voice_id="JBFqnCBsd6RMkjVDRZzb",
                output_format="mp3_44100_128",
                text="The first move is what sets everything in motion.",
                model_id="eleven_multilingual_v2",
            )


        asyncio.run(main())
        r9   rl   r:   r;   r<   r=   rA   rB   rC   rD   NrJ   rK   rL   rM   rN   rO   rP   rR   r   r_   s                         r!   rm   z)AsyncTextToSpeechClient.convert_as_stream  s    f ''44;; !1(!; <GD"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A < !
 6	S 6	SB W)//5#5M\Mh/"5"5lD"InrK(1(=(=(=(U % %f$oo'''((C/2/*&9(1(8  "+!1 y'<'<>RRm6	SJ%(UO6	S 6	S 6	SP ( # W9+@+@y~~VVWi6	S 6	S 6	Ss   BGE+	GF3A FE/E-E/F0F1A#FF3+G-E//F1G<E?=GF+F00F33G9F<:GGc                 K   | j                   j                  j                  dt        |       dd|||d|||t	        |t
        d      t	        |	t        j                  t           d      |
||||||ddd	i|t        
      4 d{   }	 d|j                  cxk  rdk  rln ni|j                         2 3 d{   }	 t        |      dk(  rt        j                  t        t        t        t!        j"                  |                   Y|j%                          d{    |j                  dk(  r@t'        t        j                  t(        t        t(        |j!                                           |j!                         }t-        |j                  |      7 7 #  Y xY w6 	 ddd      d{  7   y7 # t*        $ r" t-        |j                  |j.                        w xY w# 1 d{  7  sw Y   yxY ww)a  
        Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        text : str
            The text that will get converted into speech.

        enable_logging : typing.Optional[bool]
            When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers.

        optimize_streaming_latency : typing.Optional[int]
            You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values:
            0 - default mode (no latency optimizations)
            1 - normal latency optimizations (about 50% of possible latency improvement of option 3)
            2 - strong latency optimizations (about 75% of possible latency improvement of option 3)
            3 - max latency optimizations
            4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates).

            Defaults to None.

        output_format : typing.Optional[OutputFormat]
            The output format of the generated audio.

        model_id : typing.Optional[str]
            Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property.

        language_code : typing.Optional[str]
            Language code (ISO 639-1) used to enforce a language for the model. Currently only Turbo v2.5 and Flash v2.5 support language enforcement. For other models, an error will be returned if language code is provided.

        voice_settings : typing.Optional[VoiceSettings]
            Voice settings overriding stored settings for the given voice. They are applied only on the given request.

        pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]]
            A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request

        seed : typing.Optional[int]
            If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295.

        previous_text : typing.Optional[str]
            The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        next_text : typing.Optional[str]
            The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation.

        previous_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send.

        next_request_ids : typing.Optional[typing.Sequence[str]]
            A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send.

        use_pvc_as_ivc : typing.Optional[bool]
            If true, we won't use PVC version of the voice for the generation but the IVC version. This is a temporary workaround for higher latency in PVC versions.

        apply_text_normalization : typing.Optional[BodyTextToSpeechStreamingWithTimestampsV1TextToSpeechVoiceIdStreamWithTimestampsPostApplyTextNormalization]
            This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. Cannot be turned on for 'eleven_turbo_v2_5' model.

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

        Yields
        ------
        typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponseModel]
            Stream of JSON objects containing audio chunks and character timing information

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            response = await client.text_to_speech.stream_with_timestamps(
                voice_id="JBFqnCBsd6RMkjVDRZzb",
                output_format="mp3_44100_128",
                text="The first move is what sets everything in motion.",
                model_id="eleven_multilingual_v2",
            )
            async for chunk in response:
                yield chunk


        asyncio.run(main())
        r9   ro   r:   r;   r<   r=   rA   rB   rC   rD   NrJ   rK   r   rP   rO   rR   )r   rV   rW   r   r   r   rX   rY   r   rZ   rS   aiter_linesrq   r^   r   r   rG   rr   r   r   r   r   r   r6   rs   s                        r!   ru   z.AsyncTextToSpeechClient.stream_with_timestamps  s.    j ''44;; !1(!; <<ST"0.H!. $!."I*}PW# 6]=%/TU%6
 !.&(<$4"0,D%*  2 ,A < !
 @	S @	SB W)//5#5'0'<'<'> ! !e!"5zQ ("(++ N .*X,0JJu,=!"#   oo'''((C/2/*&9(1(8  "+!1 y'<'<>RRA@	SH!!  (? c@	S @	S @	Sd ( # W9+@+@y~~VVW}@	S @	S @	Ss   BHF	HG-(F?6F):F ;F)>F? F"F??F"F?"F=#A#F?G-H F)"F&$F?+H6F97H=F??+G**G--G?3G64G?;H)rv   rw   rx   r   r"   rZ   ry   rX   rz   r{   r|   r   r   rY   r   r	   r
   AsyncIteratorr~   rd   r   r   rj   r   rm   r   r   ru   r   r$   r!   r   r     s   .*< . 15;?7;)-.29= %).2*.FJBF04 ;?/iSiS 	iS
 -iS %+OOC$8iS |4iS //#&iS s+iS 6iS ,2??OOAB,
iS ooc"iS s+iS  ??3'!iS" %oofooc.BC#iS$ !//&//#*>?%iS& -'iS( #)//K#
)iS.  8/iS0 
		e	$1iS` 15;?7;)-.29= %).2*.FJBF04 ;?/iOiO 	iO
 -iO %+OOC$8iO |4iO //#&iO s+iO 6iO ,2??OOAB,
iO ooc"iO s+iO  ??3'!iO" %oofooc.BC#iO$ !//&//#*>?%iO& -'iO( #)//g#
)iO.  8/iO0 
*1iO` 15;?7;)-.29= %).2*.FJBF04 ;?/iSiS 	iS
 -iS %+OOC$8iS |4iS //#&iS s+iS 6iS ,2??OOAB,
iS ooc"iS s+iS  ??3'!iS" %oofooc.BC#iS$ !//&//#*>?%iS& -'iS( #)//Z#
)iS.  8/iS0 
		e	$1iS` 15;?7;)-.29= %).2*.FJBF04 ;?/uSuS 	uS
 -uS %+OOC$8uS |4uS //#&uS s+uS 6uS ,2??OOAB,
uS ooc"uS s+uS  ??3'!uS" %oofooc.BC#uS$ !//&//#*>?%uS& -'uS( #)//v#
)uS.  8/uS0 
		L	M1uSr$   r   ),rX   core.client_wrapperr   types.output_formatr   types.voice_settingsr   .types.pronunciation_dictionary_version_locatorr   Stypes.body_text_to_speech_v_1_text_to_speech_voice_id_post_apply_text_normalizationr	   core.request_optionsr
   core.jsonable_encoderr   core.serializationr   !errors.unprocessable_entity_errorr   types.http_validation_errorr   core.unchecked_base_modelr   json.decoderr   core.api_errorr   stypes.body_text_to_speech_with_timestamps_v_1_text_to_speech_voice_id_with_timestamps_post_apply_text_normalizationr   *types.audio_with_timestamps_response_modelr   dtypes.body_text_to_speech_streaming_v_1_text_to_speech_voice_id_stream_post_apply_text_normalizationr   ڄtypes.body_text_to_speech_streaming_with_timestamps_v_1_text_to_speech_voice_id_stream_with_timestamps_post_apply_text_normalizationr   :types.streaming_audio_chunk_with_timestamps_response_modelr   rG   r   r^   AnyrZ   r   r   r   r$   r!   <module>r      s     3 . 0 b 2 4 H H = 6 ( % Z x  4 v{{6::s#Z
S Z
Szz
S z
Sr$   