
    sg                     6    d dl mZmZ ddlmZ  G d de      Zy)   )WhisperForConditionalGenerationWhisperProcessor   )PipelineToolc                   D    e Zd ZdZdZdZeZeZ	ddddiZ
dZd Zd	 Zd
 Zy)SpeechToTextToolzdistil-whisper/distil-large-v3zTThis is a tool that transcribes an audio into text. It returns the transcribed text.transcriberaudiozThe audio to transcribe)typedescriptionstringc                 (    | j                  |d      S )Npt)return_tensors)pre_processor)selfr
   s     U/var/www/html/venv/lib/python3.12/site-packages/transformers/agents/speech_to_text.pyencodezSpeechToTextTool.encode    s    !!%!==    c                 >    | j                   j                  |d         S )Ninput_features)modelgenerate)r   inputss     r   forwardzSpeechToTextTool.forward#   s    zz""6*:#;<<r   c                 B    | j                   j                  |d      d   S )NT)skip_special_tokens    )r   batch_decode)r   outputss     r   decodezSpeechToTextTool.decode&   s$    !!..wD.QRSTTr   N)__name__
__module____qualname__default_checkpointr   namer   pre_processor_classr   model_classr   output_typer   r   r!    r   r   r   r      sB    9hKD*1K8QRSFK>=Ur   r   N)models.whisperr   r   toolsr   r   r*   r   r   <module>r-      s   $ O U| Ur   