fix openai models response

This commit is contained in:
Cyberes 2023-10-01 23:07:49 -06:00
parent 21da2f6373
commit d1c4e68f8b
1 changed files with 26 additions and 27 deletions

View File

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