o
    qmiD!                     @   s   d dl Z d dlZd dlZddlmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZmZ ddl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&m'Z' G dd dZ(G dd dZ)dS )    N   )AsyncChatClient
ChatClient)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncDocumentIntelligenceClientDocumentIntelligenceClient)SarvamAIEnvironment)AsyncSpeechToTextClientSpeechToTextClient)AsyncSpeechToTextJobClientSpeechToTextJobClient) AsyncSpeechToTextStreamingClientSpeechToTextStreamingClient)#AsyncSpeechToTextTranslateJobClientSpeechToTextTranslateJobClient))AsyncSpeechToTextTranslateStreamingClient$SpeechToTextTranslateStreamingClient)AsyncTextClient
TextClient)AsyncTextToSpeechClientTextToSpeechClient) AsyncTextToSpeechStreamingClientTextToSpeechStreamingClientc                   @   t   e Zd ZdZejedddddddedej	e
 dej	eje
e
f  d	ej	e d
ej	e dej	ej fddZdS )SarvamAIa9  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    environment : SarvamAIEnvironment
        The environment to use for requests from the client. from .environment import SarvamAIEnvironment



        Defaults to SarvamAIEnvironment.PRODUCTION



    api_subscription_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.Client]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from sarvamai import SarvamAI

    client = SarvamAI(
        api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
    )
    SARVAM_API_KEYNTenvironmentapi_subscription_keyheaderstimeoutfollow_redirectshttpx_clientr   r    r!   r"   r#   r$   c                C      |d ur|n	|d u rdn|j j}|d u rtddt||||d ur#|n|d ur.tj||dntj|d|d| _t| jd| _t	| jd| _
t| jd| _t| jd| _t| jd| _t| jd| _t| jd| _t| jd| _t| jd| _t| jd| _d S N<   zcThe client must be instantiated be either passing in api_subscription_key or setting SARVAM_API_KEY)body)r"   r#   )r"   )r   r    r!   r$   r"   )client_wrapper)r"   readr   r   httpxClient_client_wrapperr   textr   speech_to_textr   text_to_speechr   chatr   speech_to_text_jobr   speech_to_text_translate_jobr	   document_intelligencer   speech_to_text_streamingr   "speech_to_text_translate_streamingr   text_to_speech_streamingselfr   r    r!   r"   r#   r$   _defaulted_timeout r;   C/home/ubuntu/.local/lib/python3.10/site-packages/sarvamai/client.py__init__>   :   
zSarvamAI.__init__)__name__
__module____qualname____doc__r
   
PRODUCTIONosgetenvtypingOptionalstrDictfloatboolr+   r,   r=   r;   r;   r;   r<   r      *    '
r   c                   @   r   )AsyncSarvamAIaH  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    environment : SarvamAIEnvironment
        The environment to use for requests from the client. from .environment import SarvamAIEnvironment



        Defaults to SarvamAIEnvironment.PRODUCTION



    api_subscription_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.AsyncClient]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from sarvamai import AsyncSarvamAI

    client = AsyncSarvamAI(
        api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
    )
    r   NTr   r   r    r!   r"   r#   r$   c                C   r%   r&   )r"   r*   r   r   r+   AsyncClientr-   r   r.   r   r/   r   r0   r   r1   r   r2   r   r3   r   r4   r   r5   r   r6   r   r7   r8   r;   r;   r<   r=      r>   zAsyncSarvamAI.__init__)r?   r@   rA   rB   r
   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r+   rN   r=   r;   r;   r;   r<   rM   h   rL   rM   )*rD   rF   r+   chat.clientr   r   core.api_errorr   core.client_wrapperr   r   document_intelligence.clientr   r	   r   r
   speech_to_text.clientr   r   speech_to_text_job.clientr   r   speech_to_text_streaming.clientr   r   #speech_to_text_translate_job.clientr   r   )speech_to_text_translate_streaming.clientr   r   text.clientr   r   text_to_speech.clientr   r   text_to_speech_streaming.clientr   r   r   rM   r;   r;   r;   r<   <module>   s$   O