From 8fbc34e7e9e1e2f8d05eafb278f39eadfd0cf866 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 25 Jun 2024 17:01:58 -0700 Subject: [PATCH] docs(routing.md): add dynamic cooldowns to docs --- docs/my-website/docs/proxy/reliability.md | 1 + docs/my-website/docs/routing.md | 35 ++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/my-website/docs/proxy/reliability.md b/docs/my-website/docs/proxy/reliability.md index c07fc3c26a..9228071b0d 100644 --- a/docs/my-website/docs/proxy/reliability.md +++ b/docs/my-website/docs/proxy/reliability.md @@ -272,6 +272,7 @@ litellm_settings: fallbacks: [{"zephyr-beta": ["gpt-3.5-turbo"]}] # fallback to gpt-3.5-turbo if call fails num_retries context_window_fallbacks: [{"zephyr-beta": ["gpt-3.5-turbo-16k"]}, {"gpt-3.5-turbo": ["gpt-3.5-turbo-16k"]}] # fallback to gpt-3.5-turbo-16k if context window error allowed_fails: 3 # cooldown model if it fails > 1 call in a minute. + cooldown_time: 30 # how long to cooldown model if fails/min > allowed_fails ``` ### Context Window Fallbacks (Pre-Call Checks + Fallbacks) diff --git a/docs/my-website/docs/routing.md b/docs/my-website/docs/routing.md index de0a4a7965..240e6c8e04 100644 --- a/docs/my-website/docs/routing.md +++ b/docs/my-website/docs/routing.md @@ -762,6 +762,9 @@ asyncio.run(router_acompletion()) Set the limit for how many calls a model is allowed to fail in a minute, before being cooled down for a minute. + + + ```python from litellm import Router @@ -779,9 +782,39 @@ messages = [{"content": user_message, "role": "user"}] response = router.completion(model="gpt-3.5-turbo", messages=messages) print(f"response: {response}") - ``` + + + +**Set Global Value** + +```yaml +router_settings: + allowed_fails: 3 # cooldown model if it fails > 1 call in a minute. + cooldown_time: 30 # (in seconds) how long to cooldown model if fails/min > allowed_fails +``` + +Defaults: +- allowed_fails: 0 +- cooldown_time: 60s + +**Set Per Model** + +```yaml +model_list: +- model_name: fake-openai-endpoint + litellm_params: + model: predibase/llama-3-8b-instruct + api_key: os.environ/PREDIBASE_API_KEY + tenant_id: os.environ/PREDIBASE_TENANT_ID + max_new_tokens: 256 + cooldown_time: 0 # 👈 KEY CHANGE +``` + + + + ### Retries For both async + sync functions, we support retrying failed requests.