
    j>                    F   d dl mZ d dlmZmZmZmZ d dlmZ d dl	Z	ddl
mZ ddlmZ ddlmZ erdd	lmZ g d
Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z  G d% d&e      Z! G d' d(e      Z" G d) d*e      Z# G d+ d,e      Z$ G d- d.e      Z% G d/ d0e&      Z' G d1 d2e      Z( G d3 d4e      Z)y)5    )annotations)TYPE_CHECKINGAnyOptionalcast)LiteralN   )is_dict)construct_type)OAuthErrorCode)ChatCompletion)BadRequestErrorAuthenticationError
OAuthErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorLengthFinishReasonErrorContentFilterFinishReasonErrorInvalidWebhookSignatureErrorSubjectTokenProviderErrorWebSocketConnectionClosedErrorWebSocketQueueFullErrorc                      e Zd Zy)OpenAIErrorN__name__
__module____qualname__     q/var/www/internaltesting/Shamanth/prverification/HIS_auto/venv/lib/python3.12/site-packages/openai/_exceptions.pyr   r   $       r$   r   c                  2     e Zd ZU ded<   ddd fdZ xZS )r   httpx.Response | NoneresponseN)r)   c               2    t         |   |       || _        y N)super__init__r)   )selfmessager)   	__class__s      r%   r-   z"SubjectTokenProviderError.__init__+   s    ! r$   )r/   strr)   r(   returnNoner    r!   r"   __annotations__r-   __classcell__r0   s   @r%   r   r   (   s    ##JN ! !r$   r   c                  h     e Zd ZU ded<   ded<   ded<   	 dZded	<   dZded
<   ded<   d fdZ xZS )APIErrorr1   r/   httpx.Requestrequestobject | NonebodyNzOptional[str]codeparamtypec          	        t         |   |       || _        || _        || _        t        |      rt        t        t        t        t           |j                  d                  | _        t        t        t        t        t           |j                  d                  | _        t        t        t        t        |j                  d                  | _        y d | _        d | _        d | _        y )Nr>   )type_valuer?   r@   )r,   r-   r;   r/   r=   r
   r   r   r   r   r1   getr>   r?   r@   )r.   r/   r;   r=   r0   s       r%   r-   zAPIError.__init__C   s    !	4=S.x}DHHU[L\"]^DIc>TXXV]M^#_`DJS.s$((6BR"STDIDIDJDIr$   )r/   r1   r;   r:   r=   r<   r2   r3   )r    r!   r"   r5   r>   r?   r-   r6   r7   s   @r%   r9   r9   0   s?    L
 D-E=
 r$   r9   c                  <     e Zd ZU ded<   ded<   ddd fdZ xZS )	APIResponseValidationErrorhttpx.Responser)   intstatus_codeNr/   c               v    t         |   |xs d|j                  |       || _        |j                  | _        y )Nz1Data returned by API invalid for expected schema.r=   )r,   r-   r;   r)   rI   )r.   r)   r=   r/   r0   s       r%   r-   z#APIResponseValidationError.__init__W   s:    W$WYaYiYiptu #//r$   )r)   rG   r=   r<   r/   
str | Noner2   r3   r4   r7   s   @r%   rF   rF   S   s    _c 0 0r$   rF   c                  D     e Zd ZU dZded<   ded<   ded<   d	 fdZ xZS )
APIStatusErrorz<Raised when an API response has a status code of 4xx or 5xx.rG   r)   rH   rI   rM   
request_idc                   t         |   ||j                  |       || _        |j                  | _        |j
                  j                  d      | _        y )NrL   zx-request-id)r,   r-   r;   r)   rI   headersrD   rP   )r.   r/   r)   r=   r0   s       r%   r-   zAPIStatusError.__init__d   sJ    ("2"2> #//"**..~>r$   )r/   r1   r)   rG   r=   r<   r2   r3   r    r!   r"   __doc__r5   r-   r6   r7   s   @r%   rO   rO   ]   s"    F? ?r$   rO   c                  &     e Zd Zddd fdZ xZS )APIConnectionErrorzConnection error.rJ   c               *    t         |   ||d        y )NrL   r,   r-   )r.   r/   r;   r0   s      r%   r-   zAPIConnectionError.__init__l   s    '5r$   )r/   r1   r;   r:   r2   r3   r    r!   r"   r-   r6   r7   s   @r%   rV   rV   k   s    )< 6 6r$   rV   c                        e Zd Zd fdZ xZS )APITimeoutErrorc                (    t         |   d|       y )NzRequest timed out.)r/   r;   rX   )r.   r;   r0   s     r%   r-   zAPITimeoutError.__init__q   s    !5wGr$   )r;   r:   r2   r3   rY   r7   s   @r%   r[   r[   p   s    H Hr$   r[   c                      e Zd ZU dZded<   y)r   i  zLiteral[400]rI   Nr    r!   r"   rI   r5   r#   r$   r%   r   r   u        #K#r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[401]rI   Nr^   r#   r$   r%   r   r   y   r_   r$   r   c                  ,     e Zd ZU ded<   d fdZ xZS )r   zOptional[OAuthErrorCode]errorc                   d}d }t        |      r6|j                  d      }|j                  d      }|rt        |t              r|}t        |   |||       t        t        t           |      | _	        y )NzOAuth authentication error.rb   error_description)r)   r=   )
r
   rD   
isinstancer1   r,   r-   r   r   r   rb   )r.   r)   r=   r/   rb   descriptionr0   s         r%   r-   zOAuthError.__init__   si    /4=HHW%E((#67Kz+s;%8$?(>2E:
r$   )r)   rG   r=   r<   r2   r3   r4   r7   s   @r%   r   r   }   s    ##; ;r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[403]rI   Nr^   r#   r$   r%   r   r      r_   r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[404]rI   Nr^   r#   r$   r%   r   r      r_   r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[409]rI   Nr^   r#   r$   r%   r   r      r_   r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[422]rI   Nr^   r#   r$   r%   r   r      r_   r$   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[429]rI   Nr^   r#   r$   r%   r   r      r_   r$   r   c                      e Zd Zy)r   Nr   r#   r$   r%   r   r      r&   r$   r   c                  .     e Zd ZU ded<   	 d fdZ xZS )r   r   
completionc               r    d}|j                   r|d|j                    z  }t        | 	  |       || _        y )Nz@Could not parse response content as the length limit was reachedz - )usager,   r-   rn   )r.   rn   msgr0   s      r%   r-   z LengthFinishReasonError.__init__   s=    PS))*++C$r$   )rn   r   r2   r3   r4   r7   s   @r%   r   r      s    % %r$   r   c                        e Zd Zd fdZ xZS )r   c                $    t         |   d       y )NzRCould not parse response content as the request was rejected by the content filterrX   )r.   r0   s    r%   r-   z'ContentFilterFinishReasonError.__init__   s    `	
r$   )r2   r3   rY   r7   s   @r%   r   r      s    
 
r$   r   c                      e Zd ZdZy)r   zqRaised when a webhook signature is invalid, meaning the computed signature does not match the expected signature.Nr    r!   r"   rT   r#   r$   r%   r   r      s    {r$   r   c                  0     e Zd ZU dZded<   d fdZ xZS )r   z?Raised when a WebSocket connection closes with unsent messages.	list[str]unsent_messagesc               2    t         |   |       || _        y r+   )r,   r-   rx   )r.   r/   rx   r0   s      r%   r-   z'WebSocketConnectionClosedError.__init__   s    !.r$   )r/   r1   rx   rw   r2   r3   rS   r7   s   @r%   r   r      s    I/ /r$   r   c                      e Zd ZdZy)r   zMRaised when the outgoing WebSocket message queue exceeds its byte-size limit.Nru   r#   r$   r%   r   r      s    Wr$   r   )*
__future__r   typingr   r   r   r   typing_extensionsr   httpx_utilsr
   _modelsr   types.shared.oauth_error_coder   
types.chatr   __all__	Exceptionr   r   r9   rF   rO   rV   r[   r   r   r   r   r   r   r   r   r   r   r   
ValueErrorr   r   r   r#   r$   r%   <module>r      s/   # 5 5 %   # 9*&	) 	! ! {  F0 0?X ?6 6
H( H
$n $$. $;$ ;"$N $$N $$N $$~ $$^ $	. 	%k %"
[ 
|: |/[ /	k 	r$   