
    ^hn                     D   S SK Jr  S SKrS SKr " S S\R                  5      r " S S\R
                  5      r " S S\R                  5      r " S	 S
\R                  5      r " S S\R                  5      r	 " S S\R                  5      r
 " S S\R                  5      r " S S\5      r " S S\5      r " S S\5      r " S S\R                  5      r " S S\R"                  5      r " S S\R$                  5      r " S S\R&                  5      r " S S \R(                  5      r " S! S"\5      r " S# S$\R,                  5      r " S% S&\5      r\\\\\\	\
\\\\\\\\\\\\/r " S' S(\5      r " S) S*\R                  5      r " S+ S,\R$                  5      rg)-    )OptionalNc            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )AuthenticationError   responselitellm_debug_infomax_retriesnum_retriesc                 B  > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        U=(       d2    [        R                  " U R                   [        R                  " SSS9S9U l        [        TU ]5  U R                  U R                  S S9  g )Ni  zlitellm.AuthenticationError: {}GEThttps://litellm.aimethodurlstatus_coderequestr   bodyr   formatmessagellm_providermodelr   r	   r
   httpxResponseRequestr   super__init__	selfr   r   r   r   r   r	   r
   	__class__s	           L/home/james-whalen/.local/lib/python3.13/site-packages/litellm/exceptions.pyr   AuthenticationError.__init__   s     8??H(
"4&&  
ENN((MM"6%
 	LL4==t 	 	
    c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ Nz LiteLLM Retried: z timesz, LiteLLM Max Retries: r   r
   r	   r!   _messages     r#   __str__AuthenticationError.__str__.   V    <<,T-=-=,>fEEH1$2B2B1CDDHr%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   __repr__AuthenticationError.__repr__6   r-   r%   r   r   r	   r   r   r
   r   r   NNNN__name__
__module____qualname____firstlineno__r   r   r   strintr   r+   r/   __static_attributes____classcell__r"   s   @r#   r   r      g     .2,0%)%)

 5>>*
 %SM
 c]
 c]
 
6 r%   r   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )NotFoundError@   r   r   r	   r
   c                 B  > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        U=(       d2    [        R                  " U R                   [        R                  " SSS9S9U l        [        TU ]5  U R                  U R                  S S9  g )Ni  zlitellm.NotFoundError: {}r   r   r   r   r   )r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   	r!   r   r   r   r   r   r	   r
   r"   s	           r#   r   NotFoundError.__init__A   s     299'B
("4&&  
ENN((MM"6%
 	LL4==t 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   NotFoundError.__str__\   r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   NotFoundError.__repr__d   r-   r%   r1   r2   r3   r<   s   @r#   r?   r?   @   r=   r%   r?   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )BadRequestErrorm   r   r   r	   r
   c                   > SU l         SR                  U5      U l        X l        X0l        XPl        [        R                  " U R                   [        R                  " SSS9S9nX`l	        Xpl
        [        TU ]1  U R                  US S9  g )N  zlitellm.BadRequestError: {}r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r	   r
   r   r   rB   s	           r#   r   BadRequestError.__init__n   s     4;;GD
("4>>((MM"6
 '&LL8$ 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   BadRequestError.__str__   r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   BadRequestError.__repr__   r-   r%   r   r   r	   r   r   r
   r   r2   r3   r<   s   @r#   rI   rI   m   r=   r%   rI   c            
       x   ^  \ rS rSr   S
S\R
                  S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )UnprocessableEntityError   r   r   r	   r
   c                    > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        [        TU ]%  U R                  US S9  g )Ni  z$litellm.UnprocessableEntityError: {}r   )
r   r   r   r   r   r   r	   r
   r   r   rB   s	           r#   r   !UnprocessableEntityError.__init__   sY     =DDWM
("4&&LL8$ 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+    UnprocessableEntityError.__str__   r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   !UnprocessableEntityError.__repr__   r-   r%   rR   NNNr4   r5   r6   r7   r   r   r   r8   r9   r   r+   r/   r:   r;   r<   s   @r#   rT   rT      _     -1%)%)

 ..
 %SM
 c]
 c]
 
* r%   rT   c            
       l   ^  \ rS rSr    S
S\\   S\\   S\\   S\\   4U 4S jjjrS r	S r
S	rU =r$ )Timeout   r   r	   r
   headersc                    > [         R                  " SSS9n[        T	U ]  US9  SU l        SR                  U5      U l        X l        X0l        X@l	        XPl
        X`l        Xpl        g )NPOSThttps://api.openai.com/v1r   )r   i  zlitellm.Timeout: {})r   r   r   r   r   r   r   r   r   r   r	   r
   rb   )
r!   r   r   r   r   r	   r
   rb   r   r"   s
            r#   r   Timeout.__init__   sn     --+
 	 	 	
 ,33G<
("4&&r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   Timeout.__str__   r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   Timeout.__repr__   r-   r%   )rb   r   r   r	   r   r   r
   r   r2   )r4   r5   r6   r7   r   r8   r9   dictr   r+   r/   r:   r;   r<   s   @r#   r`   r`      sb     -1%)%)"&
 %SM c] c] $ 6 r%   r`   c            
       x   ^  \ rS rSr   S
S\R
                  S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )PermissionDeniedError   r   r   r	   r
   c                    > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        [        TU ]%  U R                  US S9  g )Ni  z!litellm.PermissionDeniedError: {}r   )
r   r   r   r   r   r   r	   r
   r   r   r    s	           r#   r   PermissionDeniedError.__init__   sY     :AA'J(
"4&&LL8$ 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   PermissionDeniedError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   PermissionDeniedError.__repr__  r-   r%   rR   r\   r]   r<   s   @r#   rm   rm      r^   r%   rm   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )RateLimitErrori  r   r   r	   r
   c           	      ^  > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        Ub  [        USS 5      OS n[        R                  " SU[        R                  " SSS9S9U l        [        T	U ]9  U R                  U R                  S S9  S	U l        S
U l        g )Ni  zlitellm.RateLimitError: {}rb   rd   $ https://cloud.google.com/vertex-ai/r   )r   rb   r   r   429throttling_error)r   r   r   r   r   r   r	   r
   getattrr   r   r   r   r   r   codetype)
r!   r   r   r   r   r   r	   r
   _response_headersr"   s
            r#   r   RateLimitError.__init__  s     3::7C(
"4&&2:2FGHi.D 	 %MM:
 	LL4==t 	 	
 	&	r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   RateLimitError.__str__8  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   RateLimitError.__repr__@  r-   r%   )
r|   r   r   r	   r   r   r
   r   r   r}   r2   r3   r<   s   @r#   rv   rv     sh     .2,0%)%) '
 5>>* ' %SM ' c] ' c] '  'D r%   rv   c                   h   ^  \ rS rSr  SS\\R                     S\\   4U 4S jjjrS r	S r
SrU =r$ )	ContextWindowExceededErroriJ  r   r   c                 H  > SU l         SR                  U5      U l        X l        X0l        XPl        [        R                  " SSS9n[        R                  " SUS9U l	        [        TU ]-  U R                  U R                  U R                  U R                  U R
                  S9  g )NrL   z&litellm.ContextWindowExceededError: {}rd   re   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r"   s          r#   r   #ContextWindowExceededError.__init__K  s     ?FFwO
("4--v3NO3HLL****]]#66 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   "ContextWindowExceededError.__str__b  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   #ContextWindowExceededError.__repr__j  r-   r%   r   r   r   r   r   r   NNr4   r5   r6   r7   r   r   r   r8   r   r+   r/   r:   r;   r<   s   @r#   r   r   J  sE     .2,0

 5>>*
 %SM
 
. r%   r   c                   L   ^  \ rS rSr SS\S\\   4U 4S jjjrS rS r	Sr
U =r$ )	RejectedRequestErrorit  request_datar   c                 6  > SU l         SR                  U5      U l        X l        X0l        XPl        X@l        [        R                  " SSS9n[        R                  " SUS9n[        TU ]-  U R                  U R                  U R                  UU R
                  S9  g )NrL   z litellm.RejectedRequestError: {}rd   re   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )	r!   r   r   r   r   r   r   r   r"   s	           r#   r   RejectedRequestError.__init__u  s     9@@I
("4(--v3NO>>c7CLL****#66 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   RejectedRequestError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   RejectedRequestError.__repr__  r-   r%   )r   r   r   r   r   r   N)r4   r5   r6   r7   rk   r   r8   r   r+   r/   r:   r;   r<   s   @r#   r   r   t  s9     -1

 
 %SM
 
0 r%   r   c                   h   ^  \ rS rSr  SS\\R                     S\\   4U 4S jjjrS r	S r
SrU =r$ )	ContentPolicyViolationErrori  r   r   c                 H  > SU l         SR                  U5      U l        X l        X0l        XPl        [        R                  " SSS9n[        R                  " SUS9U l	        [        TU ]-  U R                  U R                  U R                  U R                  U R
                  S9  g )NrL   z'litellm.ContentPolicyViolationError: {}rd   re   r   r   r   r   r   s          r#   r   $ContentPolicyViolationError.__init__  s     @GGP
("4--v3NO3HLL****]]#66 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   #ContentPolicyViolationError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   $ContentPolicyViolationError.__repr__  r-   r%   r   r   r   r<   s   @r#   r   r     sE     .2,0

 5>>*
 %SM
 
. r%   r   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )ServiceUnavailableErrori  r   r   r	   r
   c                 0  > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        [        R                  " U R                   [        R                  " SSS9S9U l        [        TU ]5  U R                  U R                  S S9  g )Ni  z#litellm.ServiceUnavailableError: {}rd   rx   r   r   r   r   r    s	           r#   r    ServiceUnavailableError.__init__  s     <CCGL(
"4&&((MM:
 	LL4==t 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   ServiceUnavailableError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/    ServiceUnavailableError.__repr__  r-   r%   r1   r2   r3   r<   s   @r#   r   r     g     .2,0%)%)

 5>>*
 %SM
 c]
 c]
 
8 r%   r   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )InternalServerErrori  r   r   r	   r
   c                 0  > SU l         SR                  U5      U l        X l        X0l        XPl        X`l        Xpl        [        R                  " U R                   [        R                  " SSS9S9U l        [        TU ]5  U R                  U R                  S S9  g )N  zlitellm.InternalServerError: {}rd   rx   r   r   r   r   r    s	           r#   r   InternalServerError.__init__  s     8??H(
"4&&((MM:
 	LL4==t 	 	
r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   InternalServerError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   InternalServerError.__repr__  r-   r%   r1   r2   r3   r<   s   @r#   r   r     r   r%   r   c                      ^  \ rS rSr    SS\S\\R                     S\\   S\\   S\\   4
U 4S jjjr	S r
S	 rS
rU =r$ )APIErrori%  r   r   r   r	   r
   c	                    > Xl         SR                  U5      U l        X0l        X@l        X`l        Xpl        Xl        Uc  [        R                  " SSS9n[        T	U ]-  U R                  US S9  g )Nzlitellm.APIError: {}rd   re   r   r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   
r!   r   r   r   r   r   r   r	   r
   r"   s
            r#   r   APIError.__init__&  sh     '-44W=(
"4&&?mm67RSGwTBr%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   APIError.__str__<  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   APIError.__repr__D  r-   r%   rR   r2   )r4   r5   r6   r7   r9   r   r   r   r8   r   r+   r/   r:   r;   r<   s   @r#   r   r   %  sv     ,0,0%)%)CC %--(C %SMC c]C c]C C, r%   r   c            
          ^  \ rS rSr    S
S\\R                     S\\   S\\   S\\   4U 4S jjjr	S r
S rS	rU =r$ )APIConnectionErroriN  r   r   r	   r
   c                    > SR                  U5      U l        X l        X0l        SU l        XPl        [        R                  " SSS9U l        X`l	        Xpl
        [        TU ]1  U R                  U R                  S9  g )Nzlitellm.APIConnectionError: {}r   rd   re   r   )r   r   )r   r   r   r   r   r   r   r   r   r	   r
   r   r   )	r!   r   r   r   r   r   r	   r
   r"   s	           r#   r   APIConnectionError.__init__O  si     8>>wG(
"4}}F8ST&&t||Dr%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   APIConnectionError.__str__c  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   APIConnectionError.__repr__k  r-   r%   )r   r   r	   r   r   r
   r   r   r2   )r4   r5   r6   r7   r   r   r   r8   r9   r   r+   r/   r:   r;   r<   s   @r#   r   r   N  sm     ,0,0%)%)E
 %--(E %SME c]E c]E E( r%   r   c                   `   ^  \ rS rSr   S	S\\   S\\   S\\   4U 4S jjjrS rS r	Sr
U =r$ )
APIResponseValidationErroriu  r   r	   r
   c                    > SR                  U5      U l        X l        X0l        [        R
                  " SSS9n[        R                  " SUS9nX@l        XPl        X`l	        [        T	U ]-  US US9  g )Nz&litellm.APIResponseValidationError: {}rd   re   r   r   r   )r   r   r   )r   r   r   r   r   r   r   r   r	   r
   r   r   )
r!   r   r   r   r   r	   r
   r   r   r"   s
            r#   r   #APIResponseValidationError.__init__v  sj     @FFwO(
--v3NO>>c7C"4&&(wGr%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r+   "APIResponseValidationError.__str__  r-   r%   c                     U R                   nU R                  (       a  USU R                   S3-  nU R                  (       a  USU R                   3-  nU$ r'   r(   r)   s     r#   r/   #APIResponseValidationError.__repr__  r-   r%   )r   r   r	   r   r   r
   r\   )r4   r5   r6   r7   r   r8   r9   r   r+   r/   r:   r;   r<   s   @r#   r   r   u  sV     -1%)%)H
 %SMH c]H c]H H& r%   r   c            
       @   ^  \ rS rSrS\S\S\S\SS4
U 4S jjrS	rU =r$ )
JSONSchemaValidationErrori  r   r   raw_responseschemareturnNc                 v   > X0l         X@l        Xl        SR                  XU5      nXPl        [
        TU ]  XUS9  g )Nzlitellm.JSONSchemaValidationError: model={}, returned an invalid response={}, for schema={}.
Access raw response with `e.raw_response`)r   r   r   )r   r   r   r   r   r   r   )r!   r   r   r   r   r   r"   s         r#   r   "JSONSchemaValidationError.__init__  sL     )
 \  c  c
 uLQr%   )r   r   r   r   )r4   r5   r6   r7   r8   r   r:   r;   r<   s   @r#   r   r     s<    
R
R(+
R;>
RHK
R	
R 
Rr%   r   c                   ,   ^  \ rS rSrSU 4S jjrSrU =r$ )OpenAIErrori  c                 0   > [         TU ]  5         SU l        g )Nopenai)r   r   r   )r!   original_exceptionr"   s     r#   r   OpenAIError.__init__  s    $r%   )r   r   r4   r5   r6   r7   r   r:   r;   r<   s   @r#   r   r     s    % %r%   r   c                       \ rS rSr       SS\\   S\\   S\S\\R                     S\\   S\\   S	\\   4S
 jjr	Sr
g)UnsupportedParamsErrori  Nr   r   r   r   r   r	   r
   c	                     SU l         SR                  U5      U l        X0l        X l        X`l        U=(       d2    [        R                  " U R                   [        R                  " SSS9S9nXpl	        Xl
        g )NrL   z"litellm.UnsupportedParamsError: {}r   r   r   r   )r   r   r   r   r   r   r   r   r   r	   r
   )	r!   r   r   r   r   r   r   r	   r
   s	            r#   r   UnsupportedParamsError.__init__  sm     ;BB7K
("4 
u~~((MM"6 
 '&r%   rR   )NNrL   NNNN)r4   r5   r6   r7   r   r8   r9   r   r   r   r:    r%   r#   r   r     s     '+#-1,0%)%)' sm' }	'
 ' 5>>*' %SM' c]' c]' 'r%   r   c                   D   ^  \ rS rSr SS\S\S\\   4U 4S jjjrSrU =r	$ )BudgetExceededErrori  current_cost
max_budgetr   c                 j   > Xl         X l        U=(       d    SU SU 3nX0l        [        TU ]  U5        g )Nz(Budget has been exceeded! Current cost: z, Max budget: )r   r   r   r   r   )r!   r   r   r   r"   s       r#   r   BudgetExceededError.__init__  sD     )$ c9,~V`Uab 	 !r%   )r   r   r   r   )
r4   r5   r6   r7   floatr   r8   r   r:   r;   r<   s   @r#   r   r     s,    OS
"!
"/4
"?G}
" 
"r%   r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )InvalidRequestErrori  c                    > SU l         Xl        X l        X0l        [        R
                  " S[        R                  " SSS9S9U l        [        TU ]%  U R                  U R                  S S9  g )NrL   r   r   r   r   )r   r   r   )
r   r   r   r   r   r   r   r   r   r   )r!   r   r   r   r"   s       r#   r   InvalidRequestError.__init__  sc    
(MM"6
 	LL4==t 	 	
r%   )r   r   r   r   r   r   r<   s   @r#   r   r     s    
 
r%   r   c                   x   ^  \ rS rSr    S	S\S\\R                     S\\   S\\   S\\   4
U 4S jjjr	Sr
U =r$ )
MockExceptioni   r   r   r   r	   r
   c	                    > Xl         SR                  U5      U l        X0l        X@l        X`l        Xpl        Xl        Uc  [        R                  " SSS9n[        T	U ]-  U R                  US S9  g )Nzlitellm.MockException: {}rd   re   r   r   r   r   s
            r#   r   MockException.__init__  sh     '299'B(
"4&&?mm67RSGwTBr%   rR   r2   )r4   r5   r6   r7   r9   r   r   r   r8   r   r:   r;   r<   s   @r#   r   r      sg     ,0,0%)%)CC %--(C %SMC c]C c]C Cr%   r   )typingr   r   r   r   r?   rI   rT   APITimeoutErrorr`   rm   rv   r   r   r   APIStatusErrorr   r   r   r   r   r   r   r   LITELLM_EXCEPTION_TYPES	Exceptionr   r   r   r   r%   r#   <module>r      s     *&44 *\*F(( *Z*f,, *Z$v>> $N*f$$ *Z$F88 $N1V** 1j& &T'? 'T'/ 'T+f33 +\+&44 +^%v %R#22 #N"!B!B "JR : R%&$$ %'_ '8 ' .") "
&00 
"CFOO Cr%   