aboutsummaryrefslogtreecommitdiff
path: root/src/gpt_chat_cli/openai_wrappers.py
diff options
context:
space:
mode:
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