o
    Mf                     @  s  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 deZ!G dd deZ"G dd dZ#G dd dZ$G dd dZ%G d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                   @  B   e Zd ZedddZed ddZeeddded	d!ddZdS )"r   returnSpeechWithRawResponsec                 C     t | S N)r   self r    _/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/openai/resources/audio/speech.pywith_raw_response!      zSpeech.with_raw_responseSpeechWithStreamingResponsec                 C  r   r   )r$   r   r    r    r!   with_streaming_response%   r#   zSpeech.with_streaming_responseN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       	   
   	   C  sD   ddi|pi }| j dt|||||dtjt||||	dtj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`. 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-   r/   r1   r'   r(   r)   r*   r+   r,   bodyoptionscast_to)_postr   r   SpeechCreateParamsr   r   HttpxBinaryResponseContent
r   r-   r/   r1   r'   r(   r)   r*   r+   r,   r    r    r!   create)   s"   ,
zSpeech.create)r   r   )r   r$   r-   r.   r/   r0   r1   r2   r'   r3   r(   r4   r)   r5   r*   r6   r+   r7   r,   r8   r   r9   __name__
__module____qualname__r   r"   r%   r   rH   r    r    r    r!   r           	c                   @  r   )"r   r   AsyncSpeechWithRawResponsec                 C  r   r   )rO   r   r    r    r!   r"   j   r#   zAsyncSpeech.with_raw_response AsyncSpeechWithStreamingResponsec                 C  r   r   )rP   r   r    r    r!   r%   n   r#   z#AsyncSpeech.with_streaming_responseNr&   r-   r.   r/   r0   r1   r2   r'   r3   r(   r4   r)   r5   r*   r6   r+   r7   r,   r8   r9   c       	   
   	     sR   ddi|pi }| j dt|||||dtjI dH t||||	dtjdI dH S )r:   r;   r<   r=   r>   Nr?   r@   )rD   r   r   rE   r   r   rF   rG   r    r    r!   rH   r   s$   ,
zAsyncSpeech.create)r   rO   )r   rP   rI   rJ   r    r    r    r!   r   i   rN   c                   @     e Zd ZdddZdS )	r   speechr   r   Nonec                 C     || _ t|j| _d S r   )_speechr   to_raw_response_wrapperrH   r   rR   r    r    r!   __init__      
zSpeechWithRawResponse.__init__NrR   r   r   rS   rK   rL   rM   rX   r    r    r    r!   r          r   c                   @  rQ   )	rO   rR   r   r   rS   c                 C  rT   r   )rU   r   async_to_raw_response_wrapperrH   rW   r    r    r!   rX      rY   z#AsyncSpeechWithRawResponse.__init__NrR   r   r   rS   r[   r    r    r    r!   rO      r\   rO   c                   @  rQ   )	r$   rR   r   r   rS   c                 C     || _ t|jt| _d S r   )rU   r   rH   r   rW   r    r    r!   rX      
   
z$SpeechWithStreamingResponse.__init__NrZ   r[   r    r    r    r!   r$      r\   r$   c                   @  rQ   )	rP   rR   r   r   rS   c                 C  r_   r   )rU   r   rH   r   rW   r    r    r!   rX      r`   z)AsyncSpeechWithStreamingResponse.__init__Nr^   r[   r    r    r    r!   rP      r\   rP   )'
__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   rO   r$   rP   r    r    r    r!   <module>   s&   II		
