o
    i                     @   s   d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZmZ ddlm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mZmZmZmZm Z  ddl!Z!erjddl"m#Z# ddl$m%Z% G dd deZ&dS )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK)AsyncHttpClientClientOwner
HttpClientclose_clients)SDKConfiguration)Loggerget_default_logger)RetryConfig    N)modelsutils)SDKHooks)OptionalNullableUNSET)AnyCallableDictOptionalTYPE_CHECKINGUnioncast)Chat)Ocrc                       s   e Zd ZU dZded< 	 ded< dddZd	d	d	ed	d	fd
eee	g ef f dede
eeef  de
e de
e dee de
e de
e dd	fddZdefddZ fddZdd Zdd Zdd Zd d! Z  ZS )"MistralAzurezMistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.r   chatr   ocr)zmistralai_azure.chatr   )zmistralai_azure.ocrr   )r   r   Nazure_api_keyazure_endpoint
url_paramsclientasync_clientretry_config
timeout_msdebug_loggerreturnc	                    sn  | ds	|d7 }| ds|d7 }|}	d}
|du r t }d}
tt|ts+J dd}|du r7t }d}|du r>t }tt|tsIJ dd}t	 rV fdd	}nt
j d
}|	durj|durjt|	|}	t| t||
||||	d|||d
 t }|| jjd< | j ^}}|||\}	| j_||	kr|	| j_t| ttt| j| jj| jj| jj| jj dS )a  Instantiates the SDK configuring it with the provided parameters.

        :param azure_api_key: The azure_api_key required for authentication
        :param azure_endpoint: The Azure AI endpoint URL to use for all methods
        :param url_params: Parameters to optionally template the server URL with
        :param client: The HTTP client to use for all synchronous methods
        :param async_client: The Async HTTP client to use for all asynchronous methods
        :param retry_config: The retry configuration to use for all supported methods
        :param timeout_ms: Optional request timeout applied to each operation in milliseconds
        /zv1/TNFz;The provided client must implement the HttpClient protocol.zFThe provided async_client must implement the AsyncHttpClient protocol.c                      s   t j  dS )Napi_key)r   Security r   r*   Y/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mistralai_azure/sdk.py<lambda>T   s    z'MistralAzure.__init__.<locals>.<lambda>r'   )
r    client_suppliedr!   async_client_suppliedsecurity
server_urlserverr"   r#   r$   _hooks) endswithhttpxClient
issubclasstyper   AsyncClientr	   r   callabler   r)   r   template_urlr   __init__r   r   sdk_configuration__dict__get_server_detailssdk_initr    r1   weakreffinalizer   r   r   r.   r!   r/   )selfr   r   r   r    r!   r"   r#   r$   r1   r.   r/   r0   hookscurrent_server_url_r*   r+   r,   r<       s   


zMistralAzure.__init__namec                 C   s   || j v r[| j | \}}zt|}t||}|| j}t| || |W S  ty> } ztd| d| d| |d }~w tyZ } ztd| d| d| d| |d }~ww tdt| j	 d| d)NzFailed to import module z for attribute z: zFailed to find class z in module 'z' object has no attribute ')
_sub_sdk_map	importlibimport_modulegetattrr=   setattrImportErrorAttributeErrorr8   __name__)rC   rG   module_path
class_namemoduleklassinstanceer*   r*   r,   __getattr__   s4   



zMistralAzure.__getattr__c                    s0   t t  }t | j }tt t|| S N)listsuper__dir__rI   keyssortedset)rC   default_attrs
lazy_attrs	__class__r*   r,   r[      s   zMistralAzure.__dir__c                 C   s   | S rX   r*   rC   r*   r*   r,   	__enter__   s   zMistralAzure.__enter__c                    s   | S rX   r*   rc   r*   r*   r,   
__aenter__   s   zMistralAzure.__aenter__c                 C   s,   | j jd ur| j js| j j  d | j _d S rX   )r=   r    r.   closerC   exc_typeexc_valexc_tbr*   r*   r,   __exit__   s
   zMistralAzure.__exit__c                    s4   | j jd ur| j js| j j I d H  d | j _d S rX   )r=   r!   r/   acloserg   r*   r*   r,   	__aexit__   s   zMistralAzure.__aexit__)rP   
__module____qualname____doc____annotations__rI   r   r   strr   r   r   r   r   r   r
   intr   r<   rW   r[   rd   re   rk   rm   __classcell__r*   r*   ra   r,   r      sN   
 		

br   )'rp   basesdkr   
httpclientr   r   r   r   sdkconfigurationr   utils.loggerr   r	   utils.retriesr
   r5   rJ   mistralai_azurer   r   mistralai_azure._hooksr   mistralai_azure.typesr   r   typingr   r   r   r   r   r   r   rA   mistralai_azure.chatr   mistralai_azure.ocrr   r   r*   r*   r*   r,   <module>   s"    $