o
    lWii\                     @  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 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 ejrWddlmZmZ ddlmZmZ G dd dZG dd dZdS )    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)"ConversationSignedUrlResponseModel)EvaluationSuccessResult)GetConversationResponseModel)!GetConversationsPageResponseModel)TokenResponseModel   )AsyncRawConversationsClientRawConversationsClient)#ConversationsListRequestSummaryMode)AsyncAudioClientAudioClient)AsyncFeedbackClientFeedbackClientc                   @     e Zd Zd>ddZed?ddZd	d	d
d@ddZd	d	ddAddZd	d	d	d	d	d	d	d	d	d	d	d	d	d	d	d	d	d	ddBd0d1Zd	d2dCd5d6Z	d	d2dDd8d9Z
ed:d; Zed<d= Zd	S )EConversationsClientclient_wrapperr   c                C  "   t |d| _|| _d | _d | _d S Nr   )r   _raw_client_client_wrapper_audio	_feedbackselfr    r    u/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/conversational_ai/conversations/client.py__init__      
zConversationsClient.__init__returnr   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawConversationsClient
        r   r   r    r    r!   with_raw_response      	z%ConversationsClient.with_raw_responseNinclude_conversation_idrequest_optionsagent_idstrr+   typing.Optional[bool]r,   typing.Optional[RequestOptions]r   c                C     | j j|||d}|jS )a  
        Get a signed url to start a conversation with an agent with an agent that requires authorization

        Parameters
        ----------
        agent_id : str
            The id of the agent you're taking the action on.

        include_conversation_id : typing.Optional[bool]
            Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again.

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

        Returns
        -------
        ConversationSignedUrlResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.get_signed_url(
            agent_id="21m00Tcm4TlvDq8ikWAM",
            include_conversation_id=True,
        )
        r-   r+   r,   r   get_signed_urldatar   r-   r+   r,   	_responser    r    r!   r4   (      &z"ConversationsClient.get_signed_urlparticipant_namer,   r:   typing.Optional[str]r   c                C  r1   )aN  
        Get a WebRTC session token for real-time communication.

        Parameters
        ----------
        agent_id : str
            The id of the agent you're taking the action on.

        participant_name : typing.Optional[str]
            Optional custom participant name. If not provided, user ID will be used

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

        Returns
        -------
        TokenResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.get_webrtc_token(
            agent_id="21m00Tcm4TlvDq8ikWAM",
            participant_name="participant_name",
        )
        r-   r:   r,   r   get_webrtc_tokenr5   r   r-   r:   r,   r7   r    r    r!   r>   S   r8   z$ConversationsClient.get_webrtc_tokencursorr-   call_successfulcall_start_before_unixcall_start_after_unixcall_duration_min_secscall_duration_max_secs
rating_max
rating_minhas_feedback_commentuser_idevaluation_paramsdata_collection_params
tool_names	page_sizesummary_modesearchr,   rA   rB   (typing.Optional[EvaluationSuccessResult]rC   typing.Optional[int]rD   rE   rF   rG   rH   rI   rJ   rK   8typing.Optional[typing.Union[str, typing.Sequence[str]]]rL   rM   rN   rO   4typing.Optional[ConversationsListRequestSummaryMode]rP   r
   c                C  s   | j jdi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|d|}|jS )a  
        Get all conversations of agents that user owns. With option to restrict to a specific agent.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        agent_id : typing.Optional[str]
            The id of the agent you're taking the action on.

        call_successful : typing.Optional[EvaluationSuccessResult]
            The result of the success evaluation

        call_start_before_unix : typing.Optional[int]
            Unix timestamp (in seconds) to filter conversations up to this start date.

        call_start_after_unix : typing.Optional[int]
            Unix timestamp (in seconds) to filter conversations after to this start date.

        call_duration_min_secs : typing.Optional[int]
            Minimum call duration in seconds.

        call_duration_max_secs : typing.Optional[int]
            Maximum call duration in seconds.

        rating_max : typing.Optional[int]
            Maximum overall rating (1-5).

        rating_min : typing.Optional[int]
            Minimum overall rating (1-5).

        has_feedback_comment : typing.Optional[bool]
            Filter conversations with user feedback comments.

        user_id : typing.Optional[str]
            Filter conversations by the user ID who initiated them.

        evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Evaluation filters. Repeat param. Format: criteria_id:result. Example: eval=value_framing:success

        data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in|exists|missing. For in, pipe-delimit values.

        tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter conversations by tool names used during the call.

        page_size : typing.Optional[int]
            How many conversations to return at maximum. Can not exceed 100, defaults to 30.

        summary_mode : typing.Optional[ConversationsListRequestSummaryMode]
            Whether to include transcript summaries in the response.

        search : typing.Optional[str]
            Full-text or fuzzy search over transcript messages

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

        Returns
        -------
        GetConversationsPageResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.list(
            cursor="cursor",
            agent_id="agent_id",
            call_successful="success",
            call_start_before_unix=1,
            call_start_after_unix=1,
            call_duration_min_secs=1,
            call_duration_max_secs=1,
            rating_max=1,
            rating_min=1,
            has_feedback_comment=True,
            user_id="user_id",
            page_size=1,
            summary_mode="exclude",
            search="search",
        )
        rA   r-   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r,   Nr    r   listr5   r   rA   r-   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r,   r7   r    r    r!   rV   ~   sL   n	
zConversationsClient.listr,   conversation_idr	   c                C     | j j||d}|jS )a  
        Get the details of a particular conversation

        Parameters
        ----------
        conversation_id : str
            The id of the conversation you're taking the action on.

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

        Returns
        -------
        GetConversationResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.get(
            conversation_id="123",
        )
        rX   r   getr5   r   rY   r,   r7   r    r    r!   r\     s   zConversationsClient.get
typing.Anyc                C  rZ   )a  
        Delete a particular conversation

        Parameters
        ----------
        conversation_id : str
            The id of the conversation you're taking the action on.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.delete(
            conversation_id="21m00Tcm4TlvDq8ikWAM",
        )
        rX   r   deleter5   r]   r    r    r!   r`   #  s   zConversationsClient.deletec                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   r   )r   audio.clientr   r   )r   r   r    r    r!   audioB     
zConversationsClient.audioc                 C  ra   )Nr   )r   r   )r   feedback.clientr   r   )r   r   r    r    r!   feedbackJ  rd   zConversationsClient.feedback)r   r   )r$   r   r-   r.   r+   r/   r,   r0   r$   r   r-   r.   r:   r;   r,   r0   r$   r   &rA   r;   r-   r;   rB   rQ   rC   rR   rD   rR   rE   rR   rF   rR   rG   rR   rH   rR   rI   r/   rJ   r;   rK   rS   rL   rS   rM   rS   rN   rR   rO   rT   rP   r;   r,   r0   r$   r
   rY   r.   r,   r0   r$   r	   rY   r.   r,   r0   r$   r^   __name__
__module____qualname__r"   propertyr(   r4   r>   rV   r\   r`   rc   rf   r    r    r    r!   r      sJ    
/. !
r   c                   @  r   )EAsyncConversationsClientr   r   c                C  r   r   )r   r   r   r   r   r   r    r    r!   r"   T  r#   z!AsyncConversationsClient.__init__r$   r   c                 C  r%   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawConversationsClient
        r&   r'   r    r    r!   r(   Z  r)   z*AsyncConversationsClient.with_raw_responseNr*   r-   r.   r+   r/   r,   r0   r   c                      | j j|||dI dH }|jS )a.  
        Get a signed url to start a conversation with an agent with an agent that requires authorization

        Parameters
        ----------
        agent_id : str
            The id of the agent you're taking the action on.

        include_conversation_id : typing.Optional[bool]
            Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again.

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

        Returns
        -------
        ConversationSignedUrlResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.get_signed_url(
                agent_id="21m00Tcm4TlvDq8ikWAM",
                include_conversation_id=True,
            )


        asyncio.run(main())
        r2   Nr3   r6   r    r    r!   r4   e  
   .z'AsyncConversationsClient.get_signed_urlr9   r:   r;   r   c                  rr   )a  
        Get a WebRTC session token for real-time communication.

        Parameters
        ----------
        agent_id : str
            The id of the agent you're taking the action on.

        participant_name : typing.Optional[str]
            Optional custom participant name. If not provided, user ID will be used

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

        Returns
        -------
        TokenResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.get_webrtc_token(
                agent_id="21m00Tcm4TlvDq8ikWAM",
                participant_name="participant_name",
            )


        asyncio.run(main())
        r<   Nr=   r?   r    r    r!   r>     rs   z)AsyncConversationsClient.get_webrtc_tokenr@   rA   rB   rQ   rC   rR   rD   rE   rF   rG   rH   rI   rJ   rK   rS   rL   rM   rN   rO   rT   rP   r
   c                  s   | j jdi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|d|I dH }|jS )aJ  
        Get all conversations of agents that user owns. With option to restrict to a specific agent.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        agent_id : typing.Optional[str]
            The id of the agent you're taking the action on.

        call_successful : typing.Optional[EvaluationSuccessResult]
            The result of the success evaluation

        call_start_before_unix : typing.Optional[int]
            Unix timestamp (in seconds) to filter conversations up to this start date.

        call_start_after_unix : typing.Optional[int]
            Unix timestamp (in seconds) to filter conversations after to this start date.

        call_duration_min_secs : typing.Optional[int]
            Minimum call duration in seconds.

        call_duration_max_secs : typing.Optional[int]
            Maximum call duration in seconds.

        rating_max : typing.Optional[int]
            Maximum overall rating (1-5).

        rating_min : typing.Optional[int]
            Minimum overall rating (1-5).

        has_feedback_comment : typing.Optional[bool]
            Filter conversations with user feedback comments.

        user_id : typing.Optional[str]
            Filter conversations by the user ID who initiated them.

        evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Evaluation filters. Repeat param. Format: criteria_id:result. Example: eval=value_framing:success

        data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in|exists|missing. For in, pipe-delimit values.

        tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter conversations by tool names used during the call.

        page_size : typing.Optional[int]
            How many conversations to return at maximum. Can not exceed 100, defaults to 30.

        summary_mode : typing.Optional[ConversationsListRequestSummaryMode]
            Whether to include transcript summaries in the response.

        search : typing.Optional[str]
            Full-text or fuzzy search over transcript messages

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

        Returns
        -------
        GetConversationsPageResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.list(
                cursor="cursor",
                agent_id="agent_id",
                call_successful="success",
                call_start_before_unix=1,
                call_start_after_unix=1,
                call_duration_min_secs=1,
                call_duration_max_secs=1,
                rating_max=1,
                rating_min=1,
                has_feedback_comment=True,
                user_id="user_id",
                page_size=1,
                summary_mode="exclude",
                search="search",
            )


        asyncio.run(main())
        rA   r-   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r,   Nr    rU   rW   r    r    r!   rV     sN   v	

zAsyncConversationsClient.listrX   rY   r	   c                     | j j||dI dH }|jS )a  
        Get the details of a particular conversation

        Parameters
        ----------
        conversation_id : str
            The id of the conversation you're taking the action on.

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

        Returns
        -------
        GetConversationResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.get(
                conversation_id="123",
            )


        asyncio.run(main())
        rX   Nr[   r]   r    r    r!   r\   W     &zAsyncConversationsClient.getr^   c                  rt   )a  
        Delete a particular conversation

        Parameters
        ----------
        conversation_id : str
            The id of the conversation you're taking the action on.

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.delete(
                conversation_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rX   Nr_   r]   r    r    r!   r`     ru   zAsyncConversationsClient.deletec                 C  ra   )Nr   )r   r   )r   rb   r   r   )r   r   r    r    r!   rc     rd   zAsyncConversationsClient.audioc                 C  ra   )Nr   )r   r   )r   re   r   r   )r   r   r    r    r!   rf     rd   z!AsyncConversationsClient.feedback)r   r   )r$   r   rg   rh   ri   rj   rk   rl   r    r    r    r!   rq   S  sL    
76 *)
rq   ) 
__future__r   typingcore.client_wrapperr   r   core.request_optionsr   ,types.conversation_signed_url_response_modelr   types.evaluation_success_resultr   %types.get_conversation_response_modelr	   +types.get_conversations_page_response_modelr
   types.token_response_modelr   
raw_clientr   r   -types.conversations_list_request_summary_moder   TYPE_CHECKINGrb   r   r   re   r   r   r   rq   r    r    r    r!   <module>   s$     ?