
    b6i                         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 j.                  e j0                  d      Z G d d      Z G d d      Zy)    N)JSONDecodeError   )core)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)construct_type)UnprocessableEntityError)ForcedAlignmentResponseModel)HttpValidationError.c                       e Zd ZdefdZedddej                  dede	j                  e   de	j                  e   d	ee   f
d
Zy)RawForcedAlignmentClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     q/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/forced_alignment/raw_client.py__init__z!RawForcedAlignmentClient.__init__   
    -    Nenabled_spooled_filerequest_optionsfiletextr   r   returnc                   | j                   j                  j                  dd||dd|i|t        d      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	                  |j                         }t!        |j                  t        |j                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)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_coder6   r7   )r   httpx_clientrequestOMITr9   typingcastr   r   jsonr
   r   dictr6   r   r   r   r!   r   r    r!   r   r   	_response_data_response_jsons           r   createzRawForcedAlignmentClient.create   sS   < ((55==!(<
  ,  > 
		ti++1c10": ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD2 A4D2 2?E1)__name__
__module____qualname__r   r   r<   r   Filestrr=   Optionalboolr   r
   r   rE    r   r   r   r      sv    .*; . 7;;?Dp iiDp 	Dp
 %ood3Dp  8Dp 
2	3Dpr   r   c                       e Zd ZdefdZedddej                  dede	j                  e   de	j                  e   d	ee   f
d
Zy)AsyncRawForcedAlignmentClientr   c                    || _         y r   r   r   s     r   r   z&AsyncRawForcedAlignmentClient.__init__`   r   r   Nr   r    r!   r   r   r"   c                  K   | j                   j                  j                  dd||dd|i|t        d       d{   }	 d|j                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         
                  |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)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/   r2   r4   r5   r8   )r   r:   r;   r<   r9   r=   r>   r   r   r?   r	   r   r@   r6   r   r   r   r!   rA   s           r   rE   z$AsyncRawForcedAlignmentClient.createc   sc    < ..;;CC!(<
  ,  D 
 
		ti++1c10": ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooM
H  	ty'<'<d9K\K\F]dmdrdrss	ts5   9FD<FAD? FA4D? ,F??E>>F)rF   rG   rH   r   r   r<   r   rI   rJ   r=   rK   rL   r   r	   r   rE   rM   r   r   rO   rO   _   sv    .*< . 7;;?Dp iiDp 	Dp
 %ood3Dp  8Dp 
7	8Dpr   rO   )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   rO   rM   r   r   <module>r]      s]     (  % G @ 1 6 H P = v{{6::s#Hp HpVHp Hpr   