Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -223,6 +223,20 @@ def get_concise_answer(
|
|
223 |
Returns:
|
224 |
str: The concise AI response, or None if an error occurs.
|
225 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
try:
|
227 |
response = requests.post(
|
228 |
url="https://openrouter.ai/api/v1/chat/completions",
|
@@ -232,23 +246,7 @@ def get_concise_answer(
|
|
232 |
"messages": [
|
233 |
{
|
234 |
"role": "system",
|
235 |
-
"content":
|
236 |
-
You are an AI assistant that answers questions directly and concisely.
|
237 |
-
-Respond with only the factual answer, no prefixes, explanations, or extra text.
|
238 |
-
-Do not write reflection in the response just one or few words in the answer.
|
239 |
-
-Do not write for example the surname is Agnew but instead write Agnew directy.
|
240 |
-
-Do not write I searched wikipedia ... but write the answer in one or few words.
|
241 |
-
-Do not add separators to the answer.
|
242 |
-
-Answer with complete name of the country. For instance use France instead FRA.
|
243 |
-
-If the words in the question are inversed like siht si, reverse the question than answer what is demaded.
|
244 |
-
|
245 |
-
Examples:
|
246 |
-
- User: Who is the CEO of Tesla?
|
247 |
-
- AI: Elon Musk
|
248 |
-
- User: Capital of Japan?
|
249 |
-
- AI: Tokyo
|
250 |
-
|
251 |
-
"""
|
252 |
},
|
253 |
{"role": "user", "content": prompt}
|
254 |
],
|
|
|
223 |
Returns:
|
224 |
str: The concise AI response, or None if an error occurs.
|
225 |
"""
|
226 |
+
sys_message = """You are an AI assistant that answers questions directly and concisely.
|
227 |
+
-Respond with only the factual answer, no prefixes, explanations, or extra text.
|
228 |
+
-Do not write reflection in the response just one or few words in the answer.
|
229 |
+
-Do not write for example the surname is Agnew but instead write Agnew directy.
|
230 |
+
-Do not write I searched wikipedia ... but write the answer in one or few words.
|
231 |
+
-Do not add separators to the answer.
|
232 |
+
-Answer with complete name of the country. For instance use France instead FRA.
|
233 |
+
-If the words in the question are inversed like siht si, reverse the question than answer what is demaded.
|
234 |
+
Examples:
|
235 |
+
- User: Who is the CEO of Tesla?
|
236 |
+
- AI: Elon Musk
|
237 |
+
- User: Capital of Japan?
|
238 |
+
- AI: Tokyo
|
239 |
+
"""
|
240 |
try:
|
241 |
response = requests.post(
|
242 |
url="https://openrouter.ai/api/v1/chat/completions",
|
|
|
246 |
"messages": [
|
247 |
{
|
248 |
"role": "system",
|
249 |
+
"content": sys_message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
},
|
251 |
{"role": "user", "content": prompt}
|
252 |
],
|