HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/openai/__pycache__/_exceptions.cpython-310.pyc
o

���g��@slddlmZddlmZmZmZmZddlmZddl	Z	ddl
mZddlm
Z
er0ddlmZgd	�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�Z Gd(d)�d)e�Z!dS)*�)�annotations)�
TYPE_CHECKING�Any�Optional�cast)�LiteralN�)�is_dict)�construct_type)�ChatCompletion)
�BadRequestError�AuthenticationError�PermissionDeniedError�
NotFoundError�
ConflictError�UnprocessableEntityError�RateLimitError�InternalServerError�LengthFinishReasonError�ContentFilterFinishReasonErrorc@�eZdZdS)�OpenAIErrorN��__name__�
__module__�__qualname__�rr�=/usr/local/lib/python3.10/dist-packages/openai/_exceptions.pyr�rcsZeZdZUded<ded<ded<	dZded	<dZded
<ded<d�fdd�Z�ZS)�APIError�str�message�
httpx.Request�request�
object | None�bodyNz
Optional[str]�code�param�type�return�Nonecs�t��|�||_||_||_t|�r@tttt	t
|�d�d��|_tttt	t
|�d�d��|_
tttt
|�d�d��|_dSd|_d|_
d|_dS)Nr&)�type_�valuer'r()�super�__init__r#r!r%r	rrr
rr �getr&r'r()�selfr!r#r%��	__class__rrr.5s
zAPIError.__init__)r!r r#r"r%r$r)r*)rrr�__annotations__r&r'r.�
__classcell__rrr1rr"s

rcs6eZdZUded<ded<dd�d�fd
d�Z�ZS)�APIResponseValidationError�httpx.Response�response�int�status_codeN�r!r%r$r!�
str | Noner)r*cs*t�j|pd|j|d�||_|j|_dS)Nz1Data returned by API invalid for expected schema.�r%)r-r.r#r7r9)r0r7r%r!r1rrr.Isz#APIResponseValidationError.__init__)r7r6r%r$r!r;r)r*�rrrr3r.r4rrr1rr5Es
r5cs<eZdZUdZded<ded<ded<d�fdd�Z�ZS)�APIStatusErrorz<Raised when an API response has a status code of 4xx or 5xx.r6r7r8r9r;�
request_idr!r r%r$r)r*cs4t�j||j|d�||_|j|_|j�d�|_dS)Nr<zx-request-id)r-r.r#r7r9�headersr/r?)r0r!r7r%r1rrr.VszAPIStatusError.__init__)r!r r7r6r%r$r)r*)rrr�__doc__r3r.r4rrr1rr>Os
r>cs$eZdZdd�d�fd	d
�Z�ZS)�APIConnectionErrorzConnection error.r:r!r r#r"r)r*cst�j||dd�dS)Nr<�r-r.)r0r!r#r1rrr.^szAPIConnectionError.__init__)r!r r#r"r)r*�rrrr.r4rrr1rrB]srBcseZdZd�fdd�Z�ZS)�APITimeoutErrorr#r"r)r*cst�jd|d�dS)NzRequest timed out.)r!r#rC)r0r#r1rrr.cszAPITimeoutError.__init__)r#r"r)r*rDrrr1rrEb�rEc@�eZdZUdZded<dS)ri�zLiteral[400]r9N�rrrr9r3rrrrrg�
rc@rG)r
i�zLiteral[401]r9NrHrrrrr
krIr
c@rG)ri�zLiteral[403]r9NrHrrrrrorIrc@rG)ri�zLiteral[404]r9NrHrrrrrsrIrc@rG)ri�zLiteral[409]r9NrHrrrrrwrIrc@rG)ri�zLiteral[422]r9NrHrrrrr{rIrc@rG)ri�zLiteral[429]r9NrHrrrrrrIrc@r)rNrrrrrr�rrcs*eZdZUded<	d�fdd�Z�ZS)rr�
completionr)r*cs0d}|jr
|d|j��7}t��|�||_dS)Nz@Could not parse response content as the length limit was reachedz - )�usager-r.rJ)r0rJ�msgr1rrr.�s

z LengthFinishReasonError.__init__)rJrr)r*r=rrr1rr�s
rcseZdZd�fdd�Z�ZS)rr)r*cst��d�dS)NzRCould not parse response content as the request was rejected by the content filterrC)r0r1rrr.�s�z'ContentFilterFinishReasonError.__init__)r)r*rDrrr1rr�rFr)"�
__future__r�typingrrrr�typing_extensionsr�httpx�_utilsr	�_modelsr
�
types.chatr�__all__�	Exceptionrrr5r>rBrErr
rrrrrrrrrrrr�<module>s2#