
    ^=i                     D   d dl mZ d dlmZ d dlmZ d dl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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*y)    )annotations)Union)LiteralN   )BodyOmitQueryHeadersNotGivenomit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)BinaryAPIResponseAsyncBinaryAPIResponseStreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_custom_raw_response_wrapper#to_custom_streamed_response_wrapper$async_to_custom_raw_response_wrapper)async_to_custom_streamed_response_wrapper)speech_create_params)make_request_optionsSpeechAsyncSpeechc                  t    e Zd Zedd       Zedd       Zeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)	r   c                    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/groq/groq-python#accessing-raw-response-data-eg-headers
        )SpeechWithRawResponseselfs    X/home/rose/Desktop/poly/venv/lib/python3.12/site-packages/groq/resources/audio/speech.pywith_raw_responsezSpeech.with_raw_response   s     %T**    c                    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/groq/groq-python#with_streaming_response
        )SpeechWithStreamingResponser#   s    r%   with_streaming_responsezSpeech.with_streaming_response)   s     +400r'   Nresponse_formatsample_ratespeedextra_headersextra_query
extra_bodytimeoutc       
            ddi|xs i }| j                  dt        ||||||dt        j                        t	        |||	|
      t
              S )L  
        Generates audio from the input text.

        Args:
          input: The text to generate audio for.

          model: One of the [available TTS models](/docs/text-to-speech).

          voice: The voice to use when generating the audio. List of voices can be found
              [here](/docs/text-to-speech).

          response_format: The format of the generated audio. Supported formats are
              `flac, mp3, mulaw, ogg, wav`.

          sample_rate: The sample rate for generated audio

          speed: The speed of the generated audio.

          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	audio/wav/openai/v1/audio/speechinputmodelvoicer-   r.   r/   r0   r1   r2   r3   bodyoptionscast_to)_postr   r   SpeechCreateParamsr   r   r$   r:   r;   r<   r-   r.   r/   r0   r1   r2   r3   s              r%   createzSpeech.create2   sv    T ";H=3FBHzz% """'6#." %77
 )+Q[el &!  
 	
r'   )returnr"   )rF   r*   )r:   strr;   6Union[str, Literal['playai-tts', 'playai-tts-arabic']]r<   rG   r-   4Literal['flac', 'mp3', 'mulaw', 'ogg', 'wav'] | Omitr.   >Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000] | Omitr/   float | Omitr0   Headers | Noner1   Query | Noner2   Body | Noner3   'float | httpx.Timeout | None | NotGivenrF   r   	__name__
__module____qualname__r   r&   r+   r   r   rE    r'   r%   r   r      s    + + 1 1 QUVZ" )-$("&;D<
 <
 F	<

 <
 N<
 T<
 <
 &<
 "<
  <
 9<
 
<
r'   c                  t    e Zd Zedd       Zedd       Zeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)	r   c                    t        |       S r!   )AsyncSpeechWithRawResponser#   s    r%   r&   zAsyncSpeech.with_raw_responser   s     *$//r'   c                    t        |       S r)   ) AsyncSpeechWithStreamingResponser#   s    r%   r+   z#AsyncSpeech.with_streaming_response|   s     055r'   Nr,   c       
           K   ddi|xs i }| j                  dt        ||||||dt        j                         d{   t	        |||	|
      t
               d{   S 7 $7 w)r5   r6   r7   r8   r9   Nr=   r>   )rB   r   r   rC   r   r   rD   s              r%   rE   zAsyncSpeech.create   s     T ";H=3FBHZZ%,"""'6#." %77
 
 )+Q[el +!   
 
 	


s!   ;A&A"
A&A$A&$A&)rF   rW   )rF   rY   )r:   rG   r;   rH   r<   rG   r-   rI   r.   rJ   r/   rK   r0   rL   r1   rM   r2   rN   r3   rO   rF   r   rP   rT   r'   r%   r   r   q   s    0 0 6 6 QUVZ" )-$("&;D<
 <
 F	<

 <
 N<
 T<
 <
 &<
 "<
  <
 9<
 
 <
r'   c                      e Zd ZddZy)r"   c                P    || _         t        |j                  t              | _        y N)_speechr   rE   r   r$   speechs     r%   __init__zSpeechWithRawResponse.__init__   s    4MM
r'   Nr`   r   rF   NonerQ   rR   rS   ra   rT   r'   r%   r"   r"          
r'   r"   c                      e Zd ZddZy)rW   c                P    || _         t        |j                  t              | _        y r]   )r^   r   rE   r   r_   s     r%   ra   z#AsyncSpeechWithRawResponse.__init__   s    :MM"
r'   Nr`   r   rF   rc   rd   rT   r'   r%   rW   rW      re   r'   rW   c                      e Zd ZddZy)r*   c                P    || _         t        |j                  t              | _        y r]   )r^   r   rE   r   r_   s     r%   ra   z$SpeechWithStreamingResponse.__init__   s    9MM%
r'   Nrb   rd   rT   r'   r%   r*   r*      re   r'   r*   c                      e Zd ZddZy)rY   c                P    || _         t        |j                  t              | _        y r]   )r^   r   rE   r   r_   s     r%   ra   z)AsyncSpeechWithStreamingResponse.__init__   s    ?MM*
r'   Nrh   rd   rT   r'   r%   rY   rY      re   r'   rY   )+
__future__r   typingr   typing_extensionsr   httpx_typesr   r   r	   r
   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   r   r   r   r   types.audior   _base_clientr   __all__r   r   r"   rW   r*   rY   rT   r'   r%   <module>ry      s    #  %  K K K < & :	 	 	 0 0]
#P
_ P
fP
" P
f
 

 

 

 
r'   