o
    h3C                     @  s,  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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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   )	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)transcription_create_params)make_request_options)TranscriptionTranscriptionsAsyncTranscriptionsc                   @  L   e Zd Zed$ddZed%ddZeeeeeeeddded	d&d"d#ZdS )'r   returnTranscriptionsWithRawResponsec                 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
        )r!   self r&   w/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/groq/resources/audio/transcriptions.pywith_raw_response!      z Transcriptions.with_raw_response#TranscriptionsWithStreamingResponsec                 C  r"   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
        )r*   r$   r&   r&   r'   with_streaming_response+      z&Transcriptions.with_streaming_responseNfilelanguagepromptresponse_formattemperaturetimestamp_granularitiesurlextra_headersextra_query
extra_bodytimeoutmodel'Union[str, Literal['whisper-large-v3']]r/   FileTypes | NotGivenr0   x  Union[str, Literal['en', 'zh', 'de', 'es', 'ru', 'ko', 'fr', 'ja', 'pt', 'tr', 'pl', 'ca', 'nl', 'ar', 'sv', 'it', 'id', 'hi', 'fi', 'vi', 'he', 'uk', 'el', 'ms', 'cs', 'ro', 'da', 'hu', 'ta', 'no', 'th', 'ur', 'hr', 'bg', 'lt', 'la', 'mi', 'ml', 'cy', 'sk', 'te', 'fa', 'lv', 'bn', 'sr', 'az', 'sl', 'kn', 'et', 'mk', 'br', 'eu', 'is', 'hy', 'ne', 'mn', 'bs', 'kk', 'sq', 'sw', 'gl', 'mr', 'pa', 'si', 'km', 'sn', 'yo', 'so', 'af', 'oc', 'ka', 'be', 'tg', 'sd', 'gu', 'am', 'yi', 'lo', 'uz', 'fo', 'ht', 'ps', 'tk', 'nn', 'mt', 'sa', 'lb', 'my', 'bo', 'tl', 'mg', 'as', 'tt', 'haw', 'ln', 'ha', 'ba', 'jv', 'su', 'yue']] | NotGivenr1   str | NotGivenr2   2Literal['json', 'text', 'verbose_json'] | NotGivenr3   float | NotGivenr4   +List[Literal['word', 'segment']] | NotGivenr5   r6   Headers | Noner7   Query | Noner8   Body | Noner9   'float | httpx.Timeout | None | NotGivenr   c             
   C  sp   t ||||||||d}tttttf |dggd}ddi|	p"i }	| jdt|tj	|t
|	|
||dtdS )	6	  
        Transcribes audio into the input language.

        Args:
          model: ID of the model to use. Only `whisper-large-v3` is currently available.

          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. Either a file or a URL must
              be provided. Note that the file field is not supported in Batch API requests.

          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](/docs/speech-text) should match the audio language.

          response_format: The format of the transcript output, in one of these options: `json`, `text`, or
              `verbose_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.

          url: The audio URL to translate/transcribe (supports Base64URL). Either a file or a
              URL must be provided. For Batch API requests, the URL field is required since
              the file field is not supported.

          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
        r:   r/   r0   r1   r2   r3   r4   r5   r/   pathsContent-Typemultipart/form-data/openai/v1/audio/transcriptionsr6   r7   r8   r9   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   TranscriptionCreateParamsr   r   r%   r:   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   rO   rP   r&   r&   r'   create4   s.    )
zTranscriptions.create)r    r!   )r    r*   r:   r;   r/   r<   r0   r=   r1   r>   r2   r?   r3   r@   r4   rA   r5   r>   r6   rB   r7   rC   r8   rD   r9   rE   r    r   __name__
__module____qualname__r   r(   r,   r	   rX   r&   r&   r&   r'   r       "    	jc                   @  r   )'r   r    "AsyncTranscriptionsWithRawResponsec                 C  r"   r#   )r_   r$   r&   r&   r'   r(      r)   z%AsyncTranscriptions.with_raw_response(AsyncTranscriptionsWithStreamingResponsec                 C  r"   r+   )r`   r$   r&   r&   r'   r,     r-   z+AsyncTranscriptions.with_streaming_responseNr.   r:   r;   r/   r<   r0   r=   r1   r>   r2   r?   r3   r@   r4   rA   r5   r6   rB   r7   rC   r8   rD   r9   rE   r   c             
     s~   t ||||||||d}tttttf |dggd}ddi|	p#i }	| jdt|tj	I dH |t
|	|
||dtd	I dH S )
rF   rG   r/   rH   rJ   rK   rL   NrM   rN   )r   r   r   r   rS   rT   rU   r   r   rV   r   r   rW   r&   r&   r'   rX     s0    )zAsyncTranscriptions.create)r    r_   )r    r`   rY   rZ   r&   r&   r&   r'   r      r^   c                   @     e Zd ZdddZdS )	r!   transcriptionsr   r    Nonec                 C     || _ t|j| _d S N)_transcriptionsr   rX   r%   rb   r&   r&   r'   __init__     
z&TranscriptionsWithRawResponse.__init__Nrb   r   r    rc   r[   r\   r]   rh   r&   r&   r&   r'   r!         r!   c                   @  ra   )	r_   rb   r   r    rc   c                 C  rd   re   )rf   r   rX   rg   r&   r&   r'   rh     ri   z+AsyncTranscriptionsWithRawResponse.__init__Nrb   r   r    rc   rk   r&   r&   r&   r'   r_     rl   r_   c                   @  ra   )	r*   rb   r   r    rc   c                 C  rd   re   )rf   r   rX   rg   r&   r&   r'   rh     ri   z,TranscriptionsWithStreamingResponse.__init__Nrj   rk   r&   r&   r&   r'   r*     rl   r*   c                   @  ra   )	r`   rb   r   r    rc   c                 C  rd   re   )rf   r   rX   rg   r&   r&   r'   rh     ri   z1AsyncTranscriptionsWithStreamingResponse.__init__Nrm   rk   r&   r&   r&   r'   r`     rl   r`   )-
__future__r   typingr   r   r   r   typing_extensionsr   httpx_typesr	   r
   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   types.audior   _base_clientr   types.audio.transcriptionr   __all__r   r   r!   r_   r*   r`   r&   r&   r&   r'   <module>   s*     Y Y			