o1 release
Browse files
app.py
CHANGED
@@ -199,7 +199,7 @@ def bot(message, history, oai_key, system_prompt, seed, temperature, max_tokens,
|
|
199 |
user_msg_parts = []
|
200 |
|
201 |
if system_prompt:
|
202 |
-
if not (
|
203 |
role = "system"
|
204 |
else:
|
205 |
role = "user"
|
@@ -230,7 +230,7 @@ def bot(message, history, oai_key, system_prompt, seed, temperature, max_tokens,
|
|
230 |
if log_to_console:
|
231 |
print(f"br_prompt: {str(history_openai_format)}")
|
232 |
|
233 |
-
if model
|
234 |
response = client.chat.completions.create(
|
235 |
model=model,
|
236 |
messages= history_openai_format,
|
@@ -306,7 +306,7 @@ with gr.Blocks(delete_cache=(86400, 86400)) as demo:
|
|
306 |
|
307 |
oai_key = gr.Textbox(label="OpenAI API Key", elem_id="oai_key")
|
308 |
model = gr.Dropdown(label="Model", value="gpt-4-turbo", allow_custom_value=True, elem_id="model",
|
309 |
-
choices=["gpt-4-turbo", "gpt-4o-2024-05-13", "gpt-4o-2024-11-20", "o1-mini", "o1
|
310 |
system_prompt = gr.TextArea("You are a helpful yet diligent AI assistant. Answer faithfully and factually correct. Respond with 'I do not know' if uncertain.", label="System Prompt", lines=3, max_lines=250, elem_id="system_prompt")
|
311 |
seed = gr.Textbox(label="Seed", elem_id="seed")
|
312 |
temp = gr.Slider(0, 2, label="Temperature", elem_id="temp", value=1)
|
|
|
199 |
user_msg_parts = []
|
200 |
|
201 |
if system_prompt:
|
202 |
+
if not model.startswith("o1"):
|
203 |
role = "system"
|
204 |
else:
|
205 |
role = "user"
|
|
|
230 |
if log_to_console:
|
231 |
print(f"br_prompt: {str(history_openai_format)}")
|
232 |
|
233 |
+
if model.startswith("o1"):
|
234 |
response = client.chat.completions.create(
|
235 |
model=model,
|
236 |
messages= history_openai_format,
|
|
|
306 |
|
307 |
oai_key = gr.Textbox(label="OpenAI API Key", elem_id="oai_key")
|
308 |
model = gr.Dropdown(label="Model", value="gpt-4-turbo", allow_custom_value=True, elem_id="model",
|
309 |
+
choices=["gpt-4-turbo", "gpt-4o-2024-05-13", "gpt-4o-2024-11-20", "o1-mini", "o1", "chatgpt-4o-latest", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo-preview", "gpt-4-1106-preview", "gpt-4", "gpt-4-vision-preview", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-1106", "whisper", "dall-e-3"])
|
310 |
system_prompt = gr.TextArea("You are a helpful yet diligent AI assistant. Answer faithfully and factually correct. Respond with 'I do not know' if uncertain.", label="System Prompt", lines=3, max_lines=250, elem_id="system_prompt")
|
311 |
seed = gr.Textbox(label="Seed", elem_id="seed")
|
312 |
temp = gr.Slider(0, 2, label="Temperature", elem_id="temp", value=1)
|