Add action -L to list all available models

This commit is contained in:
2023-08-05 16:04:25 +02:00
parent ca3a53e68b
commit caf5244d52
2 changed files with 15 additions and 1 deletions
+11
View File
@@ -5,6 +5,17 @@ def openai_api_key(api_key: str) -> None:
openai.api_key = api_key
def display_models() -> None:
not_ready = []
for engine in sorted(openai.Engine.list()['data'], key=lambda x: x['id']):
if engine['ready']:
print(engine['id'])
else:
not_ready.append(engine['id'])
if len(not_ready) > 0:
print('\nNot ready: ' + ', '.join(not_ready))
def ai(chat: list[dict[str, str]],
config: dict,
number: int