mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-25 13:58:56 +01:00
3e7feb699c
* many openai updates * total reorg & cleanup. * fixups * missing import os for images * +moderations, custom_stopping_strings, more fixes * fix bugs in completion streaming * moderation fix (flagged) * updated moderation categories --------- Co-authored-by: Matthew Ashton <mashton-gitlab@zhero.org>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
class OpenAIError(Exception):
|
|
def __init__(self, message = None, code = 500, internal_message = ''):
|
|
self.message = message
|
|
self.code = code
|
|
self.internal_message = internal_message
|
|
def __repr__(self):
|
|
return "%s(message=%r, code=%d)" % (
|
|
self.__class__.__name__,
|
|
self.message,
|
|
self.code,
|
|
)
|
|
|
|
class InvalidRequestError(OpenAIError):
|
|
def __init__(self, message, param, code = 400, error_type ='InvalidRequestError', internal_message = ''):
|
|
super(OpenAIError, self).__init__(message, code, error_type, internal_message)
|
|
self.param = param
|
|
def __repr__(self):
|
|
return "%s(message=%r, code=%d, param=%s)" % (
|
|
self.__class__.__name__,
|
|
self.message,
|
|
self.code,
|
|
self.param,
|
|
)
|
|
|
|
class ServiceUnavailableError(OpenAIError):
|
|
def __init__(self, message = None, code = 500, error_type ='ServiceUnavailableError', internal_message = ''):
|
|
super(OpenAIError, self).__init__(message, code, error_type, internal_message)
|