forked from phoenix/litellm-mirror
fix(utils.py): adding support for rules + mythomax/alpaca prompt template
This commit is contained in:
parent
4f46ac4ab5
commit
855964ed45
7 changed files with 186 additions and 8 deletions
|
@ -18,6 +18,7 @@ from openai import (
|
|||
APIError,
|
||||
APITimeoutError,
|
||||
APIConnectionError,
|
||||
APIResponseValidationError
|
||||
)
|
||||
import httpx
|
||||
|
||||
|
@ -119,6 +120,22 @@ class APIConnectionError(APIConnectionError): # type: ignore
|
|||
request=request
|
||||
)
|
||||
|
||||
# raised if an invalid request (not get, delete, put, post) is made
|
||||
class APIResponseValidationError(APIResponseValidationError): # type: ignore
|
||||
def __init__(self, message, llm_provider, model):
|
||||
self.message = message
|
||||
self.llm_provider = llm_provider
|
||||
self.model = model
|
||||
request = httpx.Request(method="POST", url="https://api.openai.com/v1")
|
||||
response = httpx.Response(status_code=500, request=request)
|
||||
super().__init__(
|
||||
response=response,
|
||||
body=None,
|
||||
message=message
|
||||
)
|
||||
|
||||
|
||||
|
||||
class OpenAIError(OpenAIError): # type: ignore
|
||||
def __init__(self, original_exception):
|
||||
self.status_code = original_exception.http_status
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue