Update app.py
Browse files
app.py
CHANGED
|
@@ -37,7 +37,7 @@ class BasicAgent:
|
|
| 37 |
"Authorization": f"Bearer {HF_TOKEN}"
|
| 38 |
}
|
| 39 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 40 |
-
fixed_answer = alfred.run(f"You are a general AI assistant. I will ask you a question. Please follow these steps in order to answer it: (1) Check if the sentence is written in English. If not, use your custom translator tool. (2) If the question is in English, do not use the translator. Determine whether it requires a web search, and if so, use only the exact words from the question as keywords—no synonyms. (3) If a web search is needed and the answer is likely on Wikipedia, try using the wiki_url_tool to find the relevant page; if that fails, search manually; if you need a specific numerical fact (e.g., a year or a number), use the wiki_tool to extract data from Wikipedia tables. (4) Never use synonyms not present in the question. Do not make assumptions. If you do not know the answer, say so clearly. Always report your thoughts and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don’t use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don’t use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string. Here are the questions : {question}"
|
| 41 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 42 |
return fixed_answer
|
| 43 |
|
|
|
|
| 37 |
"Authorization": f"Bearer {HF_TOKEN}"
|
| 38 |
}
|
| 39 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 40 |
+
fixed_answer = alfred.run(f"You are a general AI assistant. I will ask you a question. Please follow these steps in order to answer it: (1) Check if the sentence is written in English. If not, use your custom translator tool. (2) If the question is in English, do not use the translator. Determine whether it requires a web search, and if so, use only the exact words from the question as keywords—no synonyms. (3) If a web search is needed and the answer is likely on Wikipedia, try using the wiki_url_tool to find the relevant page; if that fails, search manually; if you need a specific numerical fact (e.g., a year or a number), use the wiki_tool to extract data from Wikipedia tables. (4) Never use synonyms not present in the question. Do not make assumptions. If you do not know the answer, say so clearly. Always report your thoughts and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don’t use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don’t use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string. Here are the questions : {question}" )
|
| 41 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 42 |
return fixed_answer
|
| 43 |
|