feat - set custom AllowedFailsPolicy

This commit is contained in:
Ishaan Jaff 2024-06-01 17:26:21 -07:00
parent 3b94993ddc
commit eb203c051a
2 changed files with 77 additions and 3 deletions

View file

@ -76,7 +76,9 @@ class ModelInfo(BaseModel):
id: Optional[
str
] # Allow id to be optional on input, but it will always be present as a str in the model instance
db_model: bool = False # used for proxy - to separate models which are stored in the db vs. config.
db_model: bool = (
False # used for proxy - to separate models which are stored in the db vs. config.
)
updated_at: Optional[datetime.datetime] = None
updated_by: Optional[str] = None
@ -381,6 +383,23 @@ class RouterErrors(enum.Enum):
no_deployments_available = "No deployments available for selected model"
class AllowedFailsPolicy(BaseModel):
"""
Use this to set a custom number of allowed_fails for each exception type before cooling down a deployment
If RateLimitErrorRetries = 3, then 3 retries will be made for RateLimitError
Mapping of Exception type to allowed_fails for each exception
https://docs.litellm.ai/docs/exception_mapping
"""
BadRequestErrorAllowedFails: Optional[int] = None
AuthenticationErrorAllowedFails: Optional[int] = None
TimeoutErrorAllowedFails: Optional[int] = None
RateLimitErrorAllowedFails: Optional[int] = None
ContentPolicyViolationErrorAllowedFails: Optional[int] = None
InternalServerErrorAllowedFails: Optional[int] = None
class RetryPolicy(BaseModel):
"""
Use this to set a custom number of retries per exception type