Spaces:
Running
Running
:wrench: apply reflection system prompt only to Reflection 70B
Browse files
app.py
CHANGED
@@ -10,15 +10,21 @@ client = OpenAI(
|
|
10 |
api_key=api_key
|
11 |
)
|
12 |
|
13 |
-
|
14 |
|
15 |
def respond(message, history, model):
|
16 |
-
history_openai_format = [
|
17 |
for human, assistant in history:
|
18 |
history_openai_format.append({"role": "user", "content": human })
|
19 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
20 |
history_openai_format.append({"role": "user", "content": message})
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
response = client.chat.completions.create(
|
23 |
model=model,
|
24 |
messages= history_openai_format,
|
|
|
10 |
api_key=api_key
|
11 |
)
|
12 |
|
13 |
+
REFLECTION_SYSTEM_PROMPT = """You are a world-class AI system, capable of complex reasoning and reflection. Reason through the query inside <thinking> tags, and then provide your final response inside <output> tags. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags."""
|
14 |
|
15 |
def respond(message, history, model):
|
16 |
+
history_openai_format = []
|
17 |
for human, assistant in history:
|
18 |
history_openai_format.append({"role": "user", "content": human })
|
19 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
20 |
history_openai_format.append({"role": "user", "content": message})
|
21 |
|
22 |
+
if model == "mattshumer/Reflection-Llama-3.1-70B":
|
23 |
+
history_openai_format = [
|
24 |
+
{"role": "system", "content": REFLECTION_SYSTEM_PROMPT},
|
25 |
+
*history_openai_format
|
26 |
+
]
|
27 |
+
|
28 |
response = client.chat.completions.create(
|
29 |
model=model,
|
30 |
messages= history_openai_format,
|