o
    i*-                     @   s   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mZ dd	lmZ dd
lmZ ddlmZ ddlmZ e e jdZG dd dZG dd dZdS )    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ReadV1RequestParams)ReadV1Response   )AsyncRawTextClientRawTextClient) TextAnalyzeRequestCallbackMethod)"TextAnalyzeRequestCustomIntentMode)!TextAnalyzeRequestCustomTopicMode)TextAnalyzeRequestSummarize.c                   @     e Zd ZdefddZedefddZddddddddddddddd	ed
e	j
e de	j
e de	j
e de	j
e de	j
e	jee	je f  de	j
e de	j
e	jee	je f  de	j
e de	j
e de	j
e	jee	je f  de	j
e de	j
e de	j
e defddZdS )
TextClientclient_wrapperc                C      t |d| _d S N)r   )r
   _raw_clientselfr    r   P/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/read/v1/text/client.py__init__      zTextClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawTextClient
        r   r   r   r   r   with_raw_response      	zTextClient.with_raw_responseNcallbackcallback_method	sentiment	summarizetagtopicscustom_topiccustom_topic_modeintentscustom_intentcustom_intent_modelanguagerequest_optionsrequestr"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   c                C   s.   | j j|||||||||	|
||||d}|jS )a  
        Analyze text content using Deepgrams text analysis API

        Parameters
        ----------
        request : ReadV1RequestParams

        callback : typing.Optional[str]
            URL to which we'll make the callback request

        callback_method : typing.Optional[TextAnalyzeRequestCallbackMethod]
            HTTP method by which the callback request will be made

        sentiment : typing.Optional[bool]
            Recognizes the sentiment throughout a transcript or text

        summarize : typing.Optional[TextAnalyzeRequestSummarize]
            Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

        tag : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Label your requests for the purpose of identification during usage reporting

        topics : typing.Optional[bool]
            Detect topics throughout a transcript or text

        custom_topic : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Custom topics you want the model to detect within your input audio or text if present Submit up to `100`.

        custom_topic_mode : typing.Optional[TextAnalyzeRequestCustomTopicMode]
            Sets how the model will interpret strings submitted to the `custom_topic` param. When `strict`, the model will only return topics submitted using the `custom_topic` param. When `extended`, the model will return its own detected topics in addition to those submitted using the `custom_topic` param

        intents : typing.Optional[bool]
            Recognizes speaker intent throughout a transcript or text

        custom_intent : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Custom intents you want the model to detect within your input audio if present

        custom_intent_mode : typing.Optional[TextAnalyzeRequestCustomIntentMode]
            Sets how the model will interpret intents submitted to the `custom_intent` param. When `strict`, the model will only return intents submitted using the `custom_intent` param. When `extended`, the model will return its own detected intents in the `custom_intent` param.

        language : typing.Optional[str]
            The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

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

        Returns
        -------
        ReadV1Response
            Successful text analysis

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.read.v1.text.analyze(
            callback="callback",
            callback_method="POST",
            sentiment=True,
            summarize="v2",
            tag="tag",
            topics=True,
            custom_topic="custom_topic",
            custom_topic_mode="extended",
            intents=True,
            custom_intent="custom_intent",
            custom_intent_mode="extended",
            language="language",
            request={"url": "url"},
        )
        r/   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r   analyzedatar   r/   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   	_responser   r   r   r2   "   s"   \zTextClient.analyze)__name__
__module____qualname__r   r   propertyr
   r   r   typingOptionalstrr   boolr   UnionSequencer   r   r   r   r2   r   r   r   r   r      `    	
r   c                   @   r   )AsyncTextClientr   c                C   r   r   )r	   r   r   r   r   r   r      r   zAsyncTextClient.__init__r   c                 C   r   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawTextClient
        r   r   r   r   r   r      r    z!AsyncTextClient.with_raw_responseNr!   r/   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   c                   s6   | j j|||||||||	|
||||dI dH }|jS )ad  
        Analyze text content using Deepgrams text analysis API

        Parameters
        ----------
        request : ReadV1RequestParams

        callback : typing.Optional[str]
            URL to which we'll make the callback request

        callback_method : typing.Optional[TextAnalyzeRequestCallbackMethod]
            HTTP method by which the callback request will be made

        sentiment : typing.Optional[bool]
            Recognizes the sentiment throughout a transcript or text

        summarize : typing.Optional[TextAnalyzeRequestSummarize]
            Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

        tag : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Label your requests for the purpose of identification during usage reporting

        topics : typing.Optional[bool]
            Detect topics throughout a transcript or text

        custom_topic : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Custom topics you want the model to detect within your input audio or text if present Submit up to `100`.

        custom_topic_mode : typing.Optional[TextAnalyzeRequestCustomTopicMode]
            Sets how the model will interpret strings submitted to the `custom_topic` param. When `strict`, the model will only return topics submitted using the `custom_topic` param. When `extended`, the model will return its own detected topics in addition to those submitted using the `custom_topic` param

        intents : typing.Optional[bool]
            Recognizes speaker intent throughout a transcript or text

        custom_intent : typing.Optional[typing.Union[str, typing.Sequence[str]]]
            Custom intents you want the model to detect within your input audio if present

        custom_intent_mode : typing.Optional[TextAnalyzeRequestCustomIntentMode]
            Sets how the model will interpret intents submitted to the `custom_intent` param. When `strict`, the model will only return intents submitted using the `custom_intent` param. When `extended`, the model will return its own detected intents in the `custom_intent` param.

        language : typing.Optional[str]
            The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

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

        Returns
        -------
        ReadV1Response
            Successful text analysis

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.read.v1.text.analyze(
                callback="callback",
                callback_method="POST",
                sentiment=True,
                summarize="v2",
                tag="tag",
                topics=True,
                custom_topic="custom_topic",
                custom_topic_mode="extended",
                intents=True,
                custom_intent="custom_intent",
                custom_intent_mode="extended",
                language="language",
                request={"url": "url"},
            )


        asyncio.run(main())
        r0   Nr1   r4   r   r   r   r2      s$   dzAsyncTextClient.analyze)r6   r7   r8   r   r   r9   r	   r   r   r:   r;   r<   r   r=   r   r>   r?   r   r   r   r   r2   r   r   r   r   rA      r@   rA   )r:   core.client_wrapperr   r   core.request_optionsr   requests.read_v1requestr   types.read_v1responser   
raw_clientr	   r
   *types.text_analyze_request_callback_methodr   -types.text_analyze_request_custom_intent_moder   ,types.text_analyze_request_custom_topic_moder   $types.text_analyze_request_summarizer   castAnyOMITr   rA   r   r   r   r   <module>   s   ~