o
    Ö­jT  ã                   @  s|   d dl 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lmZ ed ZG dd	„ d	ed
d�Zddœddd„ZdS )é    )Úannotations)ÚLiteralÚ	TypedDict)ÚUnpack)Ú	AudioData)Ú
SetupError)ÚOpenAICompatibleRecognizer)úwhisper-large-v3-turbozwhisper-large-v3c                   @  s2   e Zd ZU dZded< ded< ded< ded< dS )	ÚGroqOptionalParameterszzGroq speech transcription's optional parameters.

    https://console.groq.com/docs/api-reference#audio-transcription
    ÚstrÚpromptÚresponse_formatÚfloatÚtemperatureÚlanguageN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© r   r   úl/var/www/html/CropPilot/venv/lib/python3.10/site-packages/speech_recognition/recognizers/whisper_api/groq.pyr
      s   
 r
   F)Útotalr	   )ÚmodelÚ
audio_dataú'AudioData'r   Ú	GroqModelÚkwargsúUnpack[GroqOptionalParameters]Úreturnr   c                K  sD   zddl }W n ty   tdƒ‚w t| ¡ ƒ}|j||fi |¤ŽS )aª  Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the Groq Whisper API.

    This function requires login to Groq; visit https://console.groq.com/login, then generate API Key in `API Keys <https://console.groq.com/keys>`__ menu.

    Detail: https://console.groq.com/docs/speech-to-text

    Set environment variable ``GROQ_API_KEY``; otherwise groq library will raise a ``groq.GroqError``.
    r   Nz:missing groq module: ensure that groq is set up correctly.)ÚgroqÚImportErrorr   r   ÚGroqÚ	recognize)Ú
recognizerr   r   r   r    Úgroq_recognizerr   r   r   r#      s   ÿÿr#   N)r   r   r   r   r   r   r   r   )Ú
__future__r   Útypingr   r   Útyping_extensionsr   Úspeech_recognition.audior   Úspeech_recognition.exceptionsr   Ú/speech_recognition.recognizers.whisper_api.baser   r   r
   r#   r   r   r   r   Ú<module>   s    ÿü