o
    lWi                     @   s   d dl 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 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 e e jdZG dd dZG dd dZdS )    N)JSONDecodeError   )core)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)construct_type)UnprocessableEntityError)ForcedAlignmentResponseModel)HttpValidationError.c                   @   R   e Zd ZdefddZedddejdede	j
e d	e	j
e d
ee f
ddZdS )RawForcedAlignmentClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   j/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/forced_alignment/raw_client.py__init__      
z!RawForcedAlignmentClient.__init__Nenabled_spooled_filerequest_optionsfiletextr   r   returnc             	   C   s   | j jjdd||dd|i|tdd}z>d|j  krdk r4n ntttt|	 d	}t
||d
W S |jdkrLtt|jtttt|	 d	d|	 }W n tyd   t|jt|j|jdw t|jt|j|d)a  
        Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        text : str
            The text to align with the audio. The input text can be in any format, however diarization is not supported at this time.

        enabled_spooled_file : typing.Optional[bool]
            If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false.

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

        Returns
        -------
        HttpResponse[ForcedAlignmentResponseModel]
            Successful Response
        v1/forced-alignmentPOSTr    r   r   Tmethoddatafilesr   omitforce_multipart   ,  type_object_responser'     headersbodystatus_coder4   r5   )r   httpx_clientrequestOMITr7   typingcastr   r   jsonr	   r   dictr4   r   r   r   r    r   r   r    r   r   	_response_data_response_jsonr   r   r   create   sL   

zRawForcedAlignmentClient.create)__name__
__module____qualname__r   r   r:   r   Filestrr;   Optionalboolr
   r	   r   rC   r   r   r   r   r          r   c                   @   r   )AsyncRawForcedAlignmentClientr   c                C   r   r   r   r   r   r   r   r   `   r   z&AsyncRawForcedAlignmentClient.__init__Nr   r   r    r   r   r!   c             	      s   | j jjdd||dd|i|tddI dH }z>d|j  kr#d	k r8n ntttt|	 d
}t
||dW S |jdkrPtt|jtttt|	 d
d|	 }W n tyh   t|jt|j|jdw t|jt|j|d)a  
        Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        text : str
            The text to align with the audio. The input text can be in any format, however diarization is not supported at this time.

        enabled_spooled_file : typing.Optional[bool]
            If true, the file will be streamed to the server and processed in chunks. This is useful for large files that cannot be loaded into memory. The default is false.

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

        Returns
        -------
        AsyncHttpResponse[ForcedAlignmentResponseModel]
            Successful Response
        r"   r#   r$   r   Tr%   Nr+   r,   r-   r0   r2   r3   r6   )r   r8   r9   r:   r7   r;   r<   r   r   r=   r   r   r>   r4   r   r   r   r    r?   r   r   r   rC   c   sN   

z$AsyncRawForcedAlignmentClient.create)rD   rE   rF   r   r   r:   r   rG   rH   r;   rI   rJ   r
   r   r   rC   r   r   r   r   rL   _   rK   rL   )r;   json.decoderr    r   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.request_optionsr
   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   %types.forced_alignment_response_modelr   types.http_validation_errorr   r<   Anyr:   r   rL   r   r   r   r   <module>   s   K