added system prompt to random test question
Browse files- app.py +4 -3
- requirements.txt +3 -1
- system_prompt.txt +1 -5
app.py
CHANGED
|
@@ -71,9 +71,10 @@ def run_random_question(profile: gr.OAuthProfile | None):
|
|
| 71 |
print(f"Random question is missing task_id or question")
|
| 72 |
return "Random question is missing task_id or question", None
|
| 73 |
try:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 77 |
except Exception as e:
|
| 78 |
print(f"Error running agent on task {task_id}: {e}")
|
| 79 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
| 71 |
print(f"Random question is missing task_id or question")
|
| 72 |
return "Random question is missing task_id or question", None
|
| 73 |
try:
|
| 74 |
+
with open('system_prompt.txt') as f:
|
| 75 |
+
submitted_answer = agent(f.readline()+"\n\n"+question_text)
|
| 76 |
+
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 77 |
+
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 78 |
except Exception as e:
|
| 79 |
print(f"Error running agent on task {task_id}: {e}")
|
| 80 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
requirements.txt
CHANGED
|
@@ -3,4 +3,6 @@ requests
|
|
| 3 |
smolagents[openai]
|
| 4 |
langchain_community
|
| 5 |
wikipedia
|
| 6 |
-
duckduckgo_search
|
|
|
|
|
|
|
|
|
| 3 |
smolagents[openai]
|
| 4 |
langchain_community
|
| 5 |
wikipedia
|
| 6 |
+
duckduckgo_search
|
| 7 |
+
requests
|
| 8 |
+
markdownify
|
system_prompt.txt
CHANGED
|
@@ -1,5 +1 @@
|
|
| 1 |
-
You are a helpful assistant tasked with answering questions using a set of tools.
|
| 2 |
-
Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
|
| 3 |
-
FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 4 |
-
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.
|
| 5 |
-
Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
|
|
|
|
| 1 |
+
You are a helpful assistant tasked with answering questions using a set of tools. Now, I will ask you a question. 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. Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
|
|
|
|
|
|
|
|
|
|
|
|