o
    i                      @   sh  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ZddlmZmZmZmZmZm Z m!Z! ddl"Z"erd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/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m: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)Agents)Audio)Batch)Beta)Chat)Classifiers)
Embeddings)Files)Fim)
FineTuning)Models)Ocrc                       sr  e Zd ZU dZded< 	 ded< ded< 	 ded	< d
ed< ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< ddddddd d!d"d#d$d%d&Zd'd'd'd'd'd'ed'd'f	d(eeee	 e
g ee	 f f  d)ee	 d*ee	 d+eee	e	f  d,ee d-ee d.ee d/ee d0ee d1d'fd2d3ZdDd5d6Zd7e	fd8d9Z fd:d;Zd<d= Zd>d? Zd@dA ZdBdC Z  ZS )EMistralzMistral 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"   r   r   betar   filesr!   fine_tuningr   batchr   chatr    fimr   agentsr   
embeddingsr   classifiersr#   ocrr   audio)zmistralai.models_r"   )zmistralai.betar   )zmistralai.filesr   )zmistralai.fine_tuningr!   )zmistralai.batchr   )zmistralai.chatr   )zmistralai.fimr    )zmistralai.agentsr   )zmistralai.embeddingsr   )zmistralai.classifiersr   )zmistralai.ocrr#   )zmistralai.audior   )r   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   Napi_keyserver
server_url
url_paramsclientasync_clientretry_config
timeout_msdebug_loggerreturnc
                    sJ  d}
|du rt  }d}
tt|tsJ dd}|du r#t  }d}|	du r*t }	tt|ts5J dd}t rB fdd}nt	j
 d}|durV|durVt||}tj| 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 api_key: The api_key required for authentication
        :param server: The server by name to use for all methods
        :param server_url: The server 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
        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r0   )r   Security r:   r<   S/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mistralai/sdk.py<lambda>u   s    z"Mistral.__init__.<locals>.<lambda>r:   )
r4   client_suppliedr5   async_client_suppliedsecurityr2   r1   r6   r7   r8   
parent_ref_hooks)httpxClient
issubclasstyper   AsyncClientr	   r   callabler   r;   r   template_urlr   __init__r   r   sdk_configuration__dict__get_server_detailssdk_initr4   r2   weakreffinalizer   r   r   r?   r5   r@   )selfr0   r1   r2   r3   r4   r5   r6   r7   r8   r?   r@   rA   hookscurrent_server_url_r<   r:   r=   rL   F   sx   
zMistral.__init__   c              	   C   sf   t |D ]#}zt|W   S  ty'   tj|d  ||d kr%Y  nY qw td| d| d)Nr   zFailed to import module 'z' after z	 attempts)range	importlibimport_moduleKeyErrorsysmodulespop)rS   modnameretriesattemptr<   r<   r=   dynamic_import   s   zMistral.dynamic_importnamec                 C   s   || j v r]| j | \}}z| |}t||}|| j| d}t| || |W S  ty@ } ztd| d| d| |d }~w ty\ } ztd| d| d| d| |d }~ww tdt| j d| d)	NrB   zFailed to import module z for attribute z: zFailed to find class z in module 'z' object has no attribute ')	_sub_sdk_maprb   getattrrM   setattrImportErrorAttributeErrorrH   __name__)rS   rc   module_path
class_namemoduleklassinstanceer<   r<   r=   __getattr__   s4   


zMistral.__getattr__c                    s0   t t  }t | j }tt t|| S N)listsuper__dir__re   keyssortedset)rS   default_attrs
lazy_attrs	__class__r<   r=   ru      s   zMistral.__dir__c                 C   s   | S rr   r<   rS   r<   r<   r=   	__enter__   s   zMistral.__enter__c                    s   | S rr   r<   r}   r<   r<   r=   
__aenter__   s   zMistral.__aenter__c                 C   s,   | j jd ur| j js| j j  d | j _d S rr   )rM   r4   r?   closerS   exc_typeexc_valexc_tbr<   r<   r=   __exit__   s
   zMistral.__exit__c                    s4   | j jd ur| j js| j j I d H  d | j _d S rr   )rM   r5   r@   acloser   r<   r<   r=   	__aexit__   s   zMistral.__aexit__)rW   )rj   
__module____qualname____doc____annotations__re   r   r   r   strr   r   r   r   r   r
   intr   rL   rb   rq   ru   r~   r   r   r   __classcell__r<   r<   r{   r=   r$       s   
 	


^r$   )<r   basesdkr   
httpclientr   r   r   r   sdkconfigurationr   utils.loggerr   r	   utils.retriesr
   rE   rY   	mistralair   r   mistralai._hooksr   mistralai.typesr   r   r\   typingr   r   r   r   r   r   r   rQ   mistralai.agentsr   mistralai.audior   mistralai.batchr   mistralai.betar   mistralai.chatr   mistralai.classifiersr   mistralai.embeddingsr   mistralai.filesr   mistralai.fimr    mistralai.fine_tuningr!   mistralai.models_r"   mistralai.ocrr#   r$   r<   r<   r<   r=   <module>   s8    $