
    b6ic                       d dl mZ d dl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 ddlmZmZ ej*                  rddlmZmZ ddlmZmZ ddlmZmZ ddlm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z)m*Z* ddl+m,Z,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6 ddl7m8Z8m9Z9 ddl:m;Z;m<Z< ddl=m>Z>m?Z? ddl@mAZAmBZB ddlCmDZDmEZE ddlFmGZGmHZH ddlImJZJmKZK  ej                  ej                  d      ZN G d  d!      ZO G d" d#      ZPy)$    )annotationsN   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)AddKnowledgeBaseResponseModel)RagDocumentIndexResponseModel)RagDocumentIndexesResponseModel)RagIndexOverviewResponseModel   )AsyncRawConversationalAiClientRawConversationalAiClient)AgentsClientAsyncAgentsClient)AnalyticsClientAsyncAnalyticsClient)AsyncBatchCallsClientBatchCallsClient)AsyncConversationsClientConversationsClient)AsyncDashboardClientDashboardClient)AsyncKnowledgeBaseClientKnowledgeBaseClient)AsyncLlmUsageClientLlmUsageClient)AsyncMcpServersClientMcpServersClient)AsyncPhoneNumbersClientPhoneNumbersClient)AsyncSecretsClientSecretsClient)AsyncSettingsClientSettingsClient)AsyncSipTrunkClientSipTrunkClient)AsyncTestsClientTestsClient)AsyncToolsClientToolsClient)AsyncTwilioClientTwilioClient)AsyncUsersClientUsersClient)AsyncWhatsappClientWhatsappClient)AsyncWhatsappAccountsClientWhatsappAccountsClient.c                     e Zd ZddZedd       Zdeeedd	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 ddZdd	 	 	 	 	 d dZ	dd	 	 	 	 	 	 	 d!d	Z
ed
        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zy)"ConversationalAiClientc               0   t        |      | _        || _        d | _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        y Nclient_wrapper)r   _raw_client_client_wrapper_conversations_twilio	_whatsapp_agents_tests_users_phone_numbers
_llm_usage_knowledge_base_tools	_settings_secrets_batch_calls
_sip_trunk_mcp_servers_whatsapp_accounts
_analytics
_dashboardselfr9   s     n/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/conversational_ai/client.py__init__zConversationalAiClient.__init__(   s    4NS-DH6::>6:4848CG;?EI48:>8<?C;??CKO<@<@    c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawConversationalAiClient
        r:   rO   s    rP   with_raw_responsez(ConversationalAiClient.with_raw_response>        rR   Nagent_idnameurlfilerequest_optionsc               Z    | j                   j                  |||||      }|j                  S )aM  
        Upload a file or webpage URL to create a knowledge base document. <br> <Note> After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). </Note>

        Parameters
        ----------
        agent_id : typing.Optional[str]

        name : typing.Optional[str]
            A custom, human-readable name for the document.

        url : typing.Optional[str]
            URL to a page of documentation that the agent will have access to in order to interact with users.

        file : typing.Optional[core.File]
            See core.File for more documentation

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

        Returns
        -------
        AddKnowledgeBaseResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.add_to_knowledge_base(
            agent_id="agent_id",
        )
        rX   r:   add_to_knowledge_basedatarO   rY   rZ   r[   r\   r]   	_responses          rP   r`   z,ConversationalAiClient.add_to_knowledge_baseI   s7    X $$::Dco ; 
	 ~~rR   r]   c               R    | j                   j                  |      }|j                  S )a-  
        Provides total size and other information of RAG indexes used by knowledgebase documents

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

        Returns
        -------
        RagIndexOverviewResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.rag_index_overview()
        rd   r:   rag_index_overviewra   rO   r]   rc   s      rP   rg   z)ConversationalAiClient.rag_index_overviewz   s'    2 $$777X	~~rR   c               T    | j                   j                  ||      }|j                  S )a  
        Provides information about all RAG indexes of the specified knowledgebase document.

        Parameters
        ----------
        documentation_id : str
            The id of a document from the knowledge base. This is returned on document addition.

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

        Returns
        -------
        RagDocumentIndexesResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.get_document_rag_indexes(
            documentation_id="21m00Tcm4TlvDq8ikWAM",
        )
        rd   r:   get_document_rag_indexesra   rO   documentation_idr]   rc   s       rP   rk   z/ConversationalAiClient.get_document_rag_indexes   s+    < $$==>N`o=p	~~rR   c               V    | j                   j                  |||      }|j                  S )a]  
        Delete RAG index for the knowledgebase document.

        Parameters
        ----------
        documentation_id : str
            The id of a document from the knowledge base. This is returned on document addition.

        rag_index_id : str
            The id of RAG index of document from the knowledge base.

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

        Returns
        -------
        RagDocumentIndexResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.delete_document_rag_index(
            documentation_id="21m00Tcm4TlvDq8ikWAM",
            rag_index_id="21m00Tcm4TlvDq8ikWAM",
        )
        rd   r:   delete_document_rag_indexra   rO   rm   rag_index_idr]   rc   s        rP   rp   z0ConversationalAiClient.delete_document_rag_index   s3    D $$>>lO ? 
	 ~~rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )r<   conversations.clientr   r;   )rO   r   s     rP   conversationsz$ConversationalAiClient.conversations   s0    &A"5TEYEY"ZD"""rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r-   r8   )r=   twilio.clientr-   r;   )rO   r-   s     rP   twiliozConversationalAiClient.twilio   +    <<3't7K7KLDL||rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r1   r8   )r>   whatsapp.clientr1   r;   )rO   r1   s     rP   whatsappzConversationalAiClient.whatsapp   +    >>!7+4;O;OPDN~~rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )r?   agents.clientr   r;   )rO   r   s     rP   agentszConversationalAiClient.agents   ry   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r)   r8   )r@   tests.clientr)   r;   )rO   r)   s     rP   testszConversationalAiClient.tests   +    ;;1%T5I5IJDK{{rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r/   r8   )rA   users.clientr/   r;   )rO   r/   s     rP   userszConversationalAiClient.users  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r!   r8   )rB   phone_numbers.clientr!   r;   )rO   r!   s     rP   phone_numbersz$ConversationalAiClient.phone_numbers  s0    &@"4DDXDX"YD"""rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rC   llm_usage.clientr   r;   )rO   r   s     rP   	llm_usagez ConversationalAiClient.llm_usage  +    ??"8,D<P<PQDOrR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rD   knowledge_base.clientr   r;   )rO   r   s     rP   knowledge_basez%ConversationalAiClient.knowledge_base  s0    'B#6dFZFZ#[D ###rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r+   r8   )rE   tools.clientr+   r;   )rO   r+   s     rP   toolszConversationalAiClient.tools&  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r%   r8   )rF   settings.clientr%   r;   )rO   r%   s     rP   settingszConversationalAiClient.settings.  r}   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r#   r8   )rG   secrets.clientr#   r;   )rO   r#   s     rP   secretszConversationalAiClient.secrets6  s+    == 5)9M9MNDM}}rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rH   batch_calls.clientr   r;   )rO   r   s     rP   batch_callsz"ConversationalAiClient.batch_calls>  0    $< 0@T@T UD   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r'   r8   )rI   sip_trunk.clientr'   r;   )rO   r'   s     rP   	sip_trunkz ConversationalAiClient.sip_trunkF  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rJ   mcp_servers.clientr   r;   )rO   r   s     rP   mcp_serversz"ConversationalAiClient.mcp_serversN  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r3   r8   )rK   whatsapp_accounts.clientr3   r;   )rO   r3   s     rP   whatsapp_accountsz(ConversationalAiClient.whatsapp_accountsV  s0    ""*H&<DL`L`&aD#&&&rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rL   analytics.clientr   r;   )rO   r   s     rP   	analyticsz ConversationalAiClient.analytics^  +    ??"9-T=Q=QRDOrR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rM   dashboard.clientr   r;   )rO   r   s     rP   	dashboardz ConversationalAiClient.dashboardf  r   rR   )r9   r   )returnr   rY   typing.Optional[str]rZ   r   r[   r   r\   ztyping.Optional[core.File]r]   typing.Optional[RequestOptions]r   r	   r]   r   r   r   rm   strr]   r   r   r   rm   r   rr   r   r]   r   r   r
   __name__
__module____qualname__rQ   propertyrV   OMITr`   rg   rk   rp   ru   rx   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    rR   rP   r5   r5   '   sE   A,     *.%)$(+/;?/ '/ #	/
 "/ )/ 9/ 
'/d EI"A	&: \` #9X	(D os% #%36%Lk%	&%N # #           # #   $ $       ! !   ! ! ' '    rR   r5   c                     e Zd ZddZedd       Zdeeedd	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 ddZdd	 	 	 	 	 d dZ	dd	 	 	 	 	 	 	 d!d	Z
ed
        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zy)"AsyncConversationalAiClientc               0   t        |      | _        || _        d | _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        y r7   )r   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   s     rP   rQ   z$AsyncConversationalAiClient.__init__p  s    9X-IM;??C;?9=9=HL@DJN9=?C=ADH@DDHPTAEAErR   c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawConversationalAiClient
        rT   rU   s    rP   rV   z-AsyncConversationalAiClient.with_raw_response  rW   rR   NrX   c               v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Upload a file or webpage URL to create a knowledge base document. <br> <Note> After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). </Note>

        Parameters
        ----------
        agent_id : typing.Optional[str]

        name : typing.Optional[str]
            A custom, human-readable name for the document.

        url : typing.Optional[str]
            URL to a page of documentation that the agent will have access to in order to interact with users.

        file : typing.Optional[core.File]
            See core.File for more documentation

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

        Returns
        -------
        AddKnowledgeBaseResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.add_to_knowledge_base(
                agent_id="agent_id",
            )


        asyncio.run(main())
        rX   Nr_   rb   s          rP   r`   z1AsyncConversationalAiClient.add_to_knowledge_base  sF     h **@@Dco A 
 
	 ~~
s   $979rd   c               n   K   | j                   j                  |       d{   }|j                  S 7 w)a  
        Provides total size and other information of RAG indexes used by knowledgebase documents

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

        Returns
        -------
        RagIndexOverviewResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.rag_index_overview()


        asyncio.run(main())
        rd   Nrf   rh   s      rP   rg   z.AsyncConversationalAiClient.rag_index_overview  s5     B **==o=^^	~~ _s    535c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)ae  
        Provides information about all RAG indexes of the specified knowledgebase document.

        Parameters
        ----------
        documentation_id : str
            The id of a document from the knowledge base. This is returned on document addition.

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

        Returns
        -------
        RagDocumentIndexesResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.get_document_rag_indexes(
                documentation_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rd   Nrj   rl   s       rP   rk   z4AsyncConversationalAiClient.get_document_rag_indexes  s9     L **CCDTfuCvv	~~ ws   !646c               r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Delete RAG index for the knowledgebase document.

        Parameters
        ----------
        documentation_id : str
            The id of a document from the knowledge base. This is returned on document addition.

        rag_index_id : str
            The id of RAG index of document from the knowledge base.

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

        Returns
        -------
        RagDocumentIndexResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.delete_document_rag_index(
                documentation_id="21m00Tcm4TlvDq8ikWAM",
                rag_index_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rd   Nro   rq   s        rP   rp   z5AsyncConversationalAiClient.delete_document_rag_index  sB     T **DDlO E 
 
	 ~~
s   "757c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )r<   rt   r   r;   )rO   r   s     rP   ru   z)AsyncConversationalAiClient.conversationsF  s0    &F":$J^J^"_D"""rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r,   r8   )r=   rw   r,   r;   )rO   r,   s     rP   rx   z"AsyncConversationalAiClient.twilioN  +    <<8,D<P<PQDL||rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r0   r8   )r>   r{   r0   r;   )rO   r0   s     rP   r|   z$AsyncConversationalAiClient.whatsappV  +    >>!<0@T@TUDN~~rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )r?   r   r   r;   )rO   r   s     rP   r   z"AsyncConversationalAiClient.agents^  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r(   r8   )r@   r   r(   r;   )rO   r(   s     rP   r   z!AsyncConversationalAiClient.testsf  +    ;;6*$:N:NODK{{rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r.   r8   )rA   r   r.   r;   )rO   r.   s     rP   r   z!AsyncConversationalAiClient.usersn  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r    r8   )rB   r   r    r;   )rO   r    s     rP   r   z)AsyncConversationalAiClient.phone_numbersv  s0    &E"9I]I]"^D"""rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rC   r   r   r;   )rO   r   s     rP   r   z%AsyncConversationalAiClient.llm_usage~  +    ??"=1AUAUVDOrR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rD   r   r   r;   )rO   r   s     rP   r   z*AsyncConversationalAiClient.knowledge_base  s0    'G#;4K_K_#`D ###rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r*   r8   )rE   r   r*   r;   )rO   r*   s     rP   r   z!AsyncConversationalAiClient.tools  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r$   r8   )rF   r   r$   r;   )rO   r$   s     rP   r   z$AsyncConversationalAiClient.settings  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r"   r8   )rG   r   r"   r;   )rO   r"   s     rP   r   z#AsyncConversationalAiClient.secrets  s+    == :.d>R>RSDM}}rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rH   r   r   r;   )rO   r   s     rP   r   z'AsyncConversationalAiClient.batch_calls  0    $A 5TEYEY ZD   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r&   r8   )rI   r   r&   r;   )rO   r&   s     rP   r   z%AsyncConversationalAiClient.sip_trunk  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rJ   r   r   r;   )rO   r   s     rP   r   z'AsyncConversationalAiClient.mcp_servers  r   rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r2   r8   )rK   r   r2   r;   )rO   r2   s     rP   r   z-AsyncConversationalAiClient.whatsapp_accounts  s1    ""*M&AQUQeQe&fD#&&&rR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rL   r   r   r;   )rO   r   s     rP   r   z%AsyncConversationalAiClient.analytics  +    ??">2$BVBVWDOrR   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r8   )rM   r   r   r;   )rO   r   s     rP   r   z%AsyncConversationalAiClient.dashboard  r   rR   )r9   r   )r   r   r   r   r   r   r   r   rR   rP   r   r   o  sF   F,     *.%)$(+/;?7 '7 #	7
 "7 )7 97 
'7t EI""A"	&"J \`' #'9X'	('T os- #-36-Lk-	&-^ # #           # #   $ $       ! !   ! ! ' '    rR   r   )Q
__future__r   typing r   core.client_wrapperr   r   core.request_optionsr   'types.add_knowledge_base_response_modelr	   'types.rag_document_index_response_modelr
   )types.rag_document_indexes_response_modelr   'types.rag_index_overview_response_modelr   
raw_clientr   r   TYPE_CHECKINGr   r   r   r   r   r   r   r   r   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r   r"   r#   r   r$   r%   r   r&   r'   r   r(   r)   r   r*   r+   rw   r,   r-   r   r.   r/   r{   r0   r1   r   r2   r3   castAnyr   r5   r   r   rR   rP   <module>r      s    #   G 1 S S W S Q	>GKSGTEKQADE;;>;D]v{{6::s#E EP
e erR   