
    +h                       d dl mZ d dlmZmZ d dlmZ d dlZddlm	Z	m
Z
mZmZmZ ddlmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZmZ erddlmZmZ ddgZ G d de      Z G d de      Z  G d d      Z! G d d      Z"y)    )annotations)TYPE_CHECKINGUnion)LiteralN   )	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)speech_create_params)HttpxBinaryResponseContentmake_request_options)OpenAIAsyncOpenAISpeechAsyncSpeechc                  j     e Zd ZU ded<   d fdZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ xZS )	r   SpeechWithRawResponsewith_raw_responsec                D    t         |   |       t        |       | _        y N)super__init__r   r   selfclient	__class__s     P/var/www/html/venv/lib/python3.12/site-packages/openai/resources/audio/speech.pyr   zSpeech.__init__   s     !6t!<    Nresponse_formatspeedextra_headersextra_query
extra_bodytimeoutc       	            | j                  dt        |||||dt        j                        t	        ||||	      t
              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`.

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

          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
        /audio/speechinputmodelvoicer'   r(   r)   r*   r+   r,   bodyoptionscast_to_postr   r   SpeechCreateParamsr   r   
r!   r1   r2   r3   r'   r(   r)   r*   r+   r,   s
             r$   createzSpeech.create   s_    R zz """'6" %77	 )+Q[el /  
 	
r%   )r"   r   returnNoner1   strr2   z(Union[str, Literal['tts-1', 'tts-1-hd']]r3   z<Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']r'   z0Literal['mp3', 'opus', 'aac', 'flac'] | NotGivenr(   zfloat | NotGivenr)   zHeaders | Noner*   zQuery | Noner+   zBody | Noner,   z'float | httpx.Timeout | None | NotGivenr>   r   __name__
__module____qualname____annotations__r   r   r=   __classcell__r#   s   @r$   r   r      s    ,,= MV"+ )-$("&;D9
 9
 8	9

 L9
 J9
  9
 &9
 "9
  9
 99
 
$9
r%   c                  j     e Zd ZU ded<   d fdZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ xZS )	r   AsyncSpeechWithRawResponser   c                D    t         |   |       t        |       | _        y r   )r   r   rJ   r   r    s     r$   r   zAsyncSpeech.__init__]   s     !;D!Ar%   Nr&   c       	           K   | j                  dt        |||||dt        j                        t	        ||||	      t
               d{   S 7 w)r.   r/   r0   r4   r5   Nr9   r<   s
             r$   r=   zAsyncSpeech.createa   sm     R ZZ """'6" %77	 )+Q[el /   
 
 	
 
s   AA
AA)r"   r   r>   r?   r@   rB   rH   s   @r$   r   r   Z   s    11B MV"+ )-$("&;D9
 9
 8	9

 L9
 J9
  9
 &9
 "9
  9
 99
 
$9
r%   c                      e Zd ZddZy)r   c                8    t        |j                        | _        y r   )r   r=   r!   speechs     r$   r   zSpeechWithRawResponse.__init__   s    -MM
r%   N)rP   r   r>   r?   rC   rD   rE   r    r%   r$   r   r          
r%   r   c                      e Zd ZddZy)rJ   c                8    t        |j                        | _        y r   )r   r=   rO   s     r$   r   z#AsyncSpeechWithRawResponse.__init__   s    3MM
r%   N)rP   r   r>   r?   rQ   rR   r%   r$   rJ   rJ      rS   r%   rJ   )#
__future__r   typingr   r   typing_extensionsr   httpx_typesr   r	   r
   r   r   _utilsr   	_resourcer   r   	_responser   r   types.audior   _base_clientr   r   _clientr   r   __all__r   r   r   rJ   rR   r%   r$   <module>rb      sk    # ' %  ? ? % : O / L.]
#@
_ @
F@
" @
F
 

 
r%   