aboutsummaryrefslogtreecommitdiff
path: root/src/gpt_chat_cli/openai_wrappers.py
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2023-05-05 02:35:50 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2023-05-05 02:35:50 -0500
commitf6cd64a7870dafa80cc81e52ad9a8f7fe6529154 (patch)
tree9641d75b23a1d714bd4683058db24d6338e58a3a /src/gpt_chat_cli/openai_wrappers.py
parent07699e070fb44586a98926867b0168f64cef0f64 (diff)
downloadgpt-chat-cli-f6cd64a7870dafa80cc81e52ad9a8f7fe6529154.tar.xz
gpt-chat-cli-f6cd64a7870dafa80cc81e52ad9a8f7fe6529154.zip
Add command to list models
Diffstat (limited to 'src/gpt_chat_cli/openai_wrappers.py')
-rw-r--r--src/gpt_chat_cli/openai_wrappers.py13
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