
    >|hT8                     F   d dl 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 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 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 jD                  e jF                  d      Z$ G d d      Z% G d d      Z&y)    N   )SyncClientWrapper   )ProjectsClient)ChaptersClient))BodyCreatePodcastV1StudioPodcastsPostMode)+BodyCreatePodcastV1StudioPodcastsPostSource)2BodyCreatePodcastV1StudioPodcastsPostQualityPreset)2BodyCreatePodcastV1StudioPodcastsPostDurationScale)RequestOptions)PodcastProjectResponseModel)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)HttpValidationError)JSONDecodeError)ApiError)AsyncClientWrapper)AsyncProjectsClient)AsyncChaptersClient.c                      e Zd ZdefdZeeeeedddededede	j                  e   d	e	j                  e   d
e	j                  e   de	j                  e	j                  e      de	j                  e   de	j                  e   defdZy)StudioClientclient_wrapperc                ~    || _         t        | j                         | _        t        | j                         | _        y N)r   )_client_wrapperr   projectsr   chaptersselfr   s     W/var/www/html/test/engine/venv/lib/python3.12/site-packages/elevenlabs/studio/client.py__init__zStudioClient.__init__    s.    -&d6J6JK&d6J6JK    Nquality_presetduration_scalelanguage
highlightscallback_urlrequest_optionsmodel_idmodesourcer%   r&   r'   r(   r)   r*   returnc       	            | j                   j                  j                  dd|t        |t        d      t        |t
        d      |||||dddi|	t              }
	 d	|
j                  cxk  rd
k  r:n n7t        j                  t        t        t        |
j                                     S |
j                  dk(  r@t        t        j                  t        t        t        |
j                                           |
j                         }t!        |
j                  |      # t        $ r" t!        |
j                  |
j"                        w xY w)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.

        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 - prodces podcasts longer than 7 minutes.


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

        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

        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(
            model_id="21m00Tcm4TlvDq8ikWAM",
            mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation(
                conversation=PodcastConversationModeData(
                    host_voice_id="aw1NgEzBg83R7vgmiJt6",
                    guest_voice_id="aw1NgEzBg83R7vgmiJt7",
                ),
            ),
            source=PodcastTextSource(
                text="This is a test podcast.",
            ),
        )
        v1/studio/podcastsPOSTwriteobject_
annotation	directionr+   r,   r-   r%   r&   r'   r(   r)   content-typeapplication/jsonmethodjsonheadersr*   omit   ,  type_r4     status_codebodyr   httpx_clientrequestr   r   r	   OMITrE   typingcastr   r   r<   r   r   r   r   textr    r+   r,   r-   r%   r&   r'   r(   r)   r*   	_response_response_jsons               r!   create_podcastzStudioClient.create_podcast%   sO   l ((55== $? -Vbi B"/Zfm #1"0$( ,  2 ,+ > 
	.	Si++1c1{{/"9 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AD! +AD! !+E)__name__
__module____qualname__r   r"   rJ   strr   r	   rK   Optionalr
   r   Sequencer   r   rQ    r#   r!   r   r      s    L*; L _c^b)-<@-1;?CO CO 8	CO
 <CO (Z[CO (Z[CO //#&CO OOFOOC$89CO ooc*CO  8CO 
%COr#   r   c                      e Zd ZdefdZeeeeedddededede	j                  e   d	e	j                  e   d
e	j                  e   de	j                  e	j                  e      de	j                  e   de	j                  e   defdZy)AsyncStudioClientr   c                ~    || _         t        | j                         | _        t        | j                         | _        y r   )r   r   r   r   r   r   s     r!   r"   zAsyncStudioClient.__init__   s.    -+4;O;OP+4;O;OPr#   Nr$   r+   r,   r-   r%   r&   r'   r(   r)   r*   r.   c       	           K   | j                   j                  j                  dd|t        |t        d      t        |t
        d      |||||dddi|	t               d	{   }
	 d
|
j                  cxk  rdk  r:n n7t        j                  t        t        t        |
j                                     S |
j                  dk(  r@t        t        j                  t        t        t        |
j                                           |
j                         }t!        |
j                  |      7 # t        $ r" t!        |
j                  |
j"                        w xY ww)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.

        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 - prodces podcasts longer than 7 minutes.


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

        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

        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(
                model_id="21m00Tcm4TlvDq8ikWAM",
                mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation(
                    conversation=PodcastConversationModeData(
                        host_voice_id="aw1NgEzBg83R7vgmiJt6",
                        guest_voice_id="aw1NgEzBg83R7vgmiJt7",
                    ),
                ),
                source=PodcastTextSource(
                    text="This is a test podcast.",
                ),
            )


        asyncio.run(main())
        r0   r1   r2   r3   r7   r8   r9   r:   Nr?   r@   rA   rC   rD   rG   rN   s               r!   rQ   z AsyncStudioClient.create_podcast   s_    | ..;;CC $? -Vbi B"/Zfm #1"0$( ,  2 ,+ D 
 
	.	Si++1c1{{/"9 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN[
V  	Sy'<'<9>>RR	Ss8   AE D+!E&AD- 4E5AD- E-+EE)rR   rS   rT   r   r"   rJ   rU   r   r	   rK   rV   r
   r   rW   r   r   rQ   rX   r#   r!   rZ   rZ      s    Q*< Q _c^b)-<@-1;?KO KO 8	KO
 <KO (Z[KO (Z[KO //#&KO OOFOOC$89KO ooc*KO  8KO 
%KOr#   rZ   )'rK   core.client_wrapperr   projects.clientr   chapters.clientr   7types.body_create_podcast_v_1_studio_podcasts_post_moder   9types.body_create_podcast_v_1_studio_podcasts_post_sourcer	   Atypes.body_create_podcast_v_1_studio_podcasts_post_quality_presetr
   Atypes.body_create_podcast_v_1_studio_podcasts_post_duration_scaler   core.request_optionsr   $types.podcast_project_response_modelr   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   types.http_validation_errorr   json.decoderr   core.api_errorr   r   r   r   rL   AnyrJ   r   rZ   rX   r#   r!   <module>rm      s{     3 + + n r 2 N H 6 H = ( % 4 0 0 v{{6::s#IO IOXQO QOr#   