
    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 ddlmZ  e j2                  e j4                  d      Z G d d      Z G d d      Zy)    N)JSONDecodeError   )core)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)construct_type)UnprocessableEntityError)AddVoiceIvcResponseModel)HttpValidationError   )IvcCreateRequestLabels.c                       e Zd ZdefdZeeedddedej                  e	j                     dej                  e   dej                  e   d	ej                  e   d
ej                  e   dee   fdZy)RawIvcClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     k/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/voices/ivc/raw_client.py__init__zRawIvcClient.__init__   
    -    Nremove_background_noisedescriptionlabelsrequest_optionsnamefilesr    r!   r"   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  
        Create a voice clone and add it to your Voices

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        files : typing.List[core.File]
            See core.File for more documentation

        remove_background_noise : typing.Optional[bool]
            If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse.

        description : typing.Optional[str]
            A description of the voice.

        labels : typing.Optional[IvcCreateRequestLabels]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        HttpResponse[AddVoiceIvcResponseModel]
            Successful Response
        v1/voices/addPOSTr$   r    r!   r"   r%   Tmethoddatar%   r#   omitforce_multipart   ,  type_object_responser-     headersbodystatus_coder9   r:   )r   httpx_clientrequestOMITr<   typingcastr   r   jsonr
   r   dictr9   r   r   r   text
r   r$   r%   r    r!   r"   r#   	_response_data_response_jsons
             r   createzRawIvcClient.create   sZ   L ((55==+B* 	  ,  > 
	 	ti++1c1,"6 ) 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D4 A4D4 4?E3)__name__
__module____qualname__r   r   r?   strr@   Listr   FileOptionalboolr   r   r
   r   rI    r   r   r   r      s    .*; . :>,0:>;?Np Np {{499%	Np
 "(!6Np __S)Np  67Np  8Np 
.	/Npr   r   c                       e Zd ZdefdZeeedddedej                  e	j                     dej                  e   dej                  e   d	ej                  e   d
ej                  e   dee   fdZy)AsyncRawIvcClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawIvcClient.__init__k   r   r   Nr   r$   r%   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  
        Create a voice clone and add it to your Voices

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        files : typing.List[core.File]
            See core.File for more documentation

        remove_background_noise : typing.Optional[bool]
            If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse.

        description : typing.Optional[str]
            A description of the voice.

        labels : typing.Optional[IvcCreateRequestLabels]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        AsyncHttpResponse[AddVoiceIvcResponseModel]
            Successful Response
        r(   r)   r*   r%   Tr+   Nr0   r1   r2   r5   r7   r8   r;   )r   r=   r>   r?   r<   r@   rA   r   r   rB   r	   r   rC   r9   r   r   r   rD   rE   s
             r   rI   zAsyncRawIvcClient.createn   sj    L ..;;CC+B* 	  ,  D 
 
	 	ti++1c1,"6 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooQ
L  	ty'<'<d9K\K\F]dmdrdrss	ts5   ;FD>FAE FA4E ,F?F  F)rJ   rK   rL   r   r   r?   rM   r@   rN   r   rO   rP   rQ   r   r   r	   r   rI   rR   r   r   rT   rT   j   s    .*< . :>,0:>;?Np Np {{499%	Np
 "(!6Np __S)Np  67Np  8Np 
3	4Npr   rT   )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.add_voice_ivc_response_modelr   types.http_validation_errorr   types.ivc_create_request_labelsr   rA   Anyr?   r   rT   rR   r   r   <module>rc      s`     (  & H A 2 7 I J > C v{{6::s#Rp RpjRp Rpr   