a
    !f                     @  s   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rddlmZmZ ddgZG dd deZG dd deZ G dd dZ!G dd dZ"dS )    )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                      s^   e Zd ZU ded< ddd fddZeeddded	d
dddddddddd
ddZ  ZS )r   SpeechWithRawResponsewith_raw_responser   Noneclientreturnc                   s   t  | t| | _d S N)super__init__r   r   selfr   	__class__ ^/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/audio/speech.pyr       s    zSpeech.__init__Nresponse_formatspeedextra_headersextra_query
extra_bodytimeoutstr(Union[str, Literal['tts-1', 'tts-1-hd']]<Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']0Literal['mp3', 'opus', 'aac', 'flac'] | NotGivenfloat | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   
inputmodelvoicer(   r)   r*   r+   r,   r-   r   c       	   
   	   C  s2   | j dt|||||dtjt||||	dtd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r8   r9   r:   r(   r)   r*   r+   r,   r-   bodyoptionsZcast_to_postr   r   ZSpeechCreateParamsr   r   
r"   r8   r9   r:   r(   r)   r*   r+   r,   r-   r%   r%   r&   create   s     )
zSpeech.create__name__
__module____qualname____annotations__r    r   rE   __classcell__r%   r%   r#   r&   r      s   

c                      s^   e Zd ZU ded< ddd fddZeeddded	d
dddddddddd
ddZ  ZS )r   AsyncSpeechWithRawResponser   r   r   r   c                   s   t  | t| | _d S r   )r   r    rL   r   r!   r#   r%   r&   r    ]   s    zAsyncSpeech.__init__Nr'   r.   r/   r0   r1   r2   r3   r4   r5   r6   r   r7   c       	   
   	     s8   | j dt|||||dtjt||||	dtdI dH S )r;   r<   r=   r>   r?   NrB   rD   r%   r%   r&   rE   a   s     )
zAsyncSpeech.createrF   r%   r%   r#   r&   r   Z   s   

c                   @  s   e Zd ZdddddZdS )r   r   r   speechr   c                 C  s   t |j| _d S r   )r   rE   r"   rN   r%   r%   r&   r       s    zSpeechWithRawResponse.__init__NrG   rH   rI   r    r%   r%   r%   r&   r      s   r   c                   @  s   e Zd ZdddddZdS )rL   r   r   rM   c                 C  s   t |j| _d S r   )r   rE   rO   r%   r%   r&   r       s    z#AsyncSpeechWithRawResponse.__init__NrP   r%   r%   r%   r&   rL      s   rL   )#
__future__r   typingr   r   Ztyping_extensionsr   Zhttpx_typesr   r   r	   r
   r   _utilsr   Z	_resourcer   r   	_responser   r   Ztypes.audior   Z_base_clientr   r   Z_clientr   r   __all__r   r   r   rL   r%   r%   r%   r&   <module>   s    CC