Update app.py
Browse files
app.py
CHANGED
|
@@ -105,29 +105,29 @@ def respond(
|
|
| 105 |
temperature,
|
| 106 |
top_p,
|
| 107 |
):
|
| 108 |
-
res = ra(val[1])
|
| 109 |
-
system_message = f"""
|
| 110 |
-
You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.
|
| 111 |
-
|
| 112 |
-
Instructions:
|
| 113 |
-
1. **Only use the context provided below** to answer the question. You should reference the context directly to ensure your answer is as relevant as possible.
|
| 114 |
-
2. If the question is outside the scope of League of Legends lore, respond by saying: *"Please ask something related to League of Legends lore."*
|
| 115 |
-
3. If the provided context does not provide a clear answer or you're unsure, respond by saying: *"I'm unsure based on the provided context."*
|
| 116 |
-
|
| 117 |
-
Context: {res['context']}
|
| 118 |
-
|
| 119 |
-
Question: {res['question']}
|
| 120 |
-
|
| 121 |
-
Answer:
|
| 122 |
-
|
| 123 |
-
"""
|
| 124 |
-
messages = [{"role": "system", "content": system_message}]
|
| 125 |
-
|
| 126 |
for val in history:
|
| 127 |
if val[0]:
|
| 128 |
messages.append({"role": "user", "content": val[0]})
|
| 129 |
if val[1]:
|
| 130 |
messages.append({"role": "assistant", "content": val[1]})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
messages.append({"role": "user", "content": message})
|
| 133 |
|
|
|
|
| 105 |
temperature,
|
| 106 |
top_p,
|
| 107 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
for val in history:
|
| 109 |
if val[0]:
|
| 110 |
messages.append({"role": "user", "content": val[0]})
|
| 111 |
if val[1]:
|
| 112 |
messages.append({"role": "assistant", "content": val[1]})
|
| 113 |
+
res = ra(val[1])
|
| 114 |
+
system_message = f"""
|
| 115 |
+
You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.
|
| 116 |
+
|
| 117 |
+
Instructions:
|
| 118 |
+
1. **Only use the context provided below** to answer the question. You should reference the context directly to ensure your answer is as relevant as possible.
|
| 119 |
+
2. If the question is outside the scope of League of Legends lore, respond by saying: *"Please ask something related to League of Legends lore."*
|
| 120 |
+
3. If the provided context does not provide a clear answer or you're unsure, respond by saying: *"I'm unsure based on the provided context."*
|
| 121 |
+
|
| 122 |
+
Context: {res['context']}
|
| 123 |
+
|
| 124 |
+
Question: {res['question']}
|
| 125 |
+
|
| 126 |
+
Answer:
|
| 127 |
+
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
messages = [{"role": "system", "content": system_message}]
|
| 131 |
|
| 132 |
messages.append({"role": "user", "content": message})
|
| 133 |
|