From 6d1981fbaa8891fcc68eb42aa0fae0ace9571d7c Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 4 May 2024 16:59:14 -0700 Subject: [PATCH] init router retry policy --- litellm/types/router.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/litellm/types/router.py b/litellm/types/router.py index 068a99b005..1f5fb7103f 100644 --- a/litellm/types/router.py +++ b/litellm/types/router.py @@ -266,3 +266,18 @@ class RouterErrors(enum.Enum): user_defined_ratelimit_error = "Deployment over user-defined ratelimit." no_deployments_available = "No deployments available for selected model" + + +class RetryPolicy(BaseModel): + """ + Use this to set a custom number of retries per exception type + If RateLimitErrorRetries = 3, then 3 retries will be made for RateLimitError + Mapping of Exception type to number of retries + https://docs.litellm.ai/docs/exception_mapping + """ + + BadRequestErrorRetries: Optional[int] = None + AuthenticationErrorRetries: Optional[int] = None + TimeoutErrorRetries: Optional[int] = None + RateLimitErrorRetries: Optional[int] = None + ContentPolicyViolationErrorRetries: Optional[int] = None