forked from phoenix/litellm-mirror
fix(proxy_server.py): handle base case for /model/info
This commit is contained in:
parent
92c4156ea1
commit
b51371952b
1 changed files with 7 additions and 3 deletions
|
@ -128,7 +128,7 @@ user_temperature = None
|
||||||
user_telemetry = True
|
user_telemetry = True
|
||||||
user_config = None
|
user_config = None
|
||||||
user_headers = None
|
user_headers = None
|
||||||
user_config_file_path = f"config_{time.time()}.yaml"
|
user_config_file_path = f"config_{int(time.time())}.yaml"
|
||||||
local_logging = True # writes logs to a local api_log.json file for debugging
|
local_logging = True # writes logs to a local api_log.json file for debugging
|
||||||
experimental = False
|
experimental = False
|
||||||
#### GLOBAL VARIABLES ####
|
#### GLOBAL VARIABLES ####
|
||||||
|
@ -1936,8 +1936,12 @@ async def add_new_model(model_params: ModelParams):
|
||||||
async def model_info_v1(request: Request):
|
async def model_info_v1(request: Request):
|
||||||
global llm_model_list, general_settings, user_config_file_path
|
global llm_model_list, general_settings, user_config_file_path
|
||||||
# Load existing config
|
# Load existing config
|
||||||
with open(f"{user_config_file_path}", "r") as config_file:
|
if os.path.exists(f"{user_config_file_path}"):
|
||||||
config = yaml.safe_load(config_file)
|
with open(f"{user_config_file_path}", "r") as config_file:
|
||||||
|
config = yaml.safe_load(config_file)
|
||||||
|
else:
|
||||||
|
config = {"model_list": []} # handle base case
|
||||||
|
|
||||||
all_models = config["model_list"]
|
all_models = config["model_list"]
|
||||||
for model in all_models:
|
for model in all_models:
|
||||||
# provided model_info in config.yaml
|
# provided model_info in config.yaml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue