From 2e7fd18ba17e937c802b062b4e101968f9510d57 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Tue, 31 Dec 2024 12:18:03 -0500 Subject: [PATCH] more openai models modified: README.rst modified: app.py modified: templates/base.html modified: templates/chat.html --- README.rst | 2 ++ app.py | 26 +++++++++++++++++++++++++- templates/base.html | 2 ++ templates/chat.html | 6 ++++-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 40aa6b4..9ea7449 100644 --- a/README.rst +++ b/README.rst @@ -113,6 +113,8 @@ To interact with the various language models, you can use the following commands - For GPT-4o cheapest version, send a message with ``gpt-4o-2024-08-06`` and include your prompt. - For GPT-4o-mini, send a message with ``gpt-mini`` and include your prompt. - For GPT-o1-mini, send a message with ``gpt-o1-mini`` and include your prompt. +- For GPT-o1-preview, send a message with ``gpt-o1-preview`` and include your prompt. +- For GPT-o1, send a message with ``gpt-o1`` and include your prompt. - For Claude-haiku, send a message with ``claude-haiku`` and include your prompt. - For Claude-sonnet, send a message with ``claude-sonnet`` and include your prompt. - For Claude-opus, send a message with ``claude-opus`` and include your prompt. diff --git a/app.py b/app.py index e7f02a8..a52b017 100644 --- a/app.py +++ b/app.py @@ -62,6 +62,8 @@ system_users = [ "gpt-4-turbo-preview", "gpt-4-turbo", "o1-mini", + "o1-preview", + "o1", "mistral", "mistral-tiny", "mistral-small", @@ -110,6 +112,8 @@ HELP_MESSAGE = """ - `gpt-4o-2024-08-06`: For the cheapest version of GPT-4o, send a message with `gpt-4o-2024-08-06` and include your prompt. - `gpt-mini`: For GPT-4o-mini, send a message with `gpt-mini` and include your prompt. - `gpt-o1-mini`: For GPT-o1-mini, send a message with `gpt-o1-mini` and include your prompt. +- `gpt-o1-preview`: For GPT-o1-preview, send a message with `gpt-o1-preview` and include your prompt. +- `gpt-o1`: For GPT-o1, send a message with `gpt-o1` and include your prompt. - `claude-haiku`: For Claude-haiku, send a message with `claude-haiku` and include your prompt. - `claude-sonnet`: For Claude-sonnet, send a message with `claude-sonnet` and include your prompt. - `claude-opus`: For Claude-opus, send a message with `claude-opus` and include your prompt. @@ -758,6 +762,20 @@ def handle_message(data): room.name, model_name="o1-mini", ) + elif "gpt-o1-preview" in data["message"]: + gevent.spawn( + chat_gpt, + data["username"], + room.name, + model_name="o1-preview", + ) + elif "gpt-o1" in data["message"]: + gevent.spawn( + chat_gpt, + data["username"], + room.name, + model_name="o1", + ) if "gpt-mini" in data["message"]: gevent.spawn( chat_gpt, @@ -1175,7 +1193,13 @@ def get_openai_client_and_model(model_name="NousResearch/Hermes-3-Llama-3.1-8B") is_google_model = "gemini-" in model_name.lower() is_ollama_model = "hf.co" in model_name.lower() is_qwq_model = "qwq" in model_name.lower() - is_vllm_model = not (is_openai_model or is_xai_model or is_google_model or is_ollama_model or is_qwq_model) + is_vllm_model = not ( + is_openai_model + or is_xai_model + or is_google_model + or is_ollama_model + or is_qwq_model + ) if is_vllm_model: openai_client = OpenAI(base_url=vllm_endpoint, api_key=vllm_api_key) diff --git a/templates/base.html b/templates/base.html index bb11f01..76598ad 100644 --- a/templates/base.html +++ b/templates/base.html @@ -295,6 +295,8 @@ + + diff --git a/templates/chat.html b/templates/chat.html index a741542..2d3c7f3 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -36,6 +36,8 @@ + + @@ -83,8 +85,8 @@ const VALID_VOICES = ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']; const VALID_MODELS = [ 'None', 'gemini-flash', 'gemini-flash-8b', 'gemini-pro', 'grok-beta', 'vllm/hermes', 'vllm/qwq', 'ollama/qwen-coder', 'ollama/deepseek-coder', - 'gpt-4', 'gpt-4o-2024-08-06', 'gpt-mini', 'gpt-o1-mini', 'claude-haiku', - 'claude-sonnet', 'claude-opus', 'dall-e-3' + 'gpt-4', 'gpt-4o-2024-08-06', 'gpt-mini', 'gpt-o1-mini', 'gpt-o1-preview', 'gpt-o1', + 'claude-haiku', 'claude-sonnet', 'claude-opus', 'dall-e-3' ]; // Configuration for DOMPurify to specify which tags and attributes are allowed