
    f                       d dl mZ d dl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 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y))    )annotations)AnyOptionalcast)LiteralN   )is_dict)construct_type)
BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorLengthFinishReasonErrorContentFilterFinishReasonErrorc                      e Zd Zy)OpenAIErrorN__name__
__module____qualname__     Q/opt/lhia/ganansol/python/venv/lib/python3.12/site-packages/openai/_exceptions.pyr   r          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 )APIErrorstrmessage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)   )super__init__r$   r"   r&   r	   r   r   r
   r   r!   getr'   r(   r)   )selfr"   r$   r&   	__class__s       r   r.   zAPIError.__init__2   s    !	4=S.x}DHHU[L\"]^DIc>TXXV]M^#_`DJS.s$((6BR"STDIDIDJDIr   )r"   r!   r$   r#   r&   r%   returnNone)r   r   r   __annotations__r'   r(   r.   __classcell__r1   s   @r   r    r       s?    L
 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"   c               v    t         |   |xs d|j                  |       || _        |j                  | _        y )Nz1Data returned by API invalid for expected schema.r&   )r-   r.   r$   r:   r<   )r0   r:   r&   r"   r1   s       r   r.   z#APIResponseValidationError.__init__F   s:    W$WYaYiYiptu #//r   )r:   r9   r&   r%   r"   
str | Noner2   r3   )r   r   r   r4   r.   r5   r6   s   @r   r8   r8   B   s    _c 0 0r   r8   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.r9   r:   r;   r<   r@   
request_idc                   t         |   ||j                  |       || _        |j                  | _        |j
                  j                  d      | _        y )Nr?   zx-request-id)r-   r.   r$   r:   r<   headersr/   rC   )r0   r"   r:   r&   r1   s       r   r.   zAPIStatusError.__init__S   sJ    ("2"2> #//"**..~>r   )r"   r!   r:   r9   r&   r%   r2   r3   )r   r   r   __doc__r4   r.   r5   r6   s   @r   rB   rB   L   s"    F? ?r   rB   c                  &     e Zd Zddd fdZ xZS )APIConnectionErrorzConnection error.r=   c               *    t         |   ||d        y )Nr?   r-   r.   )r0   r"   r$   r1   s      r   r.   zAPIConnectionError.__init__[   s    '5r   )r"   r!   r$   r#   r2   r3   r   r   r   r.   r5   r6   s   @r   rH   rH   Z   s    )< 6 6r   rH   c                        e Zd Zd fdZ xZS )APITimeoutErrorc                (    t         |   d|       y )NzRequest timed out.)r"   r$   rJ   )r0   r$   r1   s     r   r.   zAPITimeoutError.__init__`   s    !5wGr   )r$   r#   r2   r3   rK   r6   s   @r   rM   rM   _   s    H Hr   rM   c                      e Zd ZU dZded<   y)r   i  zLiteral[400]r<   Nr   r   r   r<   r4   r   r   r   r   r   d        #K#r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[401]r<   NrP   r   r   r   r   r   h   rQ   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[403]r<   NrP   r   r   r   r   r   l   rQ   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[404]r<   NrP   r   r   r   r   r   p   rQ   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[409]r<   NrP   r   r   r   r   r   t   rQ   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[422]r<   NrP   r   r   r   r   r   x   rQ   r   r   c                      e Zd ZU dZded<   y)r   i  zLiteral[429]r<   NrP   r   r   r   r   r   |   rQ   r   r   c                      e Zd Zy)r   Nr   r   r   r   r   r      r   r   r   c                        e Zd Zd fdZ xZS )r   c                $    t         |   d       y )Nz@Could not parse response content as the length limit was reachedrJ   r0   r1   s    r   r.   z LengthFinishReasonError.__init__   s    N	
r   r2   r3   rK   r6   s   @r   r   r          
 
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 filterrJ   r[   s    r   r.   z'ContentFilterFinishReasonError.__init__   s    `	
r   r\   rK   r6   s   @r   r   r      r]   r   r   )
__future__r   typingr   r   r   typing_extensionsr   httpx_utilsr	   _modelsr
   __all__	Exceptionr   r    r8   rB   rH   rM   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>rh      s    # & & %   #	) 	 {  F0 0?X ?6 6
H( H
$n $$. $$N $$N $$N $$~ $$^ $	. 	
k 

[ 
r   