
    f j                    ^   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 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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)	NOT_GIVENBodyQueryHeadersNotGiven)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SpeechAsyncSpeechc                  V    e Zd Zedd            Zedd            ZeedddedddZdS )r   returnSpeechWithRawResponsec                     t          |           S N)r   selfs    qC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\openai/resources/audio/speech.pywith_raw_responsezSpeech.with_raw_response!   s    $T***    SpeechWithStreamingResponsec                     t          |           S r   )r$   r   s    r!   with_streaming_responsezSpeech.with_streaming_response%   s    *4000r#   Nresponse_formatspeedextra_headersextra_query
extra_bodytimeoutinputstrmodel(Union[str, Literal['tts-1', 'tts-1-hd']]voice<Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']r(   >Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'] | NotGivenr)   float | NotGivenr*   Headers | Noner+   Query | Noner,   Body | Noner-   '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` or `tts-1-hd`

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

          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.

          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r.   r0   r2   r(   r)   r*   r+   r,   r-   bodyoptionscast_to)_postr   r   SpeechCreateParamsr   r   HttpxBinaryResponseContent
r    r.   r0   r2   r(   r)   r*   r+   r,   r-   s
             r!   createzSpeech.create)   s    X "#=W-BUSUWzz """'6"  %7	 	 )+Q[el   %?  
 
 	
r#   )r   r   )r   r$   r.   r/   r0   r1   r2   r3   r(   r4   r)   r5   r*   r6   r+   r7   r,   r8   r-   r9   r   r:   __name__
__module____qualname__r   r"   r&   r   rJ    r#   r!   r   r       s        + + + _+ 1 1 1 _1 [d"+ )-$("&;D=
 =
 =
 =
 =
 =
 =
 =
r#   c                  V    e Zd Zedd            Zedd            ZeedddedddZdS )r   r   AsyncSpeechWithRawResponsec                     t          |           S r   )rR   r   s    r!   r"   zAsyncSpeech.with_raw_responsej   s    )$///r#    AsyncSpeechWithStreamingResponsec                     t          |           S r   )rT   r   s    r!   r&   z#AsyncSpeech.with_streaming_responsen   s    /555r#   Nr'   r.   r/   r0   r1   r2   r3   r(   r4   r)   r5   r*   r6   r+   r7   r,   r8   r-   r9   r:   c       	           K   ddi|pi }|                      dt          |||||dt          j                   d{V t	          ||||	          t
          j                   d{V S )r<   r=   r>   r?   r@   NrA   rB   )rF   r   r   rG   r   r   rH   rI   s
             r!   rJ   zAsyncSpeech.creater   s      X "#=W-BUSUWZZ,"""'6"  %7	 	 	 	 	 	 	 	 )+Q[el   %?   
 
 
 
 
 
 
 
 	
r#   )r   rR   )r   rT   rK   rL   rP   r#   r!   r   r   i   s        0 0 0 _0 6 6 6 _6 [d"+ )-$("&;D=
 =
 =
 =
 =
 =
 =
 =
r#   c                      e Zd ZddZdS )r   speechr   r   Nonec                P    || _         t          j        |j                  | _        d S r   )_speechr   to_raw_response_wrapperrJ   r    rX   s     r!   __init__zSpeechWithRawResponse.__init__   s&    &>M
 
r#   NrX   r   r   rY   rM   rN   rO   r^   rP   r#   r!   r   r      (        
 
 
 
 
 
r#   r   c                      e Zd ZddZdS )rR   rX   r   r   rY   c                P    || _         t          j        |j                  | _        d S r   )r[   r   async_to_raw_response_wrapperrJ   r]   s     r!   r^   z#AsyncSpeechWithRawResponse.__init__   s&    &DM
 
r#   NrX   r   r   rY   r`   rP   r#   r!   rR   rR      ra   r#   rR   c                      e Zd ZddZdS )r$   rX   r   r   rY   c                R    || _         t          |j        t                    | _        d S r   )r[   r   rJ   r   r]   s     r!   r^   z$SpeechWithStreamingResponse.__init__   s&    9M%
 
r#   Nr_   r`   rP   r#   r!   r$   r$      (        
 
 
 
 
 
r#   r$   c                      e Zd ZddZdS )rT   rX   r   r   rY   c                R    || _         t          |j        t                    | _        d S r   )r[   r   rJ   r   r]   s     r!   r^   z)AsyncSpeechWithStreamingResponse.__init__   s&    ?M*
 
r#   Nre   r`   rP   r#   r!   rT   rT      rh   r#   rT   )'
__future__r   typingr   typing_extensionsr   httpx r   _typesr   r	   r
   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   types.audior   _base_clientr   __all__r   r   r   rR   r$   rT   rP   r#   r!   <module>rx      sa   # " " " " "       % % % % % %              ? ? ? ? ? ? ? ? ? ? ? ? ? ?        ' & & & & & : : : : : : : :            0 / / / / /      ]
#F
 F
 F
 F
 F
_ F
 F
 F
RF
 F
 F
 F
 F
" F
 F
 F
R
 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
r#   