o
    lWi|M                     @  s   d dl mZ 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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rOddlmZmZ eejdZG dd dZG dd dZdS )    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)PodcastProjectResponseModel   )AsyncRawStudioClientRawStudioClient);BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization)2BodyCreatePodcastV1StudioPodcastsPostDurationScale))BodyCreatePodcastV1StudioPodcastsPostMode)2BodyCreatePodcastV1StudioPodcastsPostQualityPreset)+BodyCreatePodcastV1StudioPodcastsPostSource)AsyncProjectsClientProjectsClient.c                   @  T   e Zd Zd'ddZed(ddZd	eeeeeeeeed	d
d)d#d$Zed%d& Zd	S )*StudioClientclient_wrapperr   c                C     t |d| _|| _d | _d S Nr   )r
   _raw_client_client_wrapper	_projectsselfr    r   \/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/studio/client.py__init__      
zStudioClient.__init__returnr
   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawStudioClient
        r   r   r   r   r   with_raw_response#      	zStudioClient.with_raw_responseNsafety_identifierquality_presetduration_scalelanguageintrooutroinstructions_prompt
highlightscallback_urlapply_text_normalizationrequest_optionsmodel_idstrmoder   sourcer   r(   typing.Optional[str]r)   Ctyping.Optional[BodyCreatePodcastV1StudioPodcastsPostQualityPreset]r*   Ctyping.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale]r+   r,   r-   r.   r/   %typing.Optional[typing.Sequence[str]]r0   r1   Ltyping.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization]r2   typing.Optional[RequestOptions]r   c                C  s.   | j j|||||||||	|
||||d}|jS )a  
        Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs.

        Parameters
        ----------
        model_id : str
            The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models.

        mode : BodyCreatePodcastV1StudioPodcastsPostMode
            The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue.

        source : BodyCreatePodcastV1StudioPodcastsPostSource
            The source content for the Podcast.

        safety_identifier : typing.Optional[str]
            Used for moderation. Your workspace must be allowlisted to use this feature.

        quality_preset : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostQualityPreset]
            Output quality of the generated audio. Must be one of:
            standard - standard output format, 128kbps with 44.1kHz sample rate.
            high - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. Using this setting increases the credit cost by 20%.
            ultra - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. Using this setting increases the credit cost by 50%.
            ultra lossless - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. Using this setting increases the credit cost by 100%.

        duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale]
            Duration of the generated podcast. Must be one of:
            short - produces podcasts shorter than 3 minutes.
            default - produces podcasts roughly between 3-7 minutes.
            long - produces podcasts longer than 7 minutes.

        language : typing.Optional[str]
            An optional language of the Studio project. Two-letter language code (ISO 639-1).

        intro : typing.Optional[str]
            The intro text that will always be added to the beginning of the podcast.

        outro : typing.Optional[str]
            The outro text that will always be added to the end of the podcast.

        instructions_prompt : typing.Optional[str]
            Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone.

        highlights : typing.Optional[typing.Sequence[str]]
            A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters.

        callback_url : typing.Optional[str]

                A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion
                Messages:
                1. When project was converted successfully:
                {
                  type: "project_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    conversion_status: "success",
                    project_snapshot_id: "22m00Tcm4TlvDq8ikMAT",
                    error_details: None,
                  }
                }
                2. When project conversion failed:
                {
                  type: "project_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    conversion_status: "error",
                    project_snapshot_id: None,
                    error_details: "Error details if conversion failed"
                  }
                }

                3. When chapter was converted successfully:
                {
                  type: "chapter_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    chapter_id: "22m00Tcm4TlvDq8ikMAT",
                    conversion_status: "success",
                    chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV",
                    error_details: None,
                  }
                }
                4. When chapter conversion failed:
                {
                  type: "chapter_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    chapter_id: "22m00Tcm4TlvDq8ikMAT",
                    conversion_status: "error",
                    chapter_snapshot_id: None,
                    error_details: "Error details if conversion failed"
                  }
                }


        apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization]

                This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'.
                When set to 'auto', the system will automatically decide whether to apply text normalization
                (e.g., spelling out numbers). With 'on', text normalization will always be applied, while
                with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English.


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

        Returns
        -------
        PodcastProjectResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import (
            ElevenLabs,
            PodcastConversationModeData,
            PodcastTextSource,
        )
        from elevenlabs.studio import (
            BodyCreatePodcastV1StudioPodcastsPostMode_Conversation,
        )

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.create_podcast(
            safety_identifier="safety-identifier",
            model_id="eleven_multilingual_v2",
            mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation(
                conversation=PodcastConversationModeData(
                    host_voice_id="aw1NgEzBg83R7vgmiJt6",
                    guest_voice_id="aw1NgEzBg83R7vgmiJt7",
                ),
            ),
            source=PodcastTextSource(
                text="This is a test podcast.",
            ),
        )
        r3   r5   r6   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r   create_podcastdatar   r3   r5   r6   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   	_responser   r   r   r?   .   s$    %zStudioClient.create_podcastc                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   r   )r   projects.clientr   r   )r   r   r   r   r   projects      
zStudioClient.projects)r   r   )r!   r
   r3   r4   r5   r   r6   r   r(   r7   r)   r8   r*   r9   r+   r7   r,   r7   r-   r7   r.   r7   r/   r:   r0   r7   r1   r;   r2   r<   r!   r   	__name__
__module____qualname__r   propertyr%   OMITr?   rE   r   r   r   r   r      s&    
 7r   c                   @  r   )*AsyncStudioClientr   r   c                C  r   r   )r	   r   r   r   r   r   r   r   r      r    zAsyncStudioClient.__init__r!   r	   c                 C  r"   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawStudioClient
        r#   r$   r   r   r   r%      r&   z#AsyncStudioClient.with_raw_responseNr'   r3   r4   r5   r   r6   r   r(   r7   r)   r8   r*   r9   r+   r,   r-   r.   r/   r:   r0   r1   r;   r2   r<   r   c                  s6   | j j|||||||||	|
||||dI dH }|jS )a)  
        Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs.

        Parameters
        ----------
        model_id : str
            The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models.

        mode : BodyCreatePodcastV1StudioPodcastsPostMode
            The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue.

        source : BodyCreatePodcastV1StudioPodcastsPostSource
            The source content for the Podcast.

        safety_identifier : typing.Optional[str]
            Used for moderation. Your workspace must be allowlisted to use this feature.

        quality_preset : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostQualityPreset]
            Output quality of the generated audio. Must be one of:
            standard - standard output format, 128kbps with 44.1kHz sample rate.
            high - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. Using this setting increases the credit cost by 20%.
            ultra - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. Using this setting increases the credit cost by 50%.
            ultra lossless - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. Using this setting increases the credit cost by 100%.

        duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale]
            Duration of the generated podcast. Must be one of:
            short - produces podcasts shorter than 3 minutes.
            default - produces podcasts roughly between 3-7 minutes.
            long - produces podcasts longer than 7 minutes.

        language : typing.Optional[str]
            An optional language of the Studio project. Two-letter language code (ISO 639-1).

        intro : typing.Optional[str]
            The intro text that will always be added to the beginning of the podcast.

        outro : typing.Optional[str]
            The outro text that will always be added to the end of the podcast.

        instructions_prompt : typing.Optional[str]
            Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone.

        highlights : typing.Optional[typing.Sequence[str]]
            A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters.

        callback_url : typing.Optional[str]

                A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion
                Messages:
                1. When project was converted successfully:
                {
                  type: "project_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    conversion_status: "success",
                    project_snapshot_id: "22m00Tcm4TlvDq8ikMAT",
                    error_details: None,
                  }
                }
                2. When project conversion failed:
                {
                  type: "project_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    conversion_status: "error",
                    project_snapshot_id: None,
                    error_details: "Error details if conversion failed"
                  }
                }

                3. When chapter was converted successfully:
                {
                  type: "chapter_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    chapter_id: "22m00Tcm4TlvDq8ikMAT",
                    conversion_status: "success",
                    chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV",
                    error_details: None,
                  }
                }
                4. When chapter conversion failed:
                {
                  type: "chapter_conversion_status",
                  event_timestamp: 1234567890,
                  data: {
                    request_id: "1234567890",
                    project_id: "21m00Tcm4TlvDq8ikWAM",
                    chapter_id: "22m00Tcm4TlvDq8ikMAT",
                    conversion_status: "error",
                    chapter_snapshot_id: None,
                    error_details: "Error details if conversion failed"
                  }
                }


        apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization]

                This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'.
                When set to 'auto', the system will automatically decide whether to apply text normalization
                (e.g., spelling out numbers). With 'on', text normalization will always be applied, while
                with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English.


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

        Returns
        -------
        PodcastProjectResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import (
            AsyncElevenLabs,
            PodcastConversationModeData,
            PodcastTextSource,
        )
        from elevenlabs.studio import (
            BodyCreatePodcastV1StudioPodcastsPostMode_Conversation,
        )

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.create_podcast(
                safety_identifier="safety-identifier",
                model_id="eleven_multilingual_v2",
                mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation(
                    conversation=PodcastConversationModeData(
                        host_voice_id="aw1NgEzBg83R7vgmiJt6",
                        guest_voice_id="aw1NgEzBg83R7vgmiJt7",
                    ),
                ),
                source=PodcastTextSource(
                    text="This is a test podcast.",
                ),
            )


        asyncio.run(main())
        r=   Nr>   rA   r   r   r   r?      s&    -z AsyncStudioClient.create_podcastc                 C  rC   )Nr   )r   r   )r   rD   r   r   )r   r   r   r   r   rE     rF   zAsyncStudioClient.projects)r   r   )r!   r	   rG   rH   r   r   r   r   rN      s&    
 ?rN   ) 
__future__r   typingcore.client_wrapperr   r   core.request_optionsr   $types.podcast_project_response_modelr   
raw_clientr	   r
   Ktypes.body_create_podcast_v_1_studio_podcasts_post_apply_text_normalizationr   Atypes.body_create_podcast_v_1_studio_podcasts_post_duration_scaler   7types.body_create_podcast_v_1_studio_podcasts_post_moder   Atypes.body_create_podcast_v_1_studio_podcasts_post_quality_presetr   9types.body_create_podcast_v_1_studio_podcasts_post_sourcer   TYPE_CHECKINGrD   r   r   castAnyrM   r   rN   r   r   r   r   <module>   s"    Q