
    U th                    J   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 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#dS ),    )annotations)TYPE_CHECKINGAnyOptionalcast)LiteralN   )is_dict)construct_type)ChatCompletion)BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorLengthFinishReasonErrorContentFilterFinishReasonErrorInvalidWebhookSignatureErrorc                      e Zd ZdS )OpenAIErrorN__name__
__module____qualname__     f/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/openai/_exceptions.pyr   r              Dr   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 )APIErrorstrmessagehttpx.Requestrequestobject | NonebodyNzOptional[str]codeparamtypereturnNonec          	     r   t                                          |           || _        || _        || _        t          |          rt          t          t          t          t                   |                    d                              | _        t          t          t          t          t                   |                    d                              | _        t          t          t          t          |                    d                              | _        d S d | _        d | _        d | _        d S )Nr*   )type_valuer+   r,   )super__init__r'   r%   r)   r
   r   r   r   r   r$   getr*   r+   r,   )selfr%   r'   r)   	__class__s       r    r3   zAPIError.__init__6   s    !!!	4== 	S.x}DHHU[L\L\"]"]"]^^DIc>TXXV]M^M^#_#_#_``DJS.s$((6BRBR"S"S"STTDIIIDIDJDIIIr   )r%   r$   r'   r&   r)   r(   r-   r.   )r   r   r   __annotations__r*   r+   r3   __classcell__r6   s   @r    r#   r#   #   s         LLL DE         r   r#   c                  <     e Zd ZU ded<   ded<   ddd fdZ xZS )APIResponseValidationErrorhttpx.Responseresponseintstatus_codeNr%   r)   r(   r%   
str | Noner-   r.   c                   t                                          |pd|j        |           || _        |j        | _        d S )Nz1Data returned by API invalid for expected schema.r)   )r2   r3   r'   r=   r?   )r5   r=   r)   r%   r6   s       r    r3   z#APIResponseValidationError.__init__J   sE    W$WYaYiptuuu #/r   )r=   r<   r)   r(   r%   rA   r-   r.   r   r   r   r7   r3   r8   r9   s   @r    r;   r;   F   sd         _c 0 0 0 0 0 0 0 0 0 0 0 0r   r;   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.r<   r=   r>   r?   rA   
request_idr%   r$   r)   r(   r-   r.   c                   t                                          ||j        |           || _        |j        | _        |j                            d          | _        d S )NrC   zx-request-id)r2   r3   r'   r=   r?   headersr4   rG   )r5   r%   r=   r)   r6   s       r    r3   zAPIStatusError.__init__W   sS    ("2>>> #/"*..~>>r   )r%   r$   r=   r<   r)   r(   r-   r.   )r   r   r   __doc__r7   r3   r8   r9   s   @r    rF   rF   P   si         FF? ? ? ? ? ? ? ? ? ?r   rF   c                  &     e Zd Zddd
 fd	Z xZS )APIConnectionErrorzConnection error.r@   r%   r$   r'   r&   r-   r.   c               P    t                                          ||d            d S )NrC   r2   r3   )r5   r%   r'   r6   s      r    r3   zAPIConnectionError.__init___   s(    '55555r   )r%   r$   r'   r&   r-   r.   r   r   r   r3   r8   r9   s   @r    rL   rL   ^   sJ        )< 6 6 6 6 6 6 6 6 6 6 6 6r   rL   c                        e Zd Zd fdZ xZS )APITimeoutErrorr'   r&   r-   r.   c                N    t                                          d|           d S )NzRequest timed out.)r%   r'   rN   )r5   r'   r6   s     r    r3   zAPITimeoutError.__init__d   s'    !5wGGGGGr   )r'   r&   r-   r.   rO   r9   s   @r    rQ   rQ   c   sG        H H H H H H H H H Hr   rQ   c                      e Zd ZU dZded<   dS )r   i  zLiteral[400]r?   Nr   r   r   r?   r7   r   r   r    r   r   h   #          #K######r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[401]r?   NrT   r   r   r    r   r   l   rU   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[403]r?   NrT   r   r   r    r   r   p   rU   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[404]r?   NrT   r   r   r    r   r   t   rU   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[409]r?   NrT   r   r   r    r   r   x   rU   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[422]r?   NrT   r   r   r    r   r   |   rU   r   r   c                      e Zd ZU dZded<   dS )r   i  zLiteral[429]r?   NrT   r   r   r    r   r      rU   r   r   c                      e Zd ZdS )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   
completionr-   r.   c                   d}|j         r|d|j          z  }t                                          |           || _        d S )Nz@Could not parse response content as the length limit was reachedz - )usager2   r3   r^   )r5   r^   msgr6   s      r    r3   z LengthFinishReasonError.__init__   sL    P 	,+)+++C$r   )r^   r   r-   r.   rD   r9   s   @r    r   r      sP         % % % % % % % % % %r   r   c                        e Zd Zd fdZ xZS )r   r-   r.   c                J    t                                          d           d S )NzRCould not parse response content as the request was rejected by the content filterrN   )r5   r6   s    r    r3   z'ContentFilterFinishReasonError.__init__   s,    a	
 	
 	
 	
 	
r   )r-   r.   rO   r9   s   @r    r   r      s=        
 
 
 
 
 
 
 
 
 
r   r   c                      e Zd ZdZdS )r   zqRaised when a webhook signature is invalid, meaning the computed signature does not match the expected signature.N)r   r   r   rJ   r   r   r    r   r      s        {{{{r   r   )$
__future__r   typingr   r   r   r   typing_extensionsr   httpx_utilsr
   _modelsr   
types.chatr   __all__	Exceptionr   r#   r;   rF   rL   rQ   r   r   r   r   r   r   r   r   r   r   
ValueErrorr   r   r   r    <module>ro      s   # " " " " " 5 5 5 5 5 5 5 5 5 5 5 5 % % % % % %        # # # # # # +******  	 	 	 	 	) 	 	 	         {      F0 0 0 0 0 0 0 0? ? ? ? ?X ? ? ?6 6 6 6 6 6 6 6
H H H H H( H H H
$ $ $ $ $n $ $ $$ $ $ $ $. $ $ $$ $ $ $ $N $ $ $$ $ $ $ $N $ $ $$ $ $ $ $N $ $ $$ $ $ $ $~ $ $ $$ $ $ $ $^ $ $ $	 	 	 	 	. 	 	 	% % % % %k % % %"
 
 
 
 
[ 
 
 
| | | | |: | | | | |r   