Update app.py
Browse files
app.py
CHANGED
|
@@ -21,20 +21,23 @@ OPENAI_MODEL = "gpt-5-mini-2025-08-07"
|
|
| 21 |
GEMINI_MODEL = "gemini-1.5-flash"
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
system_message += """
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
""".strip()
|
| 33 |
|
| 34 |
-
system_message
|
| 35 |
-
The C++ response needs to produce an identical output in the
|
| 36 |
-
fastest possible time.
|
| 37 |
-
""".strip()
|
| 38 |
|
| 39 |
current_time = datetime.now().strftime("%Y%m%d_%H:%M:%S")
|
| 40 |
|
|
@@ -57,7 +60,7 @@ def user_prompt_for_python(python_code):
|
|
| 57 |
|
| 58 |
def messages_for_python(python):
|
| 59 |
return [
|
| 60 |
-
{"role": "system", "content":
|
| 61 |
{"role": "user", "content": user_prompt_for_python(python)}
|
| 62 |
]
|
| 63 |
|
|
|
|
| 21 |
GEMINI_MODEL = "gemini-1.5-flash"
|
| 22 |
|
| 23 |
|
| 24 |
+
def system_message_for_python() -> str:
|
| 25 |
+
system_message = """
|
| 26 |
+
You are an assistant that reimplements Python code in high performance C++
|
| 27 |
+
for an M1 Mac.
|
| 28 |
+
""".strip()
|
| 29 |
+
|
| 30 |
+
system_message += """
|
| 31 |
+
Respond only with C++; use comments sparingly and do not provide any
|
| 32 |
+
explanation other than occasion comments.
|
| 33 |
+
""".strip()
|
| 34 |
|
| 35 |
+
system_message += """
|
| 36 |
+
The C++ response needs to produce an identical output in the
|
| 37 |
+
fastest possible time.
|
| 38 |
+
""".strip()
|
| 39 |
|
| 40 |
+
return system_message
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
current_time = datetime.now().strftime("%Y%m%d_%H:%M:%S")
|
| 43 |
|
|
|
|
| 60 |
|
| 61 |
def messages_for_python(python):
|
| 62 |
return [
|
| 63 |
+
{"role": "system", "content": system_message_for_python()},
|
| 64 |
{"role": "user", "content": user_prompt_for_python(python)}
|
| 65 |
]
|
| 66 |
|