
    -2i'                    r   d dl mZ d dlmZ d dlmZ d dlZddlmZ ddl	m
Z
mZmZmZmZmZmZ ddlmZmZ dd	lmZ dd
lmZmZ ddlmZmZmZmZ ddlmZ ddl m!Z! ddl"m#Z# ddgZ$ G d de          Z% G d de          Z& G d d          Z' G d d          Z( G d d          Z) G d d          Z*dS )    )annotations)Union)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)StreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponse#to_custom_streamed_response_wrapper)async_to_custom_streamed_response_wrapper)speech_create_params)make_request_options)SpeechModelSpeechAsyncSpeechc            	      Z    e Zd Zed d            Zed!d            Zeeeedddedd"dZdS )#r   returnSpeechWithRawResponsec                     t          |           S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r   selfs    \/var/www/html/pixcura-vrs/venv/lib/python3.11/site-packages/openai/resources/audio/speech.pywith_raw_responsezSpeech.with_raw_response   s     %T***    SpeechWithStreamingResponsec                     t          |           S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r'   r"   s    r$   with_streaming_responsezSpeech.with_streaming_response'   s     +4000r&   Ninstructionsresponse_formatspeedstream_formatextra_headersextra_query
extra_bodytimeoutinputstrmodelUnion[str, SpeechModel]voicelUnion[str, Literal['alloy', 'ash', 'ballad', 'coral', 'echo', 'sage', 'shimmer', 'verse', 'marin', 'cedar']]r,   
str | Omitr-   :Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'] | Omitr.   float | Omitr/   Literal['sse', 'audio'] | Omitr0   Headers | Noner1   Query | Noner2   Body | Noner3   'float | httpx.Timeout | None | NotGiven+_legacy_response.HttpxBinaryResponseContentc                   ddi|pi }|                      dt          |||||||dt          j                  t	          ||	|
|          t
          j                  S )  
        Generates audio from the input text.

        Args:
          input: The text to generate audio for. The maximum length is 4096 characters.

          model:
              One of the available [TTS models](https://platform.openai.com/docs/models#tts):
              `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.

          voice: The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
              `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and
              `verse`. Previews of the voices are available in the
              [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).

          instructions: Control the voice of your generated audio with additional instructions. Does not
              work with `tts-1` or `tts-1-hd`.

          response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
              `wav`, and `pcm`.

          speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
              the default.

          stream_format: The format to stream the audio in. Supported formats are `sse` and `audio`.
              `sse` is not supported for `tts-1` or `tts-1-hd`.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        Acceptapplication/octet-stream/audio/speechr4   r6   r8   r,   r-   r.   r/   r0   r1   r2   r3   bodyoptionscast_to)_postr   r   SpeechCreateParamsr   r   HttpxBinaryResponseContentr#   r4   r6   r8   r,   r-   r.   r/   r0   r1   r2   r3   s               r$   createzSpeech.create0   s    l "#=W-BUSUWzz """$0'6"%2  %7  )+Q[el   %?#  
 
 	
r&   )r   r   )r   r'   r4   r5   r6   r7   r8   r9   r,   r:   r-   r;   r.   r<   r/   r=   r0   r>   r1   r?   r2   r@   r3   rA   r   rB   	__name__
__module____qualname__r   r%   r*   r   r   rR    r&   r$   r   r      s        + + + _+ 1 1 1 _1  $(VZ"8< )-$("&;D#I
 I
 I
 I
 I
 I
 I
 I
r&   c            	      Z    e Zd Zed d            Zed!d            Zeeeedddedd"dZdS )#r   r   AsyncSpeechWithRawResponsec                     t          |           S r!   )rZ   r"   s    r$   r%   zAsyncSpeech.with_raw_response}   s     *$///r&    AsyncSpeechWithStreamingResponsec                     t          |           S r)   )r\   r"   s    r$   r*   z#AsyncSpeech.with_streaming_response   s     0555r&   Nr+   r4   r5   r6   r7   r8   r9   r,   r:   r-   r;   r.   r<   r/   r=   r0   r>   r1   r?   r2   r@   r3   rA   rB   c                  K   ddi|pi }|                      dt          |||||||dt          j                   d{V t	          ||	|
|          t
          j                   d{V S )rD   rE   rF   rG   rH   NrI   rJ   )rN   r   r   rO   r   r   rP   rQ   s               r$   rR   zAsyncSpeech.create   s      l "#=W-BUSUWZZ,"""$0'6"%2  %7        )+Q[el   %?#   
 
 
 
 
 
 
 
 	
r&   )r   rZ   )r   r\   rS   rT   rX   r&   r$   r   r   |   s        0 0 0 _0 6 6 6 _6  $(VZ"8< )-$("&;D#I
 I
 I
 I
 I
 I
 I
 I
r&   c                      e Zd ZddZdS )r   speechr   r   Nonec                P    || _         t          j        |j                  | _        d S N)_speechr   to_raw_response_wrapperrR   r#   r`   s     r$   __init__zSpeechWithRawResponse.__init__   s&    &>M
 
r&   Nr`   r   r   ra   rU   rV   rW   rg   rX   r&   r$   r   r      (        
 
 
 
 
 
r&   r   c                      e Zd ZddZdS )rZ   r`   r   r   ra   c                P    || _         t          j        |j                  | _        d S rc   )rd   r   async_to_raw_response_wrapperrR   rf   s     r$   rg   z#AsyncSpeechWithRawResponse.__init__   s&    &DM
 
r&   Nr`   r   r   ra   ri   rX   r&   r$   rZ   rZ      rj   r&   rZ   c                      e Zd ZddZdS )r'   r`   r   r   ra   c                R    || _         t          |j        t                    | _        d S rc   )rd   r   rR   r   rf   s     r$   rg   z$SpeechWithStreamingResponse.__init__   s&    9M%
 
r&   Nrh   ri   rX   r&   r$   r'   r'      (        
 
 
 
 
 
r&   r'   c                      e Zd ZddZdS )r\   r`   r   r   ra   c                R    || _         t          |j        t                    | _        d S rc   )rd   r   rR   r   rf   s     r$   rg   z)AsyncSpeechWithStreamingResponse.__init__   s&    ?M*
 
r&   Nrn   ri   rX   r&   r$   r\   r\      rq   r&   r\   )+
__future__r   typingr   typing_extensionsr   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   types.audior   _base_clientr   types.audio.speech_modelr   __all__r   r   r   rZ   r'   r\   rX   r&   r$   <module>r      s_   # " " " " "       % % % % % %              K K K K K K K K K K K K K K K K K K < < < < < < < < & & & & & & : : : : : : : :            0 / / / / / 0 0 0 0 0 0 3 3 3 3 3 3]
#]
 ]
 ]
 ]
 ]
_ ]
 ]
 ]
@]
 ]
 ]
 ]
 ]
" ]
 ]
 ]
@
 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
r&   