mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
(fix) add timeout to __init__ litellm
This commit is contained in:
parent
f6d40c2241
commit
e9947be7b2
1 changed files with 5 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue