mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
add EvalFailedError exception with status_code 422
This commit is contained in:
parent
d33e2206ad
commit
9cf52d8006
1 changed files with 20 additions and 1 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
## LiteLLM versions of the OpenAI Exception Types
|
||||
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
import httpx
|
||||
import openai
|
||||
|
|
@ -502,6 +502,25 @@ class ContentPolicyViolationError(BadRequestError): # type: ignore
|
|||
return _message
|
||||
|
||||
|
||||
class EvalFailedError(Exception):
|
||||
"""Raised when an LLM-judge eval fails to meet the acceptance threshold."""
|
||||
|
||||
status_code: int = 422
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
eval_result: Any,
|
||||
model: str = "",
|
||||
llm_provider: str = "",
|
||||
):
|
||||
self.eval_result = eval_result
|
||||
self.model = model
|
||||
self.llm_provider = llm_provider
|
||||
self.status_code = 422
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class ServiceUnavailableError(openai.APIStatusError): # type: ignore
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue