forked from phoenix/litellm-mirror
fixing linting issues
This commit is contained in:
parent
46e1bc24b7
commit
1689cf14c6
2 changed files with 1 additions and 30 deletions
|
@ -1021,35 +1021,6 @@ def handle_success(args, kwargs, result, start_time, end_time):
|
||||||
)
|
)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_model_list():
|
|
||||||
global last_fetched_at
|
|
||||||
# if user is using hosted product -> get their updated model list - refresh every 5 minutes
|
|
||||||
user_email = os.getenv("LITELLM_EMAIL") or litellm.email
|
|
||||||
if user_email:
|
|
||||||
time_delta = 0
|
|
||||||
if last_fetched_at != None:
|
|
||||||
current_time = time.time()
|
|
||||||
time_delta = current_time - last_fetched_at
|
|
||||||
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.post(
|
|
||||||
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}")
|
|
||||||
data = response.json()
|
|
||||||
# update model list
|
|
||||||
model_list = data["model_list"]
|
|
||||||
return model_list
|
|
||||||
return None
|
|
||||||
# return None by default
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def acreate(*args, **kwargs): ## Thin client to handle the acreate langchain call
|
def acreate(*args, **kwargs): ## Thin client to handle the acreate langchain call
|
||||||
return litellm.acompletion(*args, **kwargs)
|
return litellm.acompletion(*args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ python = "^3.8"
|
||||||
openai = "^0.27.8"
|
openai = "^0.27.8"
|
||||||
python-dotenv = "^1.0.0"
|
python-dotenv = "^1.0.0"
|
||||||
tiktoken = "^0.4.0"
|
tiktoken = "^0.4.0"
|
||||||
importlib_metadata
|
importlib_metadata = "^6.8.0"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue