2023-09-11 23:49:30 +02:00
|
|
|
from modules import shared
|
|
|
|
from modules.utils import get_available_models
|
2023-07-11 23:50:08 +02:00
|
|
|
|
2023-07-12 20:33:25 +02:00
|
|
|
|
2023-11-08 03:59:02 +01:00
|
|
|
def get_current_model_info():
|
|
|
|
return {
|
|
|
|
'model_name': shared.model_name,
|
|
|
|
'lora_names': shared.lora_names
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-08 04:59:27 +01:00
|
|
|
def list_models():
|
|
|
|
result = {
|
2023-07-11 23:50:08 +02:00
|
|
|
"object": "list",
|
2023-11-08 04:59:27 +01:00
|
|
|
"data": []
|
2023-07-11 23:50:08 +02:00
|
|
|
}
|
|
|
|
|
2023-11-08 04:59:27 +01:00
|
|
|
for model in get_dummy_models() + get_available_models()[1:]:
|
|
|
|
result["data"].append(model_info_dict(model))
|
2023-07-11 23:50:08 +02:00
|
|
|
|
2023-11-08 04:59:27 +01:00
|
|
|
return result
|
2023-07-11 23:50:08 +02:00
|
|
|
|
2023-11-08 04:59:27 +01:00
|
|
|
|
|
|
|
def model_info_dict(model_name: str) -> dict:
|
2023-07-11 23:50:08 +02:00
|
|
|
return {
|
|
|
|
"id": model_name,
|
|
|
|
"object": "model",
|
2023-11-08 04:59:27 +01:00
|
|
|
"created": 0,
|
|
|
|
"owned_by": "user"
|
2023-07-11 23:50:08 +02:00
|
|
|
}
|
2023-11-08 04:59:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
def get_dummy_models() -> list:
|
|
|
|
return [ # these are expected by so much, so include some here as a dummy
|
|
|
|
'gpt-3.5-turbo',
|
|
|
|
'text-embedding-ada-002',
|
|
|
|
]
|