o
    lWi                     @   s   d dl 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 e jdZG dd dZG dd dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)HttpValidationError)MusicPrompt.c                   @   j   e Zd ZdefddZeeedddedeje	 deje
 d	ejejd
  deje dee
 fddZdS )RawCompositionPlanClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   p/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/music/composition_plan/raw_client.py__init__      
z!RawCompositionPlanClient.__init__Nmusic_length_mssource_composition_planmodel_idrequest_optionspromptr   r   r   music_v1r    returnc          	   
   C   s   | j jjdd||t|tdd|dddi|td}z>d	|j  kr%d
k r:n nttt	t|
 d}t||dW S |jdkrRtt|jttt	t|
 dd|
 }W n tyj   t|jt|j|jdw t|jt|j|d)a  
        Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier.

        Parameters
        ----------
        prompt : str
            A simple text prompt to compose a plan from.

        music_length_ms : typing.Optional[int]
            The length of the composition plan to generate in milliseconds. Must be between 3000ms and 300000ms. Optional - if not provided, the model will choose a length based on the prompt.

        source_composition_plan : typing.Optional[MusicPrompt]
            An optional composition plan to use as a source for the new composition plan.

        model_id : typing.Optional[typing.Literal["music_v1"]]
            The model to use for the generation.

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

        Returns
        -------
        HttpResponse[MusicPrompt]
            Successful Response
        v1/music/planPOSTwriteobject_
annotation	directionr!   r   r   r   content-typeapplication/jsonmethodjsonheadersr    omit   ,  type_r(   responsedata  r1   bodystatus_coder1   r<   )r   httpx_clientrequestr
   r   OMITr>   typingcastr   r0   r   r   dictr1   r   r   r   text	r   r!   r   r   r   r    	_response_data_response_jsonr   r   r   create   sR   "	

zRawCompositionPlanClient.create)__name__
__module____qualname__r   r   rA   strrB   Optionalintr   Literalr	   r   rJ   r   r   r   r   r      &    r   c                   @   r   )AsyncRawCompositionPlanClientr   c                C   r   r   r   r   r   r   r   r   g   r   z&AsyncRawCompositionPlanClient.__init__Nr   r!   r   r   r   r"   r    r#   c          	   
      s   | j jjdd||t|tdd|dddi|tdI d	H }z>d
|j  kr)dk r>n nttt	t|
 d}t||dW S |jdkrVtt|jttt	t|
 dd|
 }W n tyn   t|jt|j|jdw t|jt|j|d)a  
        Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier.

        Parameters
        ----------
        prompt : str
            A simple text prompt to compose a plan from.

        music_length_ms : typing.Optional[int]
            The length of the composition plan to generate in milliseconds. Must be between 3000ms and 300000ms. Optional - if not provided, the model will choose a length based on the prompt.

        source_composition_plan : typing.Optional[MusicPrompt]
            An optional composition plan to use as a source for the new composition plan.

        model_id : typing.Optional[typing.Literal["music_v1"]]
            The model to use for the generation.

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

        Returns
        -------
        AsyncHttpResponse[MusicPrompt]
            Successful Response
        r$   r%   r&   r'   r+   r,   r-   r.   Nr3   r4   r5   r7   r:   r;   r=   )r   r?   r@   r
   r   rA   r>   rB   rC   r   r0   r   r   rD   r1   r   r   r   rE   rF   r   r   r   rJ   j   sT   "	

z$AsyncRawCompositionPlanClient.create)rK   rL   rM   r   r   rA   rN   rB   rO   rP   r   rQ   r	   r   rJ   r   r   r   r   rS   f   rR   rS   )rB   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.request_optionsr	   core.serializationr
   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   types.http_validation_errorr   types.music_promptr   rC   AnyrA   r   rS   r   r   r   r   <module>   s   R