(fix) add timeout to __init__ litellm

This commit is contained in:
ishaan-jaff 2023-11-27 07:49:18 -08:00
parent f6d40c2241
commit e9947be7b2

View file

@ -62,11 +62,11 @@ allowed_fails: int = 0
def get_model_cost_map(url: str):
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception if request is unsuccessful
content = response.json()
return content
except:
with requests.get(url, timeout=5) as response: # set a 5 second timeout for the get request
response.raise_for_status() # Raise an exception if the request is unsuccessful
content = response.json()
return content
except Exception as e:
import importlib.resources
import json
with importlib.resources.open_text("litellm", "model_prices_and_context_window_backup.json") as f: