mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
cache the model list response
This commit is contained in:
parent
4b34eb1414
commit
c8130f9fe0
4 changed files with 7 additions and 3 deletions
|
@ -1019,10 +1019,11 @@ def get_model_list():
|
|||
if time_delta > 300 or last_fetched_at == None:
|
||||
# make the api call
|
||||
last_fetched_at = time.time()
|
||||
print(f"last_fetched_at: {last_fetched_at}")
|
||||
response = requests.get(url="http://api.litellm.ai/get_model_list", headers={"content-type": "application/json"}, data=json.dumps({"user_email": user_email}))
|
||||
print_verbose(f"get_model_list response: {response.text}")
|
||||
model_list = response.json()["model_list"]
|
||||
return model_list
|
||||
litellm.model_list = model_list # update the user's current litellm model list
|
||||
# return litellm model list by default
|
||||
return litellm.model_list
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue