
    h҂                       % S SK Jr  S SKrS SKJrJrJrJrJrJ	r	  S SK
JrJrJr  S SKrSSKJr  SSKJr  SSKJrJrJrJrJrJr  SS	KJrJrJrJrJr  SS
K J!r!  SSK"J#r#J$r$  SSK%J&r&J'r'  SSK(J)r)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3Jr  SSK4J5r5  SSK6J7r7  SSK8J9r9  SSK:J;r;  SS/r<\Rz                  " S5      r>S\?S'    " S S\#5      r@ " S S\$5      rA " S S5      rB " S S 5      rC " S! S"5      rD " S# S$5      rE    S&S% jrFg)'    )annotationsN)TYPE_CHECKINGListUnionMappingOptionalcast)Literaloverloadassert_never   )_legacy_response)AudioResponseFormat)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesrequired_argsmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)StreamAsyncStream)transcription_create_params)make_request_options)
AudioModel)Transcription)TranscriptionInclude)TranscriptionVerbose)TranscriptionStreamEvent)TranscriptionCreateResponseTranscriptionsAsyncTranscriptionszopenai.audio.transcriptionszlogging.Loggerlogc                     \ rS rSr\SS j5       r\SS j5       r\\\\\\\SSS\S.
                         SS jj5       r	\\\\\\SSS\S	.	                         SS
 jj5       r	\\\\\\SSS\S	.	                         SS jj5       r	\\\\\\\SSS\S.
                           SS jj5       r	\\\\\\\SSS\S.
                           SS jj5       r	\
" SS// SQ5      \\\\\\\SSS\S.                           SS jj5       r	Srg)r*   (   c                    [        U 5      $ z
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/openai/openai-python#accessing-raw-response-data-eg-headers
)TranscriptionsWithRawResponseselfs    W/var/www/html/env/lib/python3.13/site-packages/openai/resources/audio/transcriptions.pywith_raw_response Transcriptions.with_raw_response)   s     -T22    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)#TranscriptionsWithStreamingResponser2   s    r4   with_streaming_response&Transcriptions.with_streaming_response3   s     3488r7   N)
includeresponse_formatlanguageprompttemperaturetimestamp_granularitiesextra_headersextra_query
extra_bodytimeoutfilemodelc                   g N r3   rG   rH   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   s                r4   createTranscriptions.create<   s    $ r7   	r=   r?   r@   rA   rB   rC   rD   rE   rF   c                   g rJ   rK   rL   s                r4   rM   rN   P   s    $  #r7   c                   g rJ   rK   )r3   rG   rH   r>   r=   r?   r@   rA   rB   rC   rD   rE   rF   s                r4   rM   rN   d   s    $ r7   
r=   r?   r@   r>   rA   rB   rC   rD   rE   rF   c                   ga  
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. The options are `gpt-4o-transcribe`,
      `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source
      Whisper V2 model).

  stream: If set to true, the model response data will be streamed to the client as it is
      generated using
      [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
      See the
      [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
      for more information.

      Note: Streaming is not supported for the `whisper-1` model and will be ignored.

  include: Additional information to include in the transcription response. `logprobs` will
      return the log probabilities of the tokens in the response to understand the
      model's confidence in the transcription. `logprobs` only works with
      response_format set to `json` and only with the models `gpt-4o-transcribe` and
      `gpt-4o-mini-transcribe`.

  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) (e.g. `en`)
      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 output, in one of these options: `json`, `text`, `srt`,
      `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`,
      the only supported format is `json`.

  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
NrK   r3   rG   rH   streamr=   r?   r@   r>   rA   rB   rC   rD   rE   rF   s                 r4   rM   rN   x       ` 	r7   c                   grT   rK   rU   s                 r4   rM   rN      rW   r7   rG   rH   rV   r=   r?   r@   r>   rV   rA   rB   rC   rD   rE   rF   c               j   [        UUUUUUUUU	S.	5      n[        [        [        [        [
        4   U5      S//S9nSS0U
=(       d    0 En
U R                  S[        UU(       a  [        R                  O[        R                  5      U[        XXS9[        U5      U=(       d    S[        [           S	9$ 
N)	rG   rH   r=   r?   r@   r>   rV   rA   rB   rG   )pathszContent-Typezmultipart/form-dataz/audio/transcriptions)rC   rD   rE   rF   F)bodyfilesoptionscast_torV   
stream_cls)r   r   r	   r   strobject_postr   r"   "TranscriptionCreateParamsStreaming%TranscriptionCreateParamsNonStreamingr#   _get_response_format_typer    r(   r3   rG   rH   r=   r?   r@   r>   rV   rA   rB   rC   rD   rE   rF   r^   r_   s                   r4   rM   rN     s    (  "$ #2 *+B

 d73;#7>xjQ ()>X=CVTVXzz#  ,NN0VV	 (+Q[ .o>?U67  
 	
r7   rK   )returnr1   )rj   r:   )rG   r   rH   Union[str, AudioModel]r=   %List[TranscriptionInclude] | NotGivenr>    Union[Literal['json'], NotGiven]r?   str | NotGivenr@   rn   rA   float | NotGivenrB   +List[Literal['word', 'segment']] | NotGivenrC   Headers | NonerD   Query | NonerE   Body | NonerF   'float | httpx.Timeout | None | NotGivenrj   r%   rG   r   rH   rk   r=   rl   r>   zLiteral['verbose_json']r?   rn   r@   rn   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   r'   )rG   r   rH   rk   r>   Literal['text', 'srt', 'vtt']r=   rl   r?   rn   r@   rn   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   rc   )rG   r   rH   rk   rV   Literal[True]r=   rl   r?   rn   r@   rn   r>   $Union[AudioResponseFormat, NotGiven]rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   z Stream[TranscriptionStreamEvent])rG   r   rH   rk   rV   boolr=   rl   r?   rn   r@   rn   r>   rx   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   z>TranscriptionCreateResponse | Stream[TranscriptionStreamEvent])rG   r   rH   rk   r=   rl   r?   rn   r@   rn   r>   rx   rV   3Optional[Literal[False]] | Literal[True] | NotGivenrA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   zMstr | Transcription | TranscriptionVerbose | Stream[TranscriptionStreamEvent]__name__
__module____qualname____firstlineno__r   r5   r;   r   r   rM   r   __static_attributes__rK   r7   r4   r*   r*   (   s   3 3 9 9  :C<E#,!*(1OX )-$("&;D!  &	
 7 : !  & "M & "    9!" 
# &  :C#,!*(1OX )-$("&;D!# # &	#
 7# 1# !# # &# "M# &# "#  #  9!#" 
## #&  :C#,!*(1OX )-$("&;D!  &	
 7 7 !  & "M & "    9!" 
# &  :C#,!*@I(1OX )-$("&;D#O O &	O
 O 7O !O O >O &O "MO &O "O   !O" 9#O$ 
*%O Ob  :C#,!*@I(1OX )-$("&;D#O O &	O
 O 7O !O O >O &O "MO &O "O   !O" 9#O$ 
H%O Ob FG$&AB :C#,!*@IFO(1OX )-$("&;D#4
 4
 &	4

 74
 !4
 4
 >4
 D4
 &4
 "M4
 &4
 "4
   !4
" 9#4
$ 
W%4
 C4
r7   c                     \ rS rSr\SS j5       r\SS j5       r\\\\\\\SSS\S.
                         SS jj5       r	\\\\\\SSS\S	.	                         SS
 jj5       r	\\\\\\SSS\S	.	                         SS jj5       r	\\\\\\\SSS\S.
                           SS jj5       r	\\\\\\\SSS\S.
                           SS jj5       r	\
" SS// SQ5      \\\\\\\SSS\S.                           SS jj5       r	Srg)r+   iT  c                    [        U 5      $ r0   )"AsyncTranscriptionsWithRawResponser2   s    r4   r5   %AsyncTranscriptions.with_raw_responseU  s     2$77r7   c                    [        U 5      $ r9   )(AsyncTranscriptionsWithStreamingResponser2   s    r4   r;   +AsyncTranscriptions.with_streaming_response_  s     8==r7   N)
r>   r?   r@   rA   r=   rB   rC   rD   rE   rF   rG   rH   c                  #    g 7frJ   rK   )r3   rG   rH   r>   r?   r@   rA   r=   rB   rC   rD   rE   rF   s                r4   rM   AsyncTranscriptions.createh  s
     $    rO   c                  #    g 7frJ   rK   rL   s                r4   rM   r   |  s
     $  #r   c                  #    g 7frJ   rK   rL   s                r4   rM   r     s
     $ r   rR   c                  #    g7frT   rK   rU   s                 r4   rM   r          ` 	r   c                  #    g7frT   rK   rU   s                 r4   rM   r     r   r   rY   rZ   c                 #    [        UUUUUUUUU	S.	5      n[        [        [        [        [
        4   U5      S//S9nSS0U
=(       d    0 En
U R                  S[        UU(       a  [        R                  O[        R                  5      I S h  vN U[        XXS9[        U5      U=(       d    S[        [           S	9I S h  vN $  N8 N7fr\   )r   r   r	   r   rc   rd   re   r   r"   rf   rg   r#   rh   r!   r(   ri   s                   r4   rM   r   H  s     (  "$ #2 *+B

 d73;#7>xjQ ()>X=CVTVXZZ#, ,NN0VV	  (+Q[ .o>?U"#;<   
 
 	

s$   BCC
3CC	C	CrK   )rj   r   )rj   r   )rG   r   rH   rk   r>   rm   r?   rn   r@   rn   rA   ro   r=   rl   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   r%   ru   )rG   r   rH   rk   r=   rl   r>   rv   r?   rn   r@   rn   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   rc   )rG   r   rH   rk   rV   rw   r=   rl   r?   rn   r@   rn   r>   rx   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   z%AsyncStream[TranscriptionStreamEvent])rG   r   rH   rk   rV   ry   r=   rl   r?   rn   r@   rn   r>   rx   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   zCTranscriptionCreateResponse | AsyncStream[TranscriptionStreamEvent])rG   r   rH   rk   r=   rl   r?   rn   r@   rn   r>   rx   rV   rz   rA   ro   rB   rp   rC   rq   rD   rr   rE   rs   rF   rt   rj   zRTranscription | TranscriptionVerbose | str | AsyncStream[TranscriptionStreamEvent]r{   rK   r7   r4   r+   r+   T  s   8 8 > >  =F#,!*(19BOX )-$("&;D!  &	
 : !  & 7 "M & "    9!" 
# &  :C#,!*(1OX )-$("&;D!# # &	#
 7# 1# !# # &# "M# &# "#  #  9!#" 
## #&  :C#,!*(1OX )-$("&;D!  &	
 7 7 !  & "M & "    9!" 
# &  :C#,!*@I(1OX )-$("&;D#O O &	O
 O 7O !O O >O &O "MO &O "O   !O" 9#O$ 
/%O Ob  :C#,!*@I(1OX )-$("&;D#O O &	O
 O 7O !O O >O &O "MO &O "O   !O" 9#O$ 
M%O Ob FG$&AB :C#,!*@IFO(1OX )-$("&;D#4
 4
 &	4

 74
 !4
 4
 >4
 D4
 &4
 "M4
 &4
 "4
   !4
" 9#4
$ 
\%4
 C4
r7   c                      \ rS rSrSS jrSrg)r1   i  c                Z    Xl         [        R                  " UR                  5      U l        g rJ   )_transcriptionsr   to_raw_response_wrapperrM   r3   transcriptionss     r4   __init__&TranscriptionsWithRawResponse.__init__  s#    -&>>!!
r7   r   rM   Nr   r*   rj   Noner|   r}   r~   r   r   r   rK   r7   r4   r1   r1         
r7   r1   c                      \ rS rSrSS jrSrg)r   i  c                Z    Xl         [        R                  " UR                  5      U l        g rJ   )r   r   async_to_raw_response_wrapperrM   r   s     r4   r   +AsyncTranscriptionsWithRawResponse.__init__  s#    -&DD!!
r7   r   Nr   r+   rj   r   r   rK   r7   r4   r   r     r   r7   r   c                      \ rS rSrSS jrSrg)r:   i  c                D    Xl         [        UR                  5      U l        g rJ   )r   r   rM   r   s     r4   r   ,TranscriptionsWithStreamingResponse.__init__  s    -2!!
r7   r   Nr   r   rK   r7   r4   r:   r:     r   r7   r:   c                      \ rS rSrSS jrSrg)r   i  c                D    Xl         [        UR                  5      U l        g rJ   )r   r   rM   r   s     r4   r   1AsyncTranscriptionsWithStreamingResponse.__init__  s    -8!!
r7   r   Nr   r   rK   r7   r4   r   r     r   r7   r   c                   [        U [        5      (       d  U c  [        $ U S:X  a  [        $ U S:X  a  [        $ U S:X  d  U S:X  d  U S:X  a  [        $ [
        (       a  [        U 5        g [        R                  SU 5        [        $ )Njsonverbose_jsonsrttextvttz$Unexpected audio response format: %s)	
isinstancer   r%   r'   rc   r   r   r,   warn)r>   s    r4   rh   rh     sv     /8,,0G& 	N	*##	E	!_%>/UZBZ
	_%7Ir7   )r>   z@Literal['json', 'text', 'srt', 'verbose_json', 'vtt'] | NotGivenrj   z0type[Transcription | TranscriptionVerbose | str])G
__future__r   loggingtypingr   r   r   r   r   r	   typing_extensionsr
   r   r   httpx r   typesr   _typesr   r   r   r   r   r   _utilsr   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   
_streamingr    r!   types.audior"   _base_clientr#   types.audio_modelr$   types.audio.transcriptionr%   types.audio_response_format!types.audio.transcription_includer&   !types.audio.transcription_verboser'   &types.audio.transcription_stream_eventr(   )types.audio.transcription_create_responser)   __all__	getLoggerr,   __annotations__r*   r+   r1   r   r:   r   rh   rK   r7   r4   <module>r      s    #  F F = =    ( J J  ' : Y - 6 0 + 6 > E E N T2
3''(EF^ Fi
_ i
X	i
* i
X	
 

 

 

 
U5r7   