
    i/                         d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	m
Z
 ddlmZmZmZ ddlmZmZmZmZmZ dd	lmZmZ  G d
 d      Zy)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )SDKConfiguration    N)modelsutils)AfterErrorContextAfterSuccessContextBeforeRequestContext)RetryConfigSerializedRequestBodyget_body_content)CallableListMappingOptionalTuple)parse_qsurlparsec                   "   e Zd ZU eed<   dZee   ed<   	 	 ddedee   ddfdZd Z		 	 	 	 	 	 ddee
   d	eeg ee   f      d
ee   deeeef      dej                   f
dZ	 	 	 	 	 	 ddee
   d	eeg ee   f      d
ee   deeeef      dej                   f
dZ	 	 	 	 	 	 ddee
   d	eeg ee   f      d
ee   deeeef      dej                   f
dZ	 	 ddeeeee   f      dej.                  fdZ	 	 ddeeeee   f      dej.                  fdZy)BaseSDKsdk_configurationN
parent_ref
sdk_configreturnc                      || _         || _        y N)r   r   )selfr   r   s      O/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mistralai/basesdk.py__init__zBaseSDK.__init__   s    
 ",$    c                 x    | j                   j                         \  }}||}||}t        j                  ||      S r   )r   get_server_detailsr   template_url)r   base_urlurl_variablessdk_urlsdk_variabless        r   _get_urlzBaseSDK._get_url    sD    !%!7!7!J!J!LH )M!!(M::r   
timeout_msget_serialized_bodyurl_overridehttp_headersc                 p    | j                   j                  }| j                  ||||||||||	|
||||||      S r   )r   async_client_build_request_with_clientr   methodpathr#   r$   requestrequest_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_value_globalssecurityr(   r)   r*   r+   clients                     r   _build_request_asynczBaseSDK._build_request_async+   s[    * ''44..!#$#
 	
r   c                 p    | j                   j                  }| j                  ||||||||||	|
||||||      S r   )r   r:   r.   r/   s                     r   _build_requestzBaseSDK._build_requestU   s[    * ''....!#$#
 	
r   c           
         i }|}|Ot        j                  | j                  ||      ||r|nd |r|nd       }t        j                  |	r|nd |	r|nd       }n+t	        t        |            }t        |j                  d      }t        j                  ||      }||d<   | j                  j                  ||
<   |t        |      r |       }t        j                  |t        j                        }|$t        j                  |      \  }}i ||}i ||}t!               }| |       }|r|t#        d      ||}|j$                  |j$                  dvr|j$                  |d<   ||j'                         D ]
  \  }}|||<    ||dz  nd }|j)                  ||||j*                  |j,                  |j.                  ||      S )	NT)keep_blank_valuesAcceptzrequest body is required)zmultipart/form-datazmultipart/mixedzcontent-typei  )paramscontentdatafilesheaderstimeout)r   generate_urlr'   get_query_paramsr   strr   queryget_headersr   
user_agentcallableget_security_from_envr   Securityget_securityr   
ValueError
media_typeitemsbuild_requestrB   rC   rD   )r   r:   r0   r1   r#   r$   r2   r3   r4   r5   r6   r7   r8   r9   r(   r)   r*   r+   query_paramsurlparsed_overriderE   security_headerssecurity_query_paramsserialized_request_bodyrbheadervaluerF   s                                r   r.   z"BaseSDK._build_request_with_client   s   , ;$$h623	C !1134$L 's<'89O#O$9$9TRL##GX6/%)%;%;%F%F!"!#:..xI6;6H6H6R3355$45GDlD.CDL"7"9*$&B$ !;<<~*,' $..:'22 '>&H&HGN##!-!3!3!5 ("'( (2'=*t#4##+33(--)// $ 	
 		
r   retry_configc                   	
 | j                   j                  | j                   j                  
| j                   j                  d   		
fd}|1t	        j
                  |t	        j                  |d   |d               }n |       }t	        j                  |j                        s	j                  t              |      }|S )N_hooksc            	      n   d } 	 	j                  t                    }
j                  d|j                  |j                  |j
                  t        |             t        d      j                  |      } | &
j                  d       t        j                  d      
j                  d	| j                  | j                  | j
                  rd
n| j                         t!        j"                  | j                        rc	j                  t              | d       \  }}|
j                  dd       |||} | S 
j                  d       t        j$                  d|       | S # t        $ rA}	j                  t              d |      \  }}|
j                  dd       |Y d }~3d }~ww xY wNz0Request:
Method: %s
URL: %s
Headers: %s
Body: %szclient is required)streamzRequest ExceptionT)exc_infozRaising no response SDK errorzNo response receivedz6Response:
Status Code: %s
URL: %s
Headers: %s
Body: %sz<streaming response>zRaising unexpected SDK errorzUnexpected error occurredbefore_requestr	   debugr0   rV   rE   r   rQ   send	Exceptionafter_errorr   r   NoResponseErrorstatus_codetextr   match_status_codesSDKErrorhttp_resreqe_resulterrr:   error_status_codeshook_ctxhooksloggerr2   rc   s         r   dozBaseSDK.do_request.<locals>.do   s   H**+?+I7SJJJGGKK$S) >$%9::!;;s6;: <=,,-CDDLLL$$  *0&hmm ''(:H<P<PQ#//%h/4 ?LL!4tLDI%%H
 O LL!?@ //*ExPPO?  (():8)DdAN1=LL!4tLDG !s   A7E* *	F436F//F4r   r   )r   r:   debug_logger__dict__r   retryRetriesrn   rl   after_successr   r   rx   r2   rw   rc   r^   r{   rq   r:   ry   rz   s    ````   @@@r   
do_requestzBaseSDK.do_request   s     ''..''44&&//9/	 /	b #{{2u}}\!_lSTo'VWHtH''(:H<P<PQ**+>x+H(SHr   c                   	
K   | j                   j                  | j                   j                  
| j                   j                  d   		
fd}|9t	        j
                  |t	        j                  |d   |d                d {   }n |        d {   }t	        j                  |j                        s	j                  t              |      }|S 7 Q7 Cw)Nr`   c            	        K   d } 	 	j                  t                    }
j                  d|j                  |j                  |j
                  t        |             t        d      j                  |       d {   } | &
j                  d       t        j                  d      
j                  d	| j                  | j                  | j
                  rd
n| j                         t!        j"                  | j                        rc	j                  t              | d       \  }}|
j                  dd       |||} | S 
j                  d       t        j$                  d|       | S 7 # t        $ rA}	j                  t              d |      \  }}|
j                  dd       |Y d }~5d }~ww xY wwrb   re   rp   s         r   r{   z$BaseSDK.do_request_async.<locals>.do1  s    H**+?+I7SJJJGGKK$S) >$%9::!'S!@@ <=,,-CDDLLL$$  *0&hmm ''(:H<P<PQ#//%h/4 ?LL!4tLDI%%H
 O LL!?@ //*ExPPOA A (():8)DdAN1=LL!4tLDG !sB   GA:E6 E4E6 C.G4E6 6	G ?6F;5G;G  Gr   r   )r   r-   r|   r}   r   retry_asyncr   rn   rl   r   r   r   s    ````   @@@r   do_request_asynczBaseSDK.do_request_async$  s      ''44''44&&//9/	 /	b #"..EMM,q/<?C H  TzH''(:H<P<PQ**+>x+H(SH "s%   BC%C!C%C# AC%#C%r   )NNNNNN)FN)__name__
__module____qualname__r   __annotations__r   r   objectr   r'   intr   r   rI   r   httpxRequestr;   r=   r.   r   r
   r   Responser   r    r   r   r   r      sI   ''#'J ' (,%$% V$% 
	%	;. $( &*48'(
 SM(
 &R"7889
(
$ sm%(
& wsCx01'(
( 
)(
l $( &*48'(
 SM(
 &R"7889
(
$ sm%(
& wsCx01'(
( 
)(
n $( &*48)[
 SM[
  &R"7889
![
& sm'[
( wsCx01)[
* 
+[
D @DF u[$s)%;<=F 
FZ @DH u[$s)%;<=H 
Hr   r   )__doc__sdkconfigurationr   r   	mistralair   r   mistralai._hooksr   r   r	   mistralai.utilsr
   r   r   typingr   r   r   r   r   urllib.parser   r   r   r   r   r   <module>r      s9    G .  # 
 Q P ; ; +\ \r   