diff --git a/llm_server/routes/openai/models.py b/llm_server/routes/openai/models.py index 39931f8..9f2845d 100644 --- a/llm_server/routes/openai/models.py +++ b/llm_server/routes/openai/models.py @@ -25,38 +25,37 @@ def openai_list_models(): else: running_model = redis.get('running_model', 'ERROR', dtype=str) oai = fetch_openai_models() - r = [] + r = { + "object": "list", + "data": oai + } + # TODO: verify this works if opts.openai_expose_our_model: - r = [{ - "object": "list", - "data": [ + r["data"].insert(0, { + "id": running_model, + "object": "model", + "created": int(server_start_time.timestamp()), + "owned_by": opts.llm_middleware_name, + "permission": [ { "id": running_model, - "object": "model", + "object": "model_permission", "created": int(server_start_time.timestamp()), - "owned_by": opts.llm_middleware_name, - "permission": [ - { - "id": running_model, - "object": "model_permission", - "created": int(server_start_time.timestamp()), - "allow_create_engine": False, - "allow_sampling": False, - "allow_logprobs": False, - "allow_search_indices": False, - "allow_view": True, - "allow_fine_tuning": False, - "organization": "*", - "group": None, - "is_blocking": False - } - ], - "root": None, - "parent": None + "allow_create_engine": False, + "allow_sampling": False, + "allow_logprobs": False, + "allow_search_indices": False, + "allow_view": True, + "allow_fine_tuning": False, + "organization": "*", + "group": None, + "is_blocking": False } - ] - }] - response = jsonify_pretty(r + oai), 200 + ], + "root": None, + "parent": None + }) + response = jsonify_pretty(r), 200 return response