docs(routing.md): add dynamic cooldowns to docs

This commit is contained in:
Krrish Dholakia
2024-06-25 17:01:58 -07:00
parent d98e00d1e0
commit 8fbc34e7e9
2 changed files with 35 additions and 1 deletions
@@ -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)
+34 -1
View File
@@ -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.
<Tabs>
<TabItem value="sdk" label="SDK">
```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}")
```
</TabItem>
<TabItem value="proxy" label="PROXY">
**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
```
</TabItem>
</Tabs>
### Retries
For both async + sync functions, we support retrying failed requests.