diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2023-05-05 02:35:50 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2023-05-05 02:35:50 -0500 |
| commit | e15103e22ef93790649c4f1189fd5a6d07aa8950 (patch) | |
| tree | fdcdaf1e3d994ac35c2fc2f2ee8ef901bc7954f6 /src/gpt_chat_cli/openai_wrappers.py | |
| parent | 14a73a409d8535ea2708770f2dc464a8d371ff0d (diff) | |
Add command to list models
Diffstat (limited to 'src/gpt_chat_cli/openai_wrappers.py')
| -rw-r--r-- | src/gpt_chat_cli/openai_wrappers.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gpt_chat_cli/openai_wrappers.py b/src/gpt_chat_cli/openai_wrappers.py index 784a9ce..413ec24 100644 --- a/src/gpt_chat_cli/openai_wrappers.py +++ b/src/gpt_chat_cli/openai_wrappers.py @@ -67,3 +67,16 @@ def create_chat_completion(*args, **kwargs) \ OpenAIChatResponse.from_json(update) \ for update in openai.ChatCompletion.create(*args, **kwargs) ) + +def list_models() -> List[str]: + + model_data = openai.Model.list() + + models = [] + + for model in model_data["data"]: + models.append(model["id"]) + + models.sort() + + return models |
