o
    qmiI                     @   s   d dl 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 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZmZ ddlmZmZ e e jdZ G dd dZ!G dd dZ"dS )    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)BulkJobCallbackParams)SpeechToTextJobParametersParams)BulkJobInitResponseV1)FilesDownloadResponse)FilesUploadResponse)JobStatusV1Response)SpeechToTextModel)SpeechToTextLanguage)Mode   )AsyncRawSpeechToTextJobClientRawSpeechToTextJobClient)AsyncSpeechToTextJobSpeechToTextJob.c                   @   sr  e Zd ZdefddZedefddZeddd	e	d
e
je de
je defddZdddede
je defddZddddede
je de
je defddZdddede
je de
je defddZdddede
je de
je defddZddddddedfdede
je ded ed!e
je d"e
je d
e
je de
je defd#d$Zdedefd%d&Z dS )'SpeechToTextJobClientclient_wrapperc                C      t |d| _d S N)r   )r   _raw_clientselfr    r   V/home/ubuntu/.local/lib/python3.10/site-packages/sarvamai/speech_to_text_job/client.py__init__      zSpeechToTextJobClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawSpeechToTextJobClient
        r   r   r   r   r   with_raw_response      	z'SpeechToTextJobClient.with_raw_responseNcallbackrequest_optionsjob_parametersr&   r'   c                C      | j j|||d}|jS )a  
        Get a job uuid, and storage folder details for speech to text bulk job v1

        Parameters
        ----------
        job_parameters : SpeechToTextJobParametersParams
            Job Parameters for the bulk job

        callback : typing.Optional[BulkJobCallbackParams]
            Parameters for callback URL

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkJobInitResponseV1
            Successful Response

        Examples
        --------
        from sarvamai import SarvamAI

        client = SarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )
        client.speech_to_text_job.initialise(
            job_parameters={},
        )
        r(   r&   r'   r   
initialisedatar   r(   r&   r'   	_responser   r   r   r,   &   s   %z SpeechToTextJobClient.initialiser'   job_idc                C   s   | j j||d}|jS )ao  
        Get the status of a speech to text bulk job V1

        Parameters
        ----------
        job_id : str
            The unique identifier of the job

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        JobStatusV1Response
            Successful Response

        Examples
        --------
        from sarvamai import SarvamAI

        client = SarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )
        client.speech_to_text_job.get_status(
            job_id="job_id",
        )
        r0   r   
get_statusr-   r   r1   r'   r/   r   r   r   r3   R   s   z SpeechToTextJobClient.get_statusptu_idr'   r6   c                C   r)   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str
            The unique identifier of the job

        ptu_id : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        JobStatusV1Response
            Successful Response

        Examples
        --------
        from sarvamai import SarvamAI

        client = SarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )
        client.speech_to_text_job.start(
            job_id="job_id",
        )
        r5   r   startr-   r   r1   r6   r'   r/   r   r   r   r8   s      $zSpeechToTextJobClient.startfilesc                C   r)   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FilesUploadResponse
            Successful Response

        Examples
        --------
        from sarvamai import SarvamAI

        client = SarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )
        client.speech_to_text_job.get_upload_links(
            job_id="job_id",
            files=["files"],
        )
        r1   r;   r'   r   get_upload_linksr-   r   r1   r;   r'   r/   r   r   r   r>      r:   z&SpeechToTextJobClient.get_upload_linksc                C   r)   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FilesDownloadResponse
            Successful Response

        Examples
        --------
        from sarvamai import SarvamAI

        client = SarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )
        client.speech_to_text_job.get_download_links(
            job_id="job_id",
            files=["files"],
        )
        r<   r   get_download_linksr-   r?   r   r   r   rA      r:   z(SpeechToTextJobClient.get_download_linkssaarika:v2.5Fmodelmodewith_diarizationwith_timestampslanguage_codenum_speakersc	           
   	   C   s.   | j t||||||d||d}	t|	j| dS )aQ  
        Create a new Speech-to-Text bulk job.

        Parameters
        ----------
        model : SpeechToTextModel, default="saarika:v2.5"
            The model to use for transcription.

        mode : typing.Optional[Mode], default=None
            Mode of operation. Only applicable for saaras:v3 model.
            Options: transcribe, translate, indic-en, verbatim, translit, codemix

        with_diarization : typing.Optional[bool], default=False
            Whether to enable speaker diarization (distinguishing who said what).

        with_timestamps : typing.Optional[bool], default=False
            Whether to include word-level timestamps in the transcription output.

        language_code : typing.Optional[SpeechToTextLanguage], default=None
            The language code of the input audio (e.g., "hi-IN", "bn-IN").

        num_speakers : typing.Optional[int], default=None
            The number of distinct speakers in the audio, if known.

        callback : typing.Optional[BulkJobCallbackParams], default=OMIT
            Optional callback configuration to receive job completion events.

        request_options : typing.Optional[RequestOptions], default=None
            Request-specific configuration.

        Returns
        -------
        SpeechToTextJob
            A handle to the newly created Speech-to-Text job.
        )rG   rC   rD   rH   rE   rF   r*   r1   client)r,   r   r   r1   
r   rC   rD   rE   rF   rG   rH   r&   r'   responser   r   r   
create_job   s   .z SpeechToTextJobClient.create_jobc                 C   s   t || dS )aP  
        Get an existing Speech-to-Text job handle by job ID.

        Parameters
        ----------
        job_id : str
            The job ID of the previously created Speech-to-Text job.

        Returns
        -------
        SpeechToTextJob
            A job handle which can be used to check status or retrieve results.
        rI   )r   r   r1   r   r   r   get_job*  s   zSpeechToTextJobClient.get_job)!__name__
__module____qualname__r   r   propertyr   r#   OMITr   typingOptionalr   r   r   r,   strr   r3   intr8   Sequencer
   r>   r	   rA   r   r   boolr   r   rM   rO   r   r   r   r   r      s    
-
%
.
.
+	

<r   c                   @   sr  e Zd ZdefddZedefddZeddd	e	d
e
je de
je defddZdddede
je defddZddddede
je de
je defddZdddede
je de
je defddZdddede
je de
je defddZddddddedfdede
je ded ed!e
je d"e
je d
e
je de
je dd#fd$d%Zdedd#fd&d'ZdS )(AsyncSpeechToTextJobClientr   c                C   r   r   )r   r   r   r   r   r   r   <  r   z#AsyncSpeechToTextJobClient.__init__r   c                 C   r    )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawSpeechToTextJobClient
        r!   r"   r   r   r   r#   ?  r$   z,AsyncSpeechToTextJobClient.with_raw_responseNr%   r(   r&   r'   c                       | j j|||dI dH }|jS )a  
        Get a job uuid, and storage folder details for speech to text bulk job v1

        Parameters
        ----------
        job_parameters : SpeechToTextJobParametersParams
            Job Parameters for the bulk job

        callback : typing.Optional[BulkJobCallbackParams]
            Parameters for callback URL

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkJobInitResponseV1
            Successful Response

        Examples
        --------
        import asyncio

        from sarvamai import AsyncSarvamAI

        client = AsyncSarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )


        async def main() -> None:
            await client.speech_to_text_job.initialise(
                job_parameters={},
            )


        asyncio.run(main())
        r*   Nr+   r.   r   r   r   r,   J  s   -z%AsyncSpeechToTextJobClient.initialiser0   r1   c                   s   | j j||dI dH }|jS )a  
        Get the status of a speech to text bulk job V1

        Parameters
        ----------
        job_id : str
            The unique identifier of the job

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        JobStatusV1Response
            Successful Response

        Examples
        --------
        import asyncio

        from sarvamai import AsyncSarvamAI

        client = AsyncSarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )


        async def main() -> None:
            await client.speech_to_text_job.get_status(
                job_id="job_id",
            )


        asyncio.run(main())
        r0   Nr2   r4   r   r   r   r3   ~  s
   &z%AsyncSpeechToTextJobClient.get_statusr5   r6   c                   r\   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str
            The unique identifier of the job

        ptu_id : typing.Optional[int]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        JobStatusV1Response
            Successful Response

        Examples
        --------
        import asyncio

        from sarvamai import AsyncSarvamAI

        client = AsyncSarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )


        async def main() -> None:
            await client.speech_to_text_job.start(
                job_id="job_id",
            )


        asyncio.run(main())
        r5   Nr7   r9   r   r   r   r8     
   ,z AsyncSpeechToTextJobClient.startr;   c                   r\   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FilesUploadResponse
            Successful Response

        Examples
        --------
        import asyncio

        from sarvamai import AsyncSarvamAI

        client = AsyncSarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )


        async def main() -> None:
            await client.speech_to_text_job.get_upload_links(
                job_id="job_id",
                files=["files"],
            )


        asyncio.run(main())
        r<   Nr=   r?   r   r   r   r>     r]   z+AsyncSpeechToTextJobClient.get_upload_linksc                   r\   )a  
        Start a speech to text bulk job V1

        Parameters
        ----------
        job_id : str

        files : typing.Sequence[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        FilesDownloadResponse
            Successful Response

        Examples
        --------
        import asyncio

        from sarvamai import AsyncSarvamAI

        client = AsyncSarvamAI(
            api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
        )


        async def main() -> None:
            await client.speech_to_text_job.get_download_links(
                job_id="job_id",
                files=["files"],
            )


        asyncio.run(main())
        r<   Nr@   r?   r   r   r   rA     r]   z-AsyncSpeechToTextJobClient.get_download_linksrB   FrC   rD   rE   rF   rG   rH   r   c	           
   	      s6   | j t||||||d||dI dH }	t|	j| dS )a@  
        Create a new Speech-to-Text bulk job.

        Parameters
        ----------
        model : SpeechToTextModel, default="saarika:v2.5"
            The model to use for transcription.

        mode : typing.Optional[Mode], default=None
            Mode of operation. Only applicable for saaras:v3 model.
            Options: transcribe, translate, indic-en, verbatim, translit, codemix

        with_diarization : typing.Optional[bool], default=False
            Whether to enable speaker diarization (distinguishing who said what).

        with_timestamps : typing.Optional[bool], default=False
            Whether to include word-level timestamps in the transcription output.

        language_code : typing.Optional[SpeechToTextLanguage], default=None
            The language code of the input audio (e.g., "hi-IN", "bn-IN").

        num_speakers : typing.Optional[int] = None
            The number of distinct speakers in the audio, if known.

        callback : typing.Optional[BulkJobCallbackParams], default=OMIT
            Optional callback configuration to receive job completion events.

        request_options : typing.Optional[RequestOptions], default=None
            Request-specific configuration.

        Returns
        -------
        AsyncSpeechToTextJob
            A handle to the newly created job.
        )rG   rC   rD   rE   rF   rH   r*   NrI   )r,   r   r   r1   rK   r   r   r   rM   <  s   .z%AsyncSpeechToTextJobClient.create_jobc                    s   t || dS )aU  
        Get an existing Speech-to-Text job handle by job ID.

        Parameters
        ----------
        job_id : str
            The job ID of the previously created speech-to-text job.

        Returns
        -------
        AsyncSpeechToTextJob
            A job handle which can be used to check status or retrieve results.
        rI   )r   rN   r   r   r   rO   x  s   z"AsyncSpeechToTextJobClient.get_job) rP   rQ   rR   r   r   rS   r   r#   rT   r   rU   rV   r   r   r   r,   rW   r   r3   rX   r8   rY   r
   r>   r	   rA   r   r   rZ   r   rM   rO   r   r   r   r   r[   ;  s    
5
/
6
6
3	

<r[   )#rU   core.client_wrapperr   r   core.request_optionsr   requests.bulk_job_callbackr   &requests.speech_to_text_job_parametersr    types.bulk_job_init_response_v_1r   types.files_download_responser	   types.files_upload_responser
   types.job_status_v_1_responser   types.speech_to_text_modelr   types.speech_to_text_languager   
types.moder   
raw_clientr   r   jobr   r   castAnyrT   r   r[   r   r   r   r   <module>   s&     &