o
    Mfn#                     @  s,  d dl mZ d dlmZmZ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mZ ddl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" 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Mappingcast)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)translation_create_params)make_request_options)TranslationTranslationsAsyncTranslationsc                   @  D   e Zd ZedddZedddZeeeddded	d ddZdS )!r   returnTranslationsWithRawResponsec                 C     t | S N)r   self r$   e/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/openai/resources/audio/translations.pywith_raw_response      zTranslations.with_raw_response!TranslationsWithStreamingResponsec                 C  r    r!   )r(   r"   r$   r$   r%   with_streaming_response#   r'   z$Translations.with_streaming_responseNpromptresponse_formattemperatureextra_headersextra_query
extra_bodytimeoutfiler   model Union[str, Literal['whisper-1']]r+   str | NotGivenr,   r-   float | NotGivenr.   Headers | Noner/   Query | Noner0   Body | Noner1   'float | httpx.Timeout | None | NotGivenr   c       	      
   C  sn   t |||||d}
tttttf |
dggd}|r#ddi|p!i }| jdt|
tj	|t
||||	dtdS )	  
        Translates audio into English.

        Args:
          file: The audio file object (not file name) translate, in one of these formats: flac,
              mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.

          model: ID of the model to use. Only `whisper-1` (which is powered by our open source
              Whisper V2 model) is currently available.

          prompt: An optional text to guide the model's style or continue a previous audio
              segment. The
              [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
              should be in English.

          response_format: The format of the transcript output, in one of these options: `json`, `text`,
              `srt`, `verbose_json`, or `vtt`.

          temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
              output more random, while lower values like 0.2 will make it more focused and
              deterministic. If set to 0, the model will use
              [log probability](https://en.wikipedia.org/wiki/Log_probability) to
              automatically increase the temperature until certain thresholds are hit.

          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
        r2   r3   r+   r,   r-   r2   pathsContent-Typemultipart/form-data/audio/translationsr.   r/   r0   r1   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   TranslationCreateParamsr   r   r#   r2   r3   r+   r,   r-   r.   r/   r0   r1   rD   rE   r$   r$   r%   create'   s(   /	
zTranslations.create)r   r   )r   r(   r2   r   r3   r4   r+   r5   r,   r5   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r   r   __name__
__module____qualname__r   r&   r)   r	   rM   r$   r$   r$   r%   r          c                   @  r   )!r   r    AsyncTranslationsWithRawResponsec                 C  r    r!   )rT   r"   r$   r$   r%   r&   q   r'   z#AsyncTranslations.with_raw_response&AsyncTranslationsWithStreamingResponsec                 C  r    r!   )rU   r"   r$   r$   r%   r)   u   r'   z)AsyncTranslations.with_streaming_responseNr*   r2   r   r3   r4   r+   r5   r,   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r   c       	      
     s|   t |||||d}
tttttf |
dggd}|r$ddi|p"i }| jdt|
tj	I dH |t
||||	dtd	I dH S )
r;   r<   r2   r=   r?   r@   rA   NrB   rC   )r   r   r   r   rH   rI   rJ   r   r   rK   r   r   rL   r$   r$   r%   rM   y   s*   /	zAsyncTranslations.create)r   rT   )r   rU   rN   rO   r$   r$   r$   r%   r   p   rS   c                   @     e Zd ZdddZdS )	r   translationsr   r   Nonec                 C     || _ t|j| _d S r!   )_translationsr   to_raw_response_wrapperrM   r#   rW   r$   r$   r%   __init__      
z$TranslationsWithRawResponse.__init__NrW   r   r   rX   rP   rQ   rR   r]   r$   r$   r$   r%   r          r   c                   @  rV   )	rT   rW   r   r   rX   c                 C  rY   r!   )rZ   r   async_to_raw_response_wrapperrM   r\   r$   r$   r%   r]      r^   z)AsyncTranslationsWithRawResponse.__init__NrW   r   r   rX   r`   r$   r$   r$   r%   rT      ra   rT   c                   @  rV   )	r(   rW   r   r   rX   c                 C     || _ t|j| _d S r!   )rZ   r   rM   r\   r$   r$   r%   r]         
z*TranslationsWithStreamingResponse.__init__Nr_   r`   r$   r$   r$   r%   r(      ra   r(   c                   @  rV   )	rU   rW   r   r   rX   c                 C  rd   r!   )rZ   r   rM   r\   r$   r$   r%   r]      re   z/AsyncTranslationsWithStreamingResponse.__init__Nrc   r`   r$   r$   r$   r%   rU      ra   rU   ),
__future__r   typingr   r   r   typing_extensionsr   httpx r   _typesr	   r
   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   types.audior   _base_clientr   types.audio.translationr   __all__r   r   r   rT   r(   rU   r$   r$   r$   r%   <module>   s(    RR			