
    b6iJf                        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 ddlmZmZ ddlmZ ej2                  rddlmZmZ ddlmZmZ  G d d      Z  G d d      Z!y)    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ConversationInitiationSource)"ConversationSignedUrlResponseModel)EvaluationSuccessResult)GetConversationResponseModel)!GetConversationsPageResponseModel)TokenResponseModel   )AsyncRawConversationsClientRawConversationsClient)#ConversationsListRequestSummaryMode)AsyncAudioClientAudioClient)AsyncFeedbackClientFeedbackClientc                  @   e Zd ZddZedd       Zdddd	 	 	 	 	 	 	 	 	 ddZdddd	 	 	 	 	 	 	 	 	 ddZdddddddddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zdd
	 	 	 	 	 ddZ	dd
ddZ
ed        Zed        Zy)ConversationsClientc               P    t        |      | _        || _        d | _        d | _        y Nclient_wrapper)r   _raw_client_client_wrapper_audio	_feedbackselfr   s     |/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/conversational_ai/conversations/client.py__init__zConversationsClient.__init__   s%    1P-48:>    c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawConversationsClient
        r   r!   s    r"   with_raw_responsez%ConversationsClient.with_raw_response        r$   Ninclude_conversation_id	branch_idrequest_optionsc               X    | j                   j                  ||||      }|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.

        branch_id : typing.Optional[str]
            The ID of the branch to use

        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,
            branch_id="branch_id",
        )
        agent_idr+   r,   r-   r   get_signed_urldatar!   r0   r+   r,   r-   	_responses         r"   r2   z"ConversationsClient.get_signed_url)   s8    V $$33$;+	 4 
	 ~~r$   participant_namer,   r-   c               X    | j                   j                  ||||      }|j                  S )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

        branch_id : typing.Optional[str]
            The ID of the branch to use

        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",
            branch_id="branch_id",
        )
        r0   r7   r,   r-   r   get_webrtc_tokenr3   r!   r0   r7   r,   r-   r5   s         r"   r;   z$ConversationsClient.get_webrtc_token\   s7    V $$550@Igv 6 
	 ~~r$   cursorr0   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main_languages	page_sizesummary_modesearchconversation_initiation_sourcer,   r-   c               z    | j                   j                  |||||||||	|
|||||||||||      }|j                  S )aI  
        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.

        main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter conversations by detected main language (language code).

        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

        conversation_initiation_source : typing.Optional[ConversationInitiationSource]

        branch_id : typing.Optional[str]
            Filter conversations by branch ID.

        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",
            conversation_initiation_source="unknown",
            branch_id="branch_id",
        )
        r=   r   listr3   r!   r>   r0   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   r,   r-   r5   s                          r"   rR   zConversationsClient.list   sk    v $$))+#9"7#9#9!!!5/#9!)%+I++ * 
	. ~~r$   r-   c               T    | j                   j                  ||      }|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",
        )
        rT   r   getr3   r!   conversation_idr-   r5   s       r"   rW   zConversationsClient.get   s)    < $$((/(Z	~~r$   c               T    | j                   j                  ||      }|j                  S )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",
        )
        rT   r   deleter3   rX   s       r"   r\   zConversationsClient.deleteA  s)    8 $$++O_+]	~~r$   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   audio.clientr   r   )r!   r   s     r"   audiozConversationsClient.audio`  s+    ;;1%T5I5IJDK{{r$   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   feedback.clientr   r   )r!   r   s     r"   feedbackzConversationsClient.feedbackh  s+    >>!7+4;O;OPDN~~r$   )r   r   )returnr   
r0   strr+   typing.Optional[bool]r,   typing.Optional[str]r-   typing.Optional[RequestOptions]rc   r	   
r0   re   r7   rg   r,   rg   r-   rh   rc   r   ,r>   rg   r0   rg   r?   z(typing.Optional[EvaluationSuccessResult]r@   typing.Optional[int]rA   rk   rB   rk   rC   rk   rD   rk   rE   rk   rF   rf   rG   rg   rH   8typing.Optional[typing.Union[str, typing.Sequence[str]]]rI   rl   rJ   rl   rK   rl   rL   rk   rM   z4typing.Optional[ConversationsListRequestSummaryMode]rN   rg   rO   z-typing.Optional[ConversationInitiationSource]r,   rg   r-   rh   rc   r   rY   re   r-   rh   rc   r   rY   re   r-   rh   rc   z
typing.Any__name__
__module____qualname__r#   propertyr(   r2   r;   rR   rW   r\   r_   rb    r$   r"   r   r      s;   ?     :>*.;?1 1 "7	1
 (1 91 
,1n 26*.;?. . /	.
 (. 9. 
.f (,)-DH7;6:7;7;+/+/6:(,VZ[_OSSW*.MQ'+X\*.;?/R %R '	R
 BR !5R  4R !5R !5R )R )R 4R &R TR !YR  M!R" Q#R$ (%R& K'R( %)R* )V+R, (-R. 9/R0 
+1Rj [_"8W	%B bf >    r$   r   c                  J   e Zd ZddZedd       Zdddd	 	 	 	 	 	 	 	 	 ddZdddd	 	 	 	 	 	 	 	 	 ddZdddddddddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zdd
	 	 	 	 	 ddZ	dd
	 	 	 	 	 ddZ
ed        Zed        Zy)AsyncConversationsClientc               P    t        |      | _        || _        d | _        d | _        y r   )r   r   r   r   r   r    s     r"   r#   z!AsyncConversationsClient.__init__r  s%    6nU-9=?Cr$   c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawConversationsClient
        r&   r'   s    r"   r(   z*AsyncConversationsClient.with_raw_responsex  r)   r$   Nr*   c               t   K   | j                   j                  ||||       d{   }|j                  S 7 w)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.

        branch_id : typing.Optional[str]
            The ID of the branch to use

        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,
                branch_id="branch_id",
            )


        asyncio.run(main())
        r/   Nr1   r4   s         r"   r2   z'AsyncConversationsClient.get_signed_url  sF     f **99$;+	 : 
 
	 ~~
   #868r6   c               t   K   | j                   j                  ||||       d{   }|j                  S 7 w)aA  
        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

        branch_id : typing.Optional[str]
            The ID of the branch to use

        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",
                branch_id="branch_id",
            )


        asyncio.run(main())
        r9   Nr:   r<   s         r"   r;   z)AsyncConversationsClient.get_webrtc_token  sE     f **;;0@Igv < 
 
	 ~~
rz   r=   c                  K   | j                   j                  |||||||||	|
|||||||||||       d{   }|j                  S 7 w)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.

        main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Filter conversations by detected main language (language code).

        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

        conversation_initiation_source : typing.Optional[ConversationInitiationSource]

        branch_id : typing.Optional[str]
            Filter conversations by branch ID.

        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",
                conversation_initiation_source="unknown",
                branch_id="branch_id",
            )


        asyncio.run(main())
        r=   NrQ   rS   s                          r"   rR   zAsyncConversationsClient.list  sy     F **//+#9"7#9#9!!!5/#9!)%+I++ 0 
 
	. ~~/
s   4A	AA	rT   c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)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())
        rT   NrV   rX   s       r"   rW   zAsyncConversationsClient.get  s8     L **..P_.``	~~ a   !646c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)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())
        rT   Nr[   rX   s       r"   r\   zAsyncConversationsClient.delete  s8     L **11/Sb1cc	~~ dr~   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   r^   r   r   )r!   r   s     r"   r_   zAsyncConversationsClient.audio  s+    ;;6*$:N:NODK{{r$   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   ra   r   r   )r!   r   s     r"   rb   z!AsyncConversationsClient.feedback  s+    >>!<0@T@TUDN~~r$   )r   r   )rc   r   rd   ri   rj   rm   rn   ro   rt   r$   r"   rv   rv   q  sU   D     :>*.;?9 9 "7	9
 (9 99 
,9~ 26*.;?6 6 /	6
 (6 96 
6v (,)-DH7;6:7;7;+/+/6:(,VZ[_OSSW*.MQ'+X\*.;?/Z %Z '	Z
 BZ !5Z  4Z !5Z !5Z )Z )Z 4Z &Z TZ !YZ  M!Z" Q#Z$ (%Z& K'Z( %)Z* )V+Z, (-Z. 9/Z0 
+1Zz [_'"'8W'	%'T [_'"'8W'	'R    r$   rv   )"
__future__r   typingcore.client_wrapperr   r   core.request_optionsr   $types.conversation_initiation_sourcer   ,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_CHECKINGr^   r   r   ra   r   r   r   rv   rt   r$   r"   <module>r      sS    #  H 2 P ^ F Q \ < K ^	;DW Wt
A Ar$   