o
    Mfx+                     @  s0  d dl mZ d dlmZ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)List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)transcription_create_params)make_request_options)TranscriptionTranscriptionsAsyncTranscriptionsc                
   @  H   e Zd Zed"ddZed#ddZeeeeeddded		d$d d!ZdS )%r   returnTranscriptionsWithRawResponsec                 C     t | S N)r    self r%   g/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/openai/resources/audio/transcriptions.pywith_raw_response      z Transcriptions.with_raw_response#TranscriptionsWithStreamingResponsec                 C  r!   r"   )r)   r#   r%   r%   r&   with_streaming_response#   r(   z&Transcriptions.with_streaming_responseN	languagepromptresponse_formattemperaturetimestamp_granularitiesextra_headersextra_query
extra_bodytimeoutfiler   model Union[str, Literal['whisper-1']]r,   str | NotGivenr-   r.   @Literal['json', 'text', 'srt', 'verbose_json', 'vtt'] | NotGivenr/   float | NotGivenr0   +List[Literal['word', 'segment']] | NotGivenr1   Headers | Noner2   Query | Noner3   Body | Noner4   'float | httpx.Timeout | None | NotGivenr   c             
   C  sr   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 )	k  
        Transcribes audio into the input language.

        Args:
          file:
              The audio file object (not file name) to transcribe, 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.

          language: The language of the input audio. Supplying the input language in
              [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
              improve accuracy and latency.

          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 match the audio language.

          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.

          timestamp_granularities: The timestamp granularities to populate for this transcription.
              `response_format` must be set `verbose_json` to use timestamp granularities.
              Either or both of these options are supported: `word`, or `segment`. Note: There
              is no additional latency for segment timestamps, but generating word timestamps
              incurs additional latency.

          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
        r5   r6   r,   r-   r.   r/   r0   r5   pathsContent-Typemultipart/form-data/audio/transcriptionsr1   r2   r3   r4   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   TranscriptionCreateParamsr   r   r$   r5   r6   r,   r-   r.   r/   r0   r1   r2   r3   r4   rI   rJ   r%   r%   r&   create'   s,   <
zTranscriptions.create)r   r    )r   r)   r5   r   r6   r7   r,   r8   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r2   r=   r3   r>   r4   r?   r   r   __name__
__module____qualname__r   r'   r*   r
   rR   r%   r%   r%   r&   r          c                
   @  r   )%r   r   "AsyncTranscriptionsWithRawResponsec                 C  r!   r"   )rY   r#   r%   r%   r&   r'      r(   z%AsyncTranscriptions.with_raw_response(AsyncTranscriptionsWithStreamingResponsec                 C  r!   r"   )rZ   r#   r%   r%   r&   r*      r(   z+AsyncTranscriptions.with_streaming_responseNr+   r5   r   r6   r7   r,   r8   r-   r.   r9   r/   r:   r0   r;   r1   r<   r2   r=   r3   r>   r4   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@   rA   r5   rB   rD   rE   rF   NrG   rH   )r   r   r   r   rM   rN   rO   r   r   rP   r   r   rQ   r%   r%   r&   rR      s.   <zAsyncTranscriptions.create)r   rY   )r   rZ   rS   rT   r%   r%   r%   r&   r      rX   c                   @     e Zd ZdddZdS )	r    transcriptionsr   r   Nonec                 C     || _ t|j| _d S r"   )_transcriptionsr	   to_raw_response_wrapperrR   r$   r\   r%   r%   r&   __init__      
z&TranscriptionsWithRawResponse.__init__Nr\   r   r   r]   rU   rV   rW   rb   r%   r%   r%   r&   r           r    c                   @  r[   )	rY   r\   r   r   r]   c                 C  r^   r"   )r_   r	   async_to_raw_response_wrapperrR   ra   r%   r%   r&   rb      rc   z+AsyncTranscriptionsWithRawResponse.__init__Nr\   r   r   r]   re   r%   r%   r%   r&   rY      rf   rY   c                   @  r[   )	r)   r\   r   r   r]   c                 C     || _ t|j| _d S r"   )r_   r   rR   ra   r%   r%   r&   rb         
z,TranscriptionsWithStreamingResponse.__init__Nrd   re   r%   r%   r%   r&   r)      rf   r)   c                   @  r[   )	rZ   r\   r   r   r]   c                 C  ri   r"   )r_   r   rR   ra   r%   r%   r&   rb      rj   z1AsyncTranscriptionsWithStreamingResponse.__init__Nrh   re   r%   r%   r%   r&   rZ      rf   rZ   )-
__future__r   typingr   r   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.transcriptionr   __all__r   r   r    rY   r)   rZ   r%   r%   r%   r&   <module>   s(    aa			