
    j                    |    d dl mZ d dlZd dlmZ d dlmZ d dlmZ  ej                  e
      Zdd	 	 	 	 	 	 	 d	dZy)
    )annotationsN)BytesIO)	AudioData)
SetupErrorzcohere-transcribe-03-2026)modelc               h   	 ddl }t        |t              st        d      t        |j                               }d|_        |j                         }t        j                  d||       |j                  j                  j                  |||      }|j                  S # t        $ r t        d      w xY w)a8  Performs speech recognition on ``audio_data`` (an ``AudioData`` instance), using the `Cohere Transcribe <https://docs.cohere.com/docs/transcribe>`__ API via the official Python SDK.

    Requires the ``cohere`` package (install with ``pip install SpeechRecognition[cohere-api]``).
    Set environment variable ``CO_API_KEY`` as documented by Cohere; this library does not read or override it in code.

    ``language`` is required by the Cohere transcription API (e.g. ``"en"``, ``"ja"``).

    Detail: https://docs.cohere.com/reference/create-audio-transcription
    r   Nzomissing cohere module: ensure that cohere is set up correctly (e.g. pip install SpeechRecognition[cohere-api]).z0``audio_data`` must be an ``AudioData`` instancezSpeechRecognition_audio.wavz8cohere audio.transcriptions.create: model=%r language=%r)r   filelanguage)cohereImportErrorr   
isinstancer   
ValueErrorr   get_wav_datanameClientV2loggerdebugaudiotranscriptionscreatetext)
recognizer
audio_datar
   r   r   wav_dataclientresponses           j/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/speech_recognition/recognizers/cohere_api.py	recognizer      s     
 j),KLLz..01H1HM__F
LLB
 ||**11 2 H
 ==/  
@
 	

s   B B1)r   r   r
   strr   r   returnr   )
__future__r   loggingior   speech_recognition.audior   speech_recognition.exceptionsr   	getLogger__name__r   r        r   <module>r*      sV    "   . 4			8	$ -)) 	)
 ) 	)r)   